When may controls on cards be accessed?
Posted: Wed Apr 23, 2014 9:35 am
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 :
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?
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