datagrid scrolling question

classic Classic list List threaded Threaded
10 messages Options
Reply | Threaded
Open this post in threaded view
|

datagrid scrolling question

Skip Kimpel via use-livecode
I sent a badly constructed message with this content (more or less) a few days ago.  I am re-posting it in the hope that anyone who tried to decipher those two messages will give this another consideration.

So pardon the repeat, but I'm quite sure someone from this group can lend me a hand on this issue.

Using LC v8.1.9 on Windows 7 pro

Using a datagrid form, each row has 1 checkbox, 3 fields and 2 buttons.

One of the buttons (the one I need assistance with), named "Query" calls the "tsnet" library to query a remote WiFi module (esp8266) which returns the status of one of its IO pins.  Works like a charm on ALL rows, scrolled or not... because (I reckon) the button is actually *IN* the grid, so there's no issue with the group name (as will become clear in a moment).. it is always "me".

I also want to "automate" the queries (there are 8 such wifi modules involved).  So I have a button outside of the datagrid which selects each row of the populated datagrid in a "repeat" statement and sends a "mouseUp" message to the datagrid.

What I discovered is that (apparently) I have to "manufacture" the group name of each row to which I want to send the "mouseUp" message.  So as I progress through the populated rows of the grid the "pseudo" group name of each row basically becomes the row number along with a prefix of "Row Template"... i.e. row 1's group name/label is "Row Template 0001", row 2 is "Row Template 0002", etc.

Great... but once the grid starts to scroll, strange things start to happen.  The pseudo-group name will "wrap"... and where it wraps depends on the number of rows which are initially visible on the grid.

For example, if there are 8 populated rows and the DataGrid is sized to only show 3 rows at a time, upon the initialization of the Datagrid, the "pseudo" Row templates groups are named:

row 1:  "Row Template 0001"
row 2:  "Row Template 0002"
row 3:  "Row Template 0003"
row 4:  "Row Template 0004"
row 5:  "Row Template 0005"
row 6:  "Row Template 0001"
row 7:  "Row Template 0002"
row 8:  "Row Template 0003"

this is demonstrated by putting a "put me" in the Behavior Script within the MouseUp handler to which I am sending the "mouseUp" message in order to "process" that row's content... i.e.

on mouseUp
        put me
        ...do something
end mouseUp

What is interesting (and confusing at the same time), if I use a specific "wrapping pattern" (such as the one described above) and mutually "wrap" the name of the group to which I am about to send the "mouseUp" message, it works!  ... i.e. from within the button outside of the datagrid:
... (in this example, the serverList array holds the 8 wifi module names I need to query with tsnet)

put "0000" into pad
put 0 into q
repeat with y = 1 to (the number of lines in the keys of serverList)
   set the dgHilitedLines of group "DataGrid 1" to y
   add 1 to q
   if q > 5 then put 1 into q
   put char 1 to (4 - length(q)) of pad & q into z
   put char 1 to (4 - length(y)) of pad & y into z
   put "Row Template " & z into z
   send "mouseUp" to button "Query" of group z
end repeat

THIS is confusing because, although I am sending the same message to what appears to be the same pseudo-group name, once the grid scrolls beyond row 5, LC manages to know that I am actually referencing another grid row than the one(s) with the same pseudo-group names.

To scroll the grid, programatically, I used:
   set the dgHilitedLines of group "DataGrid 1" to y  
to accomplish this.

I also tried the more "seemingly appropriate":
   dispatch "ScrollLineIntoView" to group "DataGrid 1" with pLine"

but this command changes the highlight of one of my fields which I have customized to have red text in case of an error.  Regardless, using either method for scrolling does NOT seem to have any effect on the wrapping of the pseudo group name.

Since this "wrap-point" changes based on the "amount" of the datagrid I "expose", this doesn't lend itself to portable or supportable code.

If I don't "wrap" my group names according to this sort of pattern, once my code reaches the 6th line (in my example), I get a:
" ... Chunk: can't find background), char 1 " error ... because "Row Template 0006" does not exist... it is "Row Template 0001"

No doubt I'm approaching this wrong but I'm trying to teach myself datagrids and it's a struggle for this old brain!
Is there another method for sending a "mouseUp" to a button on a datagrid form row?

