I have a main Window with the following code
- Code: Select all Expand view
nScrHeight:=GetSysMetrics(1) // Screen Height
nScrWidth :=GetSysMetrics(0) // Screen Width
DEFINE WINDOW oWnd FROM 1, 1 TO nScrHeight, nScrWidth MDI ;
TITLE "Accounting Software" ;
MENU BuildMenu() ;
COLOR "B/W"
ACTIVATE WINDOW oWnd MAXIMIZED ;
ON INIT Select_Co();
VALID MsgYesNo( "Do you want to quit this application ?" )
I am calling a function Select_Co() to display a Login Dialog which asks the user for a valid username and password. The dialog also contains a Login Button and Cancel Button.
Suppose the user press the Cancel button, then I need to end the application without executing the Valid statement in the Man Window.
My Intention is that if the user press cancel button from the Login Dialog, then End the application at that point itself without executing the VALID MsgYesNo( "Do you want to quit this application ?" )
I am asking this question just to know whether we have some commands to force the End.
The other possible work around is to use a variable to hold a logical value to identify whether the user pressed cancel button without a proper Login. And use that variable to decide whether to execute the Valid of oWnd.
For eg:
- Code: Select all Expand view
ACTIVATE WINDOW oWnd MAXIMIZED;
ON INIT Select_Co();
VALID if(mValidLogin,MsgYesNo( "Do you want to quit this application ?" ),.T.)
I just wanted to know whether other alternatives are availabe or not and that I am doing it in the right way or not.
Regards
Anser
Screen Snapshots
Login Screen
Main Window Valid screen
[img=http://img214.imageshack.us/img214/9291/exitconfirmationsf2.th.jpg]
If you notice my Login screen, the size of the text box for user name and password different. I need the text box of both the usname and password to be same.
Right now I have used to say and get. The fields variable size of both usrname and password are different. Is there any way to overcome this display problem faced by me.
My code for the Login Dialog
- Code: Select all Expand view
mUserName:=spac(30) *--- See the variable size it is 30
mPass:=spac(20) *--- Size is only 20
DEFINE DIALOG oDlg TITLE "Login"
@01,02 say "Login Name"
@02,02 say "Password"
@01,06 get mUserName picture "@!" valid !empty(mUserName)
@02,06 get mPass picture "@!" valid !empty(mPass)
@03,08 BUTTON oBtn PROMPT "Login" ACTION { || mResult:=ValidateLogin(),;
if(mResult,oDlg:End(),if(nNoOfTries > 2,oWnd:End(),) ) }
@03,15 BUTTON "Cancel" ACTION { oDlg:End(),oWnd:End()} CANCEL
ACTIVATE DIALOG oDlg CENTERED
Right now I am not used with using the resources to design the dialogs and windows. I thought I will try by the coding way and later as I advance in my learning skills I' ll start using the resources and the usage of "redefine".
Regards
Anser[/img]