Datagrid Row Selection

Michael Doub mike at doub.com
Thu Dec 1 18:37:37 CST 2011


I solved both problems mentioned below by moving the mouseup script out of the behaviour script and placed it in the script of the group of the datagrid itself.
The script was altered to get the proper addressing and make it more concise.   All seems to be working fine.   I also removed the mouseDoubleUp example that was provided as part of the default script provided upon data grid creation.  

on Mouseup
   put the dgControl of group "Contacts" into theGrid
   put the dgClickIndex of theGrid into tIndex
   get the dgVScroll of group "Contacts"
   set the pVScroll of this card to it
   set the pRecID of Card "Action" to GetDataofIndex(tIndex,"RecID")
   go to card "Action"
end Mouseup

-= Mike

On 2011-11-30, at 1:02 PM, Michael Doub wrote:

> I am experiencing another interesting behaviour.  As you can see in the code below I am trying to go to the card "Action". 
> The card is displayed but neither the PreOpenCard or OpenCard handers are being invoked.  This is seen in the mac development environment.
> 
> Does any one have an idea as to what would cause this behaviour?
> 
> -= Mike
> 
> 
> On 2011-11-30, at 6:15 AM, Michael Doub wrote:
> 
>> What is the proper way to detect a row selection on a datagrid on IOS when a scroller is being used?
>> 
>> I currently am using the scroller script from the DGH and the following handler in the data grid behaviour script:
>> 
>> on Mouseup pMouseBtnNum
>>  if pMouseBtnNum is 1 then
>>     put the dgClickIndex of me into tIndex
>>     get the dgVScroll of group "Contacts"
>>     set the pVScroll of this card to it
>>     get GetDataofIndex(tIndex,"RecID")
>>     set the pRecID of Card "Action" to it
>>     go to card "Action"
>>  end if
>> end Mouseup
>> 
>> This seems to work reliably on the mac, but in the simulator and on the device I get the proper 
>> scrolling and selection behaviour but with a occasional data grid failure where the grid seems frozen with only a few of the
>> rows redrawn.  This happens when scrolling.
>> 
>> I suspect there is an interaction with the selection logic as when this handler is removed scrolling works as expected.
>> 
>> -= Mike
>> 
>> _______________________________________________
>> 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
> 
> 
> _______________________________________________
> 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