Question about closing dialogs

Question about closing dialogs

Postby Ollie » Thu Apr 19, 2007 10:16 am

I want nChoice in the code below to be '0' if the user makes a choice on the radio button and then decides to close the window with the 'X'.
It does it when the user presses Cancel, but not when the window is closed with 'X'.


Code: Select all  Expand view
   DEFINE DIALOG oDlg OF Win_main TITLE "Move Record" SIZE 300, 150
   @ 1, 1 SAY 'Move this record to :'
   @ 3, 5 BUTTON but_move PROMPT "Move" SIZE 30, 10 DEFAULT ;
      ACTION ( oDlg:END() ) // MSGSTOP( "Incorrect username or password", "Error" ) )
   @ 1,  9 RADIO nChoice PROMPT "&Prospective Database", "&Free Database" OF oDlg
   @ 3, 15 BUTTON but_cancel PROMPT "Cancel" SIZE 30, 10 ACTION (nChoice:=0, oDlg:END())
   ACTIVATE DIALOG oDlg CENTER VALID ( .T. )

   MSGINFO(STR(nChoice))
Many thanks
Ollie.

Using:
xHarbour Compiler build 1.2.1 (SimpLex) (Rev. 6406)
Borland C++ 5.5.1
FWH 9.04 (2009 Apr)
Ollie
 
Posts: 233
Joined: Sat Dec 30, 2006 6:10 am

Re: Question about closing dialogs

Postby Enrico Maria Giordano » Thu Apr 19, 2007 10:30 am

Try

Code: Select all  Expand view
IF oDlg:nResult = IDCANCEL
    nChoice = 0
ENDIF


right after ACTIVATE DIALOG command.

EMG
User avatar
Enrico Maria Giordano
 
Posts: 8710
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia

Re: Question about closing dialogs

Postby Enrico Maria Giordano » Thu Apr 19, 2007 10:31 am

And

Code: Select all  Expand view
@ 3, 5 BUTTON but_move PROMPT "Move" SIZE 30, 10 DEFAULT ;
      ACTION ( oDlg:END( IDOK ) )


EMG
User avatar
Enrico Maria Giordano
 
Posts: 8710
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia

Postby Ollie » Thu Apr 19, 2007 12:07 pm

Thanks. Perfect.
Many thanks
Ollie.

Using:
xHarbour Compiler build 1.2.1 (SimpLex) (Rev. 6406)
Borland C++ 5.5.1
FWH 9.04 (2009 Apr)
Ollie
 
Posts: 233
Joined: Sat Dec 30, 2006 6:10 am


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 67 guests