oWnd:End()

oWnd:End()

Postby lailton.webmaster » Fri Jun 12, 2009 11:23 pm

Code: Select all  Expand view

#include "fivewin.ch"

function main
 Public lSair:=.f.
 define window ownd
 define button obtn ........ Action (lSair:=.t.,ownd:end())

 activate window ownd;
 valid lSair

 function buttonCLOSE() // execute this when button close of window was clicked.
   lSair:.t.
   ownd:End()
 return
 


how make to button [X] sysmenu, close direct when receive click.

when use oWnd:bResized return button Minimize / Maximize i want know if have to button Close too.

Someone can help ? thanks
lailton.webmaster
 
Posts: 603
Joined: Sun May 04, 2008 8:44 pm

Re: oWnd:End()

Postby James Bott » Sun Jun 14, 2009 6:11 pm

Why don't you try a different approach. Only run your process if the user presses the "Do Whatever" button, something like this:

Code: Select all  Expand view
function main()
   local lProcess:=.f., oWnd, oBtn
   define window oWnd
   define button obtn prompt "Do Whatever"........ Action (lProcess:=.t.,oWnd:end())

activate window oWnd;
   valid process(lProcess)

return nil

function Process(lProcess)
   if lProcess
      // do whatever
   endif
return .t.
User avatar
James Bott
 
Posts: 4840
Joined: Fri Nov 18, 2005 4:52 pm
Location: San Diego, California, USA

Re: oWnd:End()

Postby Rick Lipkin » Sun Jun 14, 2009 11:08 pm

Like James suggests .. here is a snipit of code to trap the |X| and close and clean up your environment.

Rick

Code: Select all  Expand view


Static lOK,oWnd

//----------
Func Main()

lOk := .f.

DEFINE WINDOW oWnd              ;
       BuildMenu(oRsFr)               ;
...
...


ACTIVATE WINDOW oWnd           ;
      VALID ( IF( !lOK, FreqClose(.T., oRsFr), .F. )) // traps close

RETURN( NIL )

//------------------//
Static FUNCTION BuildMenu( oRsFr)

LOCAL oMenu1

MENU oMenu1

     MENUITEM "&Add ..."                             ;
   
     MENUITEM "&Edit ..."                            ;
   
     MENUITEM "&Delete ..."                          ;
             
     MENUITEM "&View ..."                            ;
             
     MENUITEM "&Quit"                                ;
               ACTION oWnd:END()  // will fire freqclose as well
   ENDMENU

RETURN( oMenu1 )

//------------------------
static FUNCTION FreqClose( lCLEAN, oRsFr )

IF lCLEAN = .T.
   lOK := .T.
   oBROW:cALIAS:=NIL
   oRsFr:CLose()
ENDIF

RETURN(.T.)

 
User avatar
Rick Lipkin
 
Posts: 2665
Joined: Fri Oct 07, 2005 1:50 pm
Location: Columbia, South Carolina USA


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: nageswaragunupudi and 89 guests