DataGrid2 - Improved Graphics Means What - Exactly?
Mark Waddingham
mark at livecode.com
Fri Jun 23 03:28:24 EDT 2017
On 2017-06-23 07:23, Sannyasin Brahmanathaswami via use-livecode wrote:
> What is the scope of the improved graphics rendering? Is It DataGrid
> only?
No - the proposed engine addition (container layer mode) is not DataGrid
only - it is a general feature usable by any custom control which wants
to take advantage of acceleratedRendering.
At present, acceleratedRendering only works on top-level controls (those
which have a card as parent). The key engine change proposed is to add a
'container' layerMode. This would apply to groups and would mean that
instead of treating the group and its children as one thing,
acceleratedRendering should ignore the group (as it is just a container)
and look it's child controls instead. The end result being that controls
within a group (which has been marked as a container) can be individual
layers and thus benefit from acceleratedRendering, but still clipped by
the containing group's bounds.
In the case of the DataGrid we can use this in two ways:
1) In form view mode, each row can be a separate layer which means
they can be moved at zero re-rendering cost, thus allowing smooth
animation of the individual rows.
2) In table view mode, the group (inside the DataGrid) which actually
holds the content (as a set of grouped columns) can be its own scrolling
layer, thus allowing smooth scrolling of it.
> What about
> 1) other long grouped controls that need to scroll as one long group?
You can already use acceleratedRendering to do this but it currently
only works for top-level groups and your groups have to be 'unadorned' -
meaning that you have turned off all properties of the group which mean
the group itself renders something (e.g. borders, scrollbars).
This currently works well if you are targeting platforms where you don't
have scrollbars and can express your control as a single group. However,
it doesn't work for custom controls as (in that scenario) you usually
have the 'custom control group' containing the controls which provide
the display of the custom control - this is the case with the DataGrid,
for example.
> 2) scrolling fields
> 3) scrolling list fields
You can get fields and list fields to scroll smoothly at the moment with
acceleratedRendering by putting a field (with full height of its
content) within a 'scrolling' layerMode group. However, at the moment,
this would mean you don't get scrollbars, and can't have borders (or any
other adornments).
With the 'container' layerMode, you will be able to create a custom
control which lifts the 'no adornment' limitation. You would compose
such a thing of:
custom control group (container layerMode)
content group (scrolling layerMode)
field with content (always full height of content)
adornment controls (static layerMode) (e.g. scrollbars, border)
There's a lot more we could do here in the future (in the engine) to
make it easier to have smoothly scrolling fields and groups (which don't
really need to be custom controls), however, that work is logically
distinct from adding 'container' layerMode; and 'container' layerMode
makes it possible to do the same thing in script so was the best choice
for the Feature Exchange proposal in this case particularly as it is
general feature which can be leveraged directly by script.
Mark.
--
Mark Waddingham ~ mark at livecode.com ~ http://www.livecode.com/
LiveCode: Everyone can create apps
More information about the use-livecode
mailing list