Working with a DataGrid

Terence Heaford t.heaford at btinternet.com
Sun Jul 27 03:10:42 EDT 2014


Thanks for your idea, will have a play.

My experiments at the moment have resulted in this:

1. Place a rectangle graphic in the row template.

2. Create a column behaviour.

3. In the behaviour script there is a method "on FillInData pData”

4. pData is the value passed to the DataGrid for this column.

5. “barGraphic” is the rectangle graphic I created in the row template.

In this method as an experiment I currently have:

on FillInData pData
    -- This message is sent when the Data Grid needs to populate
    -- this template with the column data. pData is the value to be displayed.
    
   set the width of grc "barGraphic" of me to pData
   set the left  of grc "barGraphic" of me to 300
   
    -- Example:
    set the text of field 1 of me to pData
end FillInData


Currently with this method I have the text field containing pData showing to the left of the rectangle grc in the column.

This is "set the text of field 1 of me to pData”. I presume but have not tried yet that this field could be hidden by modifying the row template.

I am not sure of the actual method you are to use to achieve this, that’s why I’m currently calling it an experiment.

I presume the designers of the DG had a plan for this sort of thing but I can’t find any examples anywhere.

All the best

Terry



On 26 Jul 2014, at 23:06, stephen barncard <stephenREVOLUTION2 at barncard.com> wrote:

> On Sat, Jul 26, 2014 at 3:35 AM, Terence Heaford <t.heaford at btinternet.com>
> wrote:
> 
>> I then want to change the colour and length of the bar.
>> 
>> How would I set about achieving this?
>> 
> 
> I did something like that by setting the background color on texts with
> varying numbers of characters and setting the foreground-color to the same
> value. So you could use multiple characters of the width you need.  The
> characters will be invisible but the size of the 'bar' will change.
> 
> Another way could be done by making a graphic image of a granular piece of
> the desired bar, then setting the imagesource of each chunk of text, they
> will turn into the desired bar.
> 
> set the imageSource of character to {imageID |imageName |imageURL |empty}
> set the imageSource of char 1 of line 2 of field "This" to 2533
> set the imageSource of char thisChar of field 1 to "Arrow"
> set the imageSource of last char of me to "binfile:My Image"
> *--*
> *Stephen Barncard - San Francisco Ca. USA - Deeds Not Words*
> _______________________________________________
> use-livecode mailing list
> use-livecode at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode





More information about the use-livecode mailing list