Customize headers in a datagrid
Trevor DeVore
lists at mangomultimedia.com
Thu Mar 11 10:24:05 EST 2010
On Mar 11, 2010, at 1:35 AM, Ludovic Thébault wrote:
> It's possible to add a little icon before the label of a column ?
You are wandering into undocumented territory but now seems like a
good time to start documenting it. Here is some information that
should help you out. Let's see if we can accomplish what you are
trying to do and then I can move the relevant information into the
manual.
YOUR OPTIONS
There are two ways you can manipulate how a column header behaves:
1) You can override the default behavior for column headers by setting
the "default header behavior" property:
set the dgProp["default header behavior"] of group "DataGrid" to the
long id of button "MyCustomBehavior"
The default behavior is stored in button "Default Header" of stack
"revDataGridLibrary". You can create your custom behavior using that
button script as a starting point.
2) You can create a custom column header template. You can specify a
custom template for a column header by adding a control to the data
grid template group named:
COLUMN_NAME [Header]
The Data Grid will use that control when drawing the column header.
ONE APPROACH
A simple solution for adding an icon would be to update to the column
header behavior script to work with the HTMLText rather than the text.
In the "Default Header" script is a dgLabel setProp:
setprop dgLabel pValue
set the text of field 1 of me to pValue
end dgLabel
You could create your own behavior script that did this:
setprop dgLabel pValue
set the htmltext of field 1 of me to pValue
end dgLabel
You can could then assign htmltext to the column label using <img src>
to specify the image id you want to display:
set the dgColumnLabel[ COLUMN_NAME ] of group "DataGrid" to "<img
src=2000> My Label"
Let me know how it goes.
--
Trevor DeVore
Blue Mango Learning Systems
ScreenSteps: http://www.screensteps.com
Releasable Revolution Resources for Developers: http://revolution.bluemangolearning.com
More information about the use-livecode
mailing list