Douglas Ruisaard
Trilogy Software
(250) 573-3935



Douglas Ruisaard
Trilogy Software
(250) 573-3935




_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|

Re: datagrid scrolling question

Skip Kimpel via use-livecode
My question is why use the button? Loop through the data in the grid and make the tsnet call manually for each line. If the button is calling a script outside of the DG, then you can use the same call. Then you don’t have to do any of those things to figure out the name of the row group.
On Aug 4, 2018, 5:39 PM -0500, Douglas Ruisaard via use-livecode <[hidden email]>, wrote:

> I sent a badly constructed message with this content (more or less) a few days ago. I am re-posting it in the hope that anyone who tried to decipher those two messages will give this another consideration.
>
> So pardon the repeat, but I'm quite sure someone from this group can lend me a hand on this issue.
>
> Using LC v8.1.9 on Windows 7 pro
>
> Using a datagrid form, each row has 1 checkbox, 3 fields and 2 buttons.
>
> One of the buttons (the one I need assistance with), named "Query" calls the "tsnet" library to query a remote WiFi module (esp8266) which returns the status of one of its IO pins. Works like a charm on ALL rows, scrolled or not... because (I reckon) the button is actually *IN* the grid, so there's no issue with the group name (as will become clear in a moment).. it is always "me".
>
> I also want to "automate" the queries (there are 8 such wifi modules involved). So I have a button outside of the datagrid which selects each row of the populated datagrid in a "repeat" statement and sends a "mouseUp" message to the datagrid.
>
> What I discovered is that (apparently) I have to "manufacture" the group name of each row to which I want to send the "mouseUp" message. So as I progress through the populated rows of the grid the "pseudo" group name of each row basically becomes the row number along with a prefix of "Row Template"... i.e. row 1's group name/label is "Row Template 0001", row 2 is "Row Template 0002", etc.
>
> Great... but once the grid starts to scroll, strange things start to happen. The pseudo-group name will "wrap"... and where it wraps depends on the number of rows which are initially visible on the grid.
>
> For example, if there are 8 populated rows and the DataGrid is sized to only show 3 rows at a time, upon the initialization of the Datagrid, the "pseudo" Row templates groups are named:
>
> row 1: "Row Template 0001"
> row 2: "Row Template 0002"
> row 3: "Row Template 0003"
> row 4: "Row Template 0004"
> row 5: "Row Template 0005"
> row 6: "Row Template 0001"
> row 7: "Row Template 0002"
> row 8: "Row Template 0003"
>
> this is demonstrated by putting a "put me" in the Behavior Script within the MouseUp handler to which I am sending the "mouseUp" message in order to "process" that row's content... i.e.
>
> on mouseUp
> put me
> ...do something
> end mouseUp
>
> What is interesting (and confusing at the same time), if I use a specific "wrapping pattern" (such as the one described above) and mutually "wrap" the name of the group to which I am about to send the "mouseUp" message, it works! ... i.e. from within the button outside of the datagrid:
> ... (in this example, the serverList array holds the 8 wifi module names I need to query with tsnet)
>
> put "0000" into pad
> put 0 into q
> repeat with y = 1 to (the number of lines in the keys of serverList)
> set the dgHilitedLines of group "DataGrid 1" to y
> add 1 to q
> if q > 5 then put 1 into q
> put char 1 to (4 - length(q)) of pad & q into z
> put char 1 to (4 - length(y)) of pad & y into z
> put "Row Template " & z into z
> send "mouseUp" to button "Query" of group z
> end repeat
>
> THIS is confusing because, although I am sending the same message to what appears to be the same pseudo-group name, once the grid scrolls beyond row 5, LC manages to know that I am actually referencing another grid row than the one(s) with the same pseudo-group names.
>
> To scroll the grid, programatically, I used:
> set the dgHilitedLines of group "DataGrid 1" to y
> to accomplish this.
>
> I also tried the more "seemingly appropriate":
> dispatch "ScrollLineIntoView" to group "DataGrid 1" with pLine"
>
> but this command changes the highlight of one of my fields which I have customized to have red text in case of an error. Regardless, using either method for scrolling does NOT seem to have any effect on the wrapping of the pseudo group name.
>
> Since this "wrap-point" changes based on the "amount" of the datagrid I "expose", this doesn't lend itself to portable or supportable code.
>
> If I don't "wrap" my group names according to this sort of pattern, once my code reaches the 6th line (in my example), I get a:
> " ... Chunk: can't find background), char 1 " error ... because "Row Template 0006" does not exist... it is "Row Template 0001"
>
> No doubt I'm approaching this wrong but I'm trying to teach myself datagrids and it's a struggle for this old brain!
> Is there another method for sending a "mouseUp" to a button on a datagrid form row?
>
> Douglas Ruisaard
> Trilogy Software
> (250) 573-3935
>
>
>
> Douglas Ruisaard
> Trilogy Software
> (250) 573-3935
>
>
>
>
> _______________________________________________
> use-livecode mailing list
> [hidden email]
> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode
_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|

