More Data Grid Difficulties - Making it request data
Trevor DeVore
lists at mangomultimedia.com
Tue Mar 16 08:28:36 EDT 2010
On Mar 16, 2010, at 8:10 AM, Len Morgan wrote:
> To answer your first question, the lines aren't getting colored and
> I have a message that's supposed to print to the message box as it
> goes by. I went so far as to put a 500 ms delay in this routine (so
> EVERY column would wait 1/2 a second just in case the message got
> overwritten by a later message.
I think I need some more information about how you have set up your
data grid. Where have you defined FillInData? Have you created a
custom column behavior for your table as described in this lesson?
http://lessons.runrev.com/spaces/lessons/manuals/datagrid/lessons/7327-How-Do-I-Override-the-Default-Behavior-For-Rendering-Data-to-a-Cell-
> I'm not sure what you mean exactly by "what columns have you
> defined". They are all text fields, (e.g., no icons, images,
> buttons, etc). I create the data array by going though the returned
> data a line at a time and creating a tab (col) delimited, cr (row)
> delimited variable then use:
On the Columns tab of the data grid object inspector you define the
columns in your data grid. This affects which columns appear in your
data grid table.
> To clarify your first comment, if I set the entire data array using
> dgText, does it call FillInData for every line possible or only the
> visible ones?
Only the visible ones. A data grid will only ask for data on an as-
needed basis UNLESS you set the "cache controls" property to true. But
that only works with forms so it won't apply in your case.
> The reason I ask is that one of the things I want to do with
> FillInData is to get three more fields that don't come out of the
> original query. I have two dates that come out of another table and
> have not been able to come up with any SQL query that would return
> these fields in the original query.
In situations like this I have run the necessary queries, joined the
results and then assigned the resulting data to the data grid.
> What I want to do is when FillIndata gets to the first field (key
> field), I can call another query for that one record only. As each
> row is processed, I can get these two dates. This will not be a
> processing burden IF I only fill the data that is on the screen at
> the time.
If you want to go this route you could modify your FillInData routine
to look something like this:
on FillInData pData
## Note: Not very efficient as FillInData is called for every
column of every row
## Check if date column has been fill in yet.
if GetDataOfIndex(the dgIndex of me, "Date 1") is empty then
## Query db and get date values...
## Assign to row in Data Grid
SetDataOfIndex the dgIndex of me, "Date 1", theDateValue
end if
set the text of me to pData
end FillInData
> The last "field" I need isn't really a field but rather, based on
> the value of this field, I need to set the row color. This field I
> DO have at the time theDataA array is created.
The instructions for colorizing a line described in the lesson should
work then. Let me know about whether or not you set up the custom
column behavior and we can go from there.
--
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