problem close stack with standalone application

Got a LiveCode personal license? Are you a beginner, hobbyist or educator that's new to LiveCode? This forum is the place to go for help getting started. Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller

Post Reply
QuangNgo
Posts: 60
Joined: Thu Mar 31, 2011 8:31 am

problem close stack with standalone application

Post by QuangNgo » Sat May 07, 2011 12:05 pm

hi guys,

I have an application and I built it as standalone file It work fine except one thing.
In my case is :
- Login card is belong to ITSInventory stack
- Menu card is belong to Menustack (this stack is a substack of ITSInventory)
When I built and run this application ,the first GUI is login page after Login page is Menu page (if you login successfully)
but when I am at Menu page and try to click on navigation keyboard (Up,Down,Left,Right) . Login page suddenly appear and my application is crashed !
So what happen for this reason and What should I do to fix it . Here is code:
* Login page
if myresult >=1 then
close stack "ITSInventory" (but It's actually not close )
go to card "Menu" of stack "MenuStack"
end if

Hope you guys have any solution for me ,Thank you so much

Quang

Dixie
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 1336
Joined: Sun Jul 12, 2009 10:53 am

Re: problem close stack with standalone application

Post by Dixie » Sat May 07, 2011 12:35 pm

Quang...

Try doing it this way around... go to your substack before closing your main stack.

Code: Select all

on mouseUp
   lock screen
   go card 1 of stack "sub"
   close stack "main"
end mouseUp
I have made a stack... It contains two stacks, 'Main' and 'Sub'. From a button on the main Stack, stack 'Main' the above script goes to the substack and then, closes the main stack 'Main'. Compile the example stack, that is attached, into a standalone and you will see what I mean.

Be well,

Dixie
Attachments
Main.livecode.zip
(1.49 KiB) Downloaded 261 times

QuangNgo
Posts: 60
Joined: Thu Mar 31, 2011 8:31 am

Re: problem close stack with standalone application

Post by QuangNgo » Sun May 08, 2011 7:05 am

hi Dixie

thanks for your help but It's still have a problem the Main stack still appear when I click on navigated keyboard

I think lock screen doesn't work well . Do you have any other ideas ?

Thanks again

Quang

wsamples
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 264
Joined: Mon May 18, 2009 4:12 am

Re: problem close stack with standalone application

Post by wsamples » Sun May 08, 2011 7:47 am

Might it help to set the navigationArrows to false?

wsamples
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 264
Joined: Mon May 18, 2009 4:12 am

Re: problem close stack with standalone application

Post by wsamples » Sun May 08, 2011 7:57 am

I wonder what it is about your login script that crashes the app when it's revisited.

QuangNgo
Posts: 60
Joined: Thu Mar 31, 2011 8:31 am

Re: problem close stack with standalone application

Post by QuangNgo » Sun May 08, 2011 8:28 am

hi wsamples

here Is my code:
global gConnectionID
local dem=0
global gUserName
global gPass
on mouseUp
#close stack "ITSInventory"
#go to card "Menu" of stack "MenuStack"
openConnection
put field "FUserName" into gUserName
put field "hidden" into gPass
put "Select count(*) from usersystem where " & "username=" &" '" &gUserName & "' " & "and pass="& " '" & gPass & "' " into tSQl
put revDataFromQuery(tab,cr,gConnectionID,tSQl) into datatemp
if datatemp >=1 then
put "" into field "FUserName"
put "" into field "FPass"
lock screen (as above instruction)
go to card "Menu" of stack "MenuStack"
close stack "ITSInventory"
else
answer error "This password and username is not correct ,please try another !"
add 1 to dem
if dem =3 then
answer error "This password and username is not correct ,Sorry to close this application !"
quit
end if
closeConnection
end if
end mouseUp

Quang

wsamples
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 264
Joined: Mon May 18, 2009 4:12 am

Re: problem close stack with standalone application

Post by wsamples » Sun May 08, 2011 8:57 am

Quang, did you set the navigationArrows property of your stack to false? That should prevent you from returning to the closed stack by pressing the arrow keys. Check the dictionary.

Using the arrow keys navigate to a previous card on a now closed stack does not cause a crash all by itself, so it seems logical to suspect the login routine is causing the problem. Even if setting the navigationArrows property fixes the problem of returning to the card, it may be wise to do fix the crash in case the user manages to return some other way. Perhaps you could start by setting a property that indicates a user's login status and use it to allow an already logged in user to bypass the script.

Good luck!

QuangNgo
Posts: 60
Joined: Thu Mar 31, 2011 8:31 am

Re: problem close stack with standalone application

Post by QuangNgo » Sun May 08, 2011 9:08 am

wsamples, Thank you so much for that suggestion . I'm try to follow it and hope It work well :D
Thanks,
Quang

joy
Posts: 1
Joined: Wed Jun 29, 2011 5:20 am

Re: problem close stack with standalone application

Post by joy » Wed Jun 29, 2011 5:26 am

I will also follow it. Thank you.. :)

Post Reply