I'll try to enumerate the process. I have an openStack handler in the card 
script of the mainstack. In this handler I initialize the app. First I insert 
my validations, utilities and front scripts into the message hierarchy. Then I 
attempt to register sqlyoga. If that succeeds, I go to a card called database 
setup. 

This also has an openCard handler which attempts to connect to the registered 
database. If it is successful, I want to return true to the openCard handler on 
the first card, otherwise I want to return false. The reason is that the next 
step involves a login stack which queries the database for users and allows the 
user to login. I also query for settings. I cannot proceed until I know I have 
a good database connection. 

I know it sounds convoluted, but I have some portable cards and stacks which 
function simply by including them in the mainstack, and then going to the card 
or stack. All of these cards/stacks are triggered by openCard/openStack 
handlers. I don't want the calling stack to actually call a handler on the 
target stacks. I want developers to simply go to those cards or stacks, which 
will populate properties of the mainstack with data that will be used later. 

For example, the login stack will set properties in the mainstack called 
loginid, username and fullname which are used later by the settings card and 
every record added or updated will get the fullname in the updateby column, 
which every table I have has. 

Now if I cannot connect to the database, then I haven't retrieved the settings 
and I haven't logged in, so I need to set some properties of the mainstack in 
the openCard handler of the mainstack so that when I do connect I can check 
those and force a login and settings update. 

As I mentioned in a prior email, it's no big deal because I just work around it 
by setting properties instead of returning a value. It's just a gotcha to 
return a value in a built-in message handler if those handlers always set the 
result to empty. 

Bob S


> On Oct 26, 2016, at 15:17 , Monte Goulding <mo...@appisle.net> wrote:
> 
> 
>> On 27 Oct. 2016, at 9:07 am, Bob Sneidar <bobsnei...@iotecdigital.com> wrote:
>> 
>> I return a value at the end of an openCard handler
> 
> What are you returning it to? openCard is sent by the engineā€¦ or are you 
> calling it yourself? 
> _______________________________________________
> use-livecode mailing list
> use-livecode@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@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode

Reply via email to