Page 1 of 1

When may controls on cards be accessed?

Posted: Wed Apr 23, 2014 9:35 am
by Simon Knight
I have a stack with multiple cards. On one of the cards I am attempting to use a datagrid to store a user preference. When the stack first opens I want to run a handler that is part of the stack script but reads data from the datagrid. The handler is here :

Code: Select all

On UpdateDbSettings pDb
   -- reads the rows from the datagrid and coppies the selected (true) row into a storage array
   put empty into sLogins
   put empty into tSettingsA
   if pDb is empty then
      answer error "ERROR call made with parameter missing in : UpdateDbSettings"
      exit UpdateDbSettings
   end if
   
   put "DbLogin" & pDb into dgName
   put the dgData of group dgName of card "DbSettings" into tSettingsA
   # Loop through the data seeking the record marked true
   repeat for each key tkey in tSettingsA
      If tSettingsA[tkey]["selected"] is true then
         put tSettingsA[tkey] into sLogins[pDb]
      end if
   end repeat
end UpdateDbSettings
The code fails when called from OpenStack with an unable to find card error which suggests that I am calling the routine before the card has been loaded. Is there a simple way of ensuring the card and datagrid are accessible when the stack is first openned?

Re: When may controls on cards be accessed?

Posted: Wed Apr 23, 2014 11:30 am
by [-hh]
..........

Re: When may controls on cards be accessed?

Posted: Wed Apr 23, 2014 3:32 pm
by Simon Knight
Thanks I will try using the first card of the stack.

Simon K

Re: When may controls on cards be accessed?

Posted: Sat Mar 14, 2015 5:34 am
by oswaldwark
that is part of the stack script but reads data from the datagrid. ????