LiveCode is the premier environment for creating multi-platform solutions for all major operating systems - Windows, Mac OS X, Linux, the Web, Server environments and Mobile platforms. Brand new to LiveCode? Welcome!
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller
-
Simon Knight
- Posts: 919
- Joined: Wed Nov 04, 2009 11:41 am
Post
by Simon Knight » 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 :
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?
best wishes
Skids
-
[-hh]
- VIP Livecode Opensource Backer

- Posts: 2262
- Joined: Thu Feb 28, 2013 11:52 pm
Post
by [-hh] » Wed Apr 23, 2014 11:30 am
..........
Last edited by
[-hh] on Wed Aug 13, 2014 1:03 pm, edited 1 time in total.
shiftLock happens
-
Simon Knight
- Posts: 919
- Joined: Wed Nov 04, 2009 11:41 am
Post
by Simon Knight » Wed Apr 23, 2014 3:32 pm
Thanks I will try using the first card of the stack.
Simon K
best wishes
Skids
-
oswaldwark
- Posts: 1
- Joined: Sat Mar 14, 2015 5:31 am
Post
by oswaldwark » Sat Mar 14, 2015 5:34 am
that is part of the stack script but reads data from the datagrid. ????
raza