Re: datagrid scrolling question

Skip Kimpel via use-livecode
In reply to this post by Skip Kimpel via use-livecode
I am a little lost here as to why this is a DG question as such.
Certainly being able to dynamically fill data within a row is a great UI feature when the user is directly interacting with a row.
But it seems you wish to completely fill particular values in all the rows from outside the DG.
In this case, why not operate directly on the DGdata, loop through the array, fill in all the required values and then send the whole array back to the DG?

_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|

Re: datagrid scrolling question

Skip Kimpel via use-livecode
I was thinking the same thing. I think the critical distinction is that
datagrids are primarily display mechanisms, not really intended to be read
directly. It's much easier to parse the original input data than to try to
traverse the grid itself, which uses some tricks to appear as a continuous
single control.

--
Jacqueline Landman Gay | [hidden email]
HyperActive Software | http://www.hyperactivesw.com
On August 4, 2018 6:54:21 PM James At The Hale via use-livecode
<[hidden email]> wrote:

> I am a little lost here as to why this is a DG question as such.
> Certainly being able to dynamically fill data within a row is a great UI
> feature when the user is directly interacting with a row.
> But it seems you wish to completely fill particular values in all the rows
> from outside the DG.
> In this case, why not operate directly on the DGdata, loop through the
> array, fill in all the required values and then send the whole array back
> to the DG?
>
> _______________________________________________
> use-livecode mailing list
> [hidden email]
> Please visit this url to subscribe, unsubscribe and manage your
> subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode




_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|

Re: datagrid scrolling question

Skip Kimpel via use-livecode
Same remark than Mike, James and Jacque. When you have to change the value
of each row, populating the datagrid with a new data, seems to be the
better way to go.

Now for helping you with datagrids, I think you have to understand 2
importants concepts about datagrids:
- rows groups are created on the fly when you are scrolling the datagrid,
so they have no existence if you are not scrolling the datagrid (excepted
if the cache control option is activated, but this is another story). That
is explaining you have to scroll yourself the datagrid to be able to send
the click to the corresponding button
- the data displayed in the datagrid resides in an array named dgData. This
array is "multidimensional".
Basically the first key is representing the line, and the second key is
containing the values of the datagrid.
put "Row 1 First key value" into tDataA[1]["First key"]
put "Row 1 Second key value" into tDataA[1]["Second key"]
put "Row 2 First key value" into tDataA[1]["First key"]
put "Row 2 Second key value" into tDataA[1]["Second key"]

For a datagrid table we have an immediate graphical representation because
each keys are columns of the datagrid, and the fillindata handler located
in the default row script is doing the job for us of automatically populate
the column content.

First Key                                         Second key
Row 1 First key value                     Row 1 Second key value
Row 2 First key value                     Row 2 Second key value

For datagrid form with more than one value key, the developer must take
care himself of binding the key to one of the controls of the form
template. So we could potentially have a key by control if required (or
more than a key for a control. We will see the interest below).

on FillInData pDataArray

set the text of field "Label" of me to pDataArray["label 1"]

end FillInData

By default if you are populating the datagrid by using the inspector (or by
using the dgText property), the first key will be "label 1", the second
"label 2", etc. But if you are populating the datagrid by using the dgData
array, the keys used will be the keys you have defined for your dgData. So
in our example: "First key" and "Second key"

An example of script for your "one checkbox, three fields and two buttons"
template, might looks like:

