FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour Question about closing dialogs
Posts: 233
Joined: Sat Dec 30, 2006 06:10 AM
Question about closing dialogs
Posted: 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'.


   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)
Posts: 9020
Joined: Thu Oct 06, 2005 08:17 PM
Re: Question about closing dialogs
Posted: Thu Apr 19, 2007 10:30 AM
Try

IF oDlg:nResult = IDCANCEL
    nChoice = 0
ENDIF


right after ACTIVATE DIALOG command.

EMG
Posts: 9020
Joined: Thu Oct 06, 2005 08:17 PM
Re: Question about closing dialogs
Posted: Thu Apr 19, 2007 10:31 AM
And

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


EMG
Posts: 233
Joined: Sat Dec 30, 2006 06:10 AM
Question about closing dialogs
Posted: 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)

Continue the discussion