Customize headers in a datagrid

Ludovic Thébault ludovic.thebault at laposte.net
Wed Mar 17 15:19:27 EDT 2010


Le 11 mars 2010 à 16:24, Trevor DeVore a écrit :

> 
> 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.


It's work, but only if i change the script in the library.
If i create a button in my stack, paste the script of button "Default Header" of stack "revDataGridLibrary" in it, change the script, and set the dgProp of the dataGrid to this button, the htmltext doesn't work : in the label of a column is see "<img src=200656>my label" and my image and the label.

Then, i want to use my own "international" sort (but i saw there is a lesson about this).
The built-in international sort forgot "œ, é, à...." i hope rev 4.5 come with a real international sorting !
 


More information about the use-livecode mailing list