on FillInData pDataArray
set the text of field "Label1" of me to pDataArray["label 1"]
set the text of field "Label2" of me to pDataArray["label 2"]
set the text of field "Label3" of me to pDataArray["label 3"]
set the hilited of btn "Checkbox1" of me to (pDataArray["check box state"]
is "true")
end FillInData

With a dgData looking like:
put "My label 1 row 1" into tData[1]["label 1"]
put "My label 2 row 1" into tData[1]["label 2"]
put "My label 3 row 1" into tData[1]["label 3"]
put "true" into tData[1]["check box state"]
put "My label 1 row 2" into tData[2]["label 1"]
put "My label 2 row 2" into tData[2]["label 2"]
put "My label 3 row 3" into tData[2]["label 3"]
put "false" into tData[2]["check box state"]
set the dgData of grp "myDataGrid" to tData

Now, for some purpose, such as interacting with the row controls, it could
be interesting to have additional keys inside the data. Not I'm thinking a
click in a button is required in your case. But you might have the need to
hide or to disable a button of a specific row on the fly by clicking a
button outside of the datagrid.

In this case
1. we are changing the data for the row by using the
 set the dgDataOfIndex property (see the datagrid documentation
http://lessons.livecode.com/m/datagrid/l/7315-how-do-i-update-data-in-a-row)
2. And when the data for the row is populated in the FillInData we might
have a specific key for disabling the button:

on FillInData pDataArray
set the text of field "Label1" of me to pDataArray["label 1"]
set the text of field "Label2" of me to pDataArray["label 2"]
set the text of field "Label3" of me to pDataArray["label 3"]
set the hilited of btn "Checkbox1" of me to (pDataArray["check box state"]
is "true")
set the enabled of btn "Action1" of me to (pDataArray["button enabled"] is
"true")
end FillInData


Hope these few examples might help you a bit to better understanding
datagrids.

On Sun, Aug 5, 2018 at 5:12 AM, J. Landman Gay via use-livecode <
[hidden email]> wrote:

> I was thinking the same thing. I think the critical distinction is that
> datagrids are primarily display mechanisms, not really intended to be read
> directly. It's much easier to parse the original input data than to try to
> traverse the grid itself, which uses some tricks to appear as a continuous
> single control.
>
> --
> Jacqueline Landman Gay | [hidden email]
> HyperActive Software | http://www.hyperactivesw.com
>
> On August 4, 2018 6:54:21 PM James At The Hale via use-livecode <
> [hidden email]> wrote:
>
> I am a little lost here as to why this is a DG question as such.
>> Certainly being able to dynamically fill data within a row is a great UI
>> feature when the user is directly interacting with a row.
>> But it seems you wish to completely fill particular values in all the
>> rows from outside the DG.
>> In this case, why not operate directly on the DGdata, loop through the
>> array, fill in all the required values and then send the whole array back
>> to the DG?
>>
>> _______________________________________________
>> use-livecode mailing list
>> [hidden email]
>> Please visit this url to subscribe, unsubscribe and manage your
>> subscription preferences:
>> http://lists.runrev.com/mailman/listinfo/use-livecode
>>
>
>
>
>
> _______________________________________________
> use-livecode mailing list
> [hidden email]
> Please visit this url to subscribe, unsubscribe and manage your
> subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode
>



--
Zryip TheSlug
http://www.aslugontheroad.com
_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|

RE: datagrid scrolling question

Skip Kimpel via use-livecode
In reply to this post by Skip Kimpel via use-livecode
Thanks very much for the reply.
Good question .. made me think about why that won't work very well for me (but it would, of course, work).

The button on each row not only queries the associated wi-fi module, but the "mouseUp" handler in the Behavior Script acquires a response back from each module.  That message gets put into one of the fields in the row... so even if I didn't try to make a "mouseUp" call to within the row, I'd still want to populate each of the row's fields with the returning result... which would, of course, entail using the pseudo-group names again... *if* I wanted to display the returning information for each row "in real time"... which I do.

There are two simple solutions, one of which I have done.  Expand the grid to show all 8 rows and the scrolling issue disappears.  Or ... as you suggest, "acquire" each row's data "outside" of the grid and then just display the complete set of data at once.  Currently I do the former.  Works very well on my big desktop monitor but not very "practical" to port to my iPad or Android... or any small display device.

Another caveat is that each call to a wi-fi module take about 1 second to complete.  This is a function of the module and what I am asking it to do... NOT an issue with "tsnet" (which is great!).  So, taking the latter (your) approach, I'd lose the "real time" aspect and have to wait (#-of-modules * 1 second) before seeing any results.  Currently that would be 8 seconds... not a *long* wait but annoying (in this age of microsecond responses).  Expanding the project to more modules, obviously, increase the wait time... and I like the real-time display.

However, this is as much a learning exercise as anything else... so I still would greatly appreciate if you or anyone could suggest an alternative methodology for issuing any sort of message to a datagrid, if there is one.  Perhaps my method *is* the only one.  THAT would be valuable information to have, as well.

Douglas Ruisaard
Trilogy Software
(250) 573-3935

From: Brian Milby [mailto:[hidden email]]
Subject: Re: datagrid scrolling question

> My question is why use the button? Loop through the data in the grid and make the tsnet call manually for each line.
> If the button is calling a script outside of the DG, then you can use the same call.
> Then you don’t have to do any of those things to figure out the name of the row group.


_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|

RE: datagrid scrolling question

Skip Kimpel via use-livecode
You can get/put data from/into the grid one row at a time without needing to figure out the group name, so you could have it update in real time in your external button. You should be able to use the same behavior script (possibly with a slight modification) everywhere.

I’m not at a computer right now so I will work out an example later if someone else doesn’t beat me to it.

Thanks,
Brian
On Aug 5, 2018, 10:02 AM -0500, Douglas Ruisaard <[hidden email]>, wrote:

> Thanks very much for the reply.
> Good question .. made me think about why that won't work very well for me (but it would, of course, work).
>
> The button on each row not only queries the associated wi-fi module, but the "mouseUp" handler in the Behavior Script acquires a response back from each module. That message gets put into one of the fields in the row... so even if I didn't try to make a "mouseUp" call to within the row, I'd still want to populate each of the row's fields with the returning result... which would, of course, entail using the pseudo-group names again... *if* I wanted to display the returning information for each row "in real time"... which I do.
>
> There are two simple solutions, one of which I have done. Expand the grid to show all 8 rows and the scrolling issue disappears. Or ... as you suggest, "acquire" each row's data "outside" of the grid and then just display the complete set of data at once. Currently I do the former. Works very well on my big desktop monitor but not very "practical" to port to my iPad or Android... or any small display device.
>
> Another caveat is that each call to a wi-fi module take about 1 second to complete. This is a function of the module and what I am asking it to do... NOT an issue with "tsnet" (which is great!). So, taking the latter (your) approach, I'd lose the "real time" aspect and have to wait (#-of-modules * 1 second) before seeing any results. Currently that would be 8 seconds... not a *long* wait but annoying (in this age of microsecond responses). Expanding the project to more modules, obviously, increase the wait time... and I like the real-time display.
>
> However, this is as much a learning exercise as anything else... so I still would greatly appreciate if you or anyone could suggest an alternative methodology for issuing any sort of message to a datagrid, if there is one. Perhaps my method *is* the only one. THAT would be valuable information to have, as well.
>
> Douglas Ruisaard
> Trilogy Software
> (250) 573-3935
>
> From: Brian Milby [mailto:[hidden email]]
> Subject: Re: datagrid scrolling question
>
> > My question is why use the button? Loop through the data in the grid and make the tsnet call manually for each line.
> > If the button is calling a script outside of the DG, then you can use the same call.
> > Then you don’t have to do any of those things to figure out the name of the row group.
>
_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|

Re: datagrid scrolling question

Skip Kimpel via use-livecode
A possible approach for updating only one row is described here:

Now, for some purpose, such as interacting with the row controls, it could
be interesting to have additional keys inside the data. Not I'm thinking a
click in a button is required in your case. But you might have the need to
hide or to disable a button of a specific row on the fly by clicking a
button outside of the datagrid.

In this case
1. we are changing the data for the row by using the
 set the dgDataOfIndex property (see the datagrid documentation
http://lessons.livecode.com/m/datagrid/l/7315-how-do-i-update-data-in-a-row)
2. And when the data for the row is populated in the FillInData we might
have a specific key for disabling the button:

on FillInData pDataArray
set the text of field "Label1" of me to pDataArray["label 1"]
set the text of field "Label2" of me to pDataArray["label 2"]
set the text of field "Label3" of me to pDataArray["label 3"]
set the hilited of btn "Checkbox1" of me to (pDataArray["check box state"]
is "true")
set the enabled of btn "Action1" of me to (pDataArray["button enabled"] is
"true")
end FillInData

You can add a special "update" row key for example in the dgData and if it
is true, execute the code of the mouseUp button

on FillInData pDataArray
set the text of field "Label1" of me to pDataArray["label 1"]
set the text of field "Label2" of me to pDataArray["label 2"]
set the text of field "Label3" of me to pDataArray["label 3"]
set the hilited of btn "Checkbox1" of me to (pDataArray["check box state"]
is "true")
if (pDataArray["update"] is "true") then
 doMyTSNetQuery
end if
end FillInData

on mouseUp
   doMyTSNetQuery
end mouseUp

command doMyTSNetQuery
  doSomething
end doMyTSNetQuery

You are not sharing the code on how your are updating the result field. If
you are trying to put the result value directly in the field of each row by
considering the datagrid as a simple group of controls you are in the wrong
direction. Datagrid is a way to display data, so use the data to serve your
needs and you will be able to tame the beast. :)

For doing that use the FillInData handler. This will just send the message
to the datagrid to execute a doMyTSNetQuery message to the row.
And for changing the content of the result field of the second row for
example, use something like

SetDataOfLine 2, "update", true

and once finished, pass the value to false to stop the update.

Let me know if you could have the need of the following example:
A datagrid  with 8 rows containing a button, a result field. Plus a button
outside of the datagrid to query an update of one of the result field by
executing the code of one of the button. Do you have different scripts for
each button?


On Sun, Aug 5, 2018 at 5:21 PM, Brian Milby via use-livecode <
[hidden email]> wrote:

> You can get/put data from/into the grid one row at a time without needing
> to figure out the group name, so you could have it update in real time in
> your external button. You should be able to use the same behavior script
> (possibly with a slight modification) everywhere.
>
> I’m not at a computer right now so I will work out an example later if
> someone else doesn’t beat me to it.
>
> Thanks,
> Brian
> On Aug 5, 2018, 10:02 AM -0500, Douglas Ruisaard <[hidden email]>, wrote:
> > Thanks very much for the reply.
> > Good question .. made me think about why that won't work very well for
> me (but it would, of course, work).
> >
> > The button on each row not only queries the associated wi-fi module, but
> the "mouseUp" handler in the Behavior Script acquires a response back from
> each module. That message gets put into one of the fields in the row... so
> even if I didn't try to make a "mouseUp" call to within the row, I'd still
> want to populate each of the row's fields with the returning result...
> which would, of course, entail using the pseudo-group names again... *if* I
> wanted to display the returning information for each row "in real time"...
> which I do.
> >
> > There are two simple solutions, one of which I have done. Expand the
> grid to show all 8 rows and the scrolling issue disappears. Or ... as you
> suggest, "acquire" each row's data "outside" of the grid and then just
> display the complete set of data at once. Currently I do the former. Works
> very well on my big desktop monitor but not very "practical" to port to my
> iPad or Android... or any small display device.
> >
> > Another caveat is that each call to a wi-fi module take about 1 second
> to complete. This is a function of the module and what I am asking it to
> do... NOT an issue with "tsnet" (which is great!). So, taking the latter
> (your) approach, I'd lose the "real time" aspect and have to wait
> (#-of-modules * 1 second) before seeing any results. Currently that would
> be 8 seconds... not a *long* wait but annoying (in this age of microsecond
> responses). Expanding the project to more modules, obviously, increase the
> wait time... and I like the real-time display.
> >
> > However, this is as much a learning exercise as anything else... so I
> still would greatly appreciate if you or anyone could suggest an
> alternative methodology for issuing any sort of message to a datagrid, if
> there is one. Perhaps my method *is* the only one. THAT would be valuable
> information to have, as well.
> >
> > Douglas Ruisaard
> > Trilogy Software
> > (250) 573-3935
> >
> > From: Brian Milby [mailto:[hidden email]]
> > Subject: Re: datagrid scrolling question
> >
> > > My question is why use the button? Loop through the data in the grid
> and make the tsnet call manually for each line.
> > > If the button is calling a script outside of the DG, then you can use
> the same call.
> > > Then you don’t have to do any of those things to figure out the name
> of the row group.
> >
> _______________________________________________
> use-livecode mailing list
> [hidden email]
> Please visit this url to subscribe, unsubscribe and manage your
> subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode
>



--
Zryip TheSlug
http://www.aslugontheroad.com
_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|

Re: datagrid scrolling question

Skip Kimpel via use-livecode
In reply to this post by Skip Kimpel via use-livecode
Many thanks to one and all for the interesting responses ... particularly to Zryip for the extensive reply!

I may be coming at LC from a somewhat unusual direction.  The vast majority of my programming background was in very large, distributed servers running dedicated medical applications and system and instrumentation interfaces.  My specialty is interfacing various disparate systems with each other and the amount of "user-interactive" processing I have to do in that environment is extremely minimal.

Initially, I very successfully employed LC to develop background (i.e. NO user interaction whatsoever) tasks and used its marvelous cross-platform abilities to the fullest.  So, in essence, user-interaction is fairly "foreign" to me.

You all point out that datagrids *are*, fundamentally, a user-interactive device.... where I am looking for a way to use them as a processing tool, in and of themselves.  I *do* employ the user-interaction as well... as I initially mentioned, using the controls on each row (interactively) works very well.  But, due to my nature, I want to be able to optionally "automate" any user-level function and remove the "human" component for consistency and reliability.  Yes, I can process all of the wi-fi modules first and then populate the grid; but, if I may be flippant, it's FUN to watch as each row triggers, fetches and populates each row, one at a time.  Since I made the task capable of being interactive, this is similar as to why someone would use any animation to make their display interesting to a user.  Animation often does not contribute to actual functionality but it is FUN to watch.

Many times in this group, I read how users and contributors reference aspects of LC "under-the-hood".  I found it interesting that most of the responses primarily referenced WHAT *I* was doing, rather than WHAT the DG was doing... which is what I tried to emphasize... and I apologize if that intention wasn't clear.  I understand and am sincerely grateful for the goal-orientation of the responses.  However, topically (not necessarily typically), this group is no stranger to investigating and constructively criticizing how LC performs a function.  I'm OK with my wrapping pseudo-group name method ... I was simply wondering if anyone had an alternative to using the "send mouseUp" approach of calling rows outside of the DG, itself.

My challenge now is to find a way to "calculate" the number of "visible" rows displayed (particularly if I want to make the visible portion of the datagrid dynamically sizable), so I can formulate the "break" point for the group name wrapping.  I, again, would appreciate any help for that function.

I genuinely appreciate the assistance and look forward to future involvement with this group.  I also look forward to the day I can contribute solutions to some of the very challenging issues discussed... many of them still leave me in the dust.

Douglas Ruisaard
Trilogy Software
(250) 573-3935




_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|

RE: datagrid scrolling question

Skip Kimpel via use-livecode
In reply to this post by Skip Kimpel via use-livecode
OK.. the light bulb FINALLY went on .. I'm slow but, like the tortoise, I eventually "get there" (usually).  For some reason Brian's reply made me re-think how I could fetch the WiFi info query from *each* row, submit it to tsnet and then update each row in realtime.  I know, I know... that's what you've ALL been saying but I was interpreting that as processing ALL of the WiFi modules first *AND THEN* updating the WHOLE grid.  THAT would, of course, work but doing it one row at a time just wasn't penetrating the old noggin.

Works perfectly.  Thanks so much for your patience!  I reiterate, as has been done so many times to this group, how remarkably responsive and helpful this community is!

Douglas Ruisaard
Trilogy Software
(250) 573-3935

From: Brian Milby [mailto:[hidden email]]
Sent: Sunday, August 05, 2018 8:22 AM
To: [hidden email]; Douglas Ruisaard
Subject: RE: datagrid scrolling question

You can get/put data from/into the grid one row at a time without needing to figure out the group name, so you could have it update in real time in your external button. You should be able to use the same behavior script (possibly with a slight modification) everywhere.

I’m not at a computer right now so I will work out an example later if someone else doesn’t beat me to it.

Thanks,
Brian


_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode