FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour Simple questions...
Posts: 723
Joined: Tue Sep 04, 2007 08:45 AM
Simple questions...
Posted: Fri Nov 22, 2013 09:28 AM
Guys:

1. How can I find out when an user has closed a dialog or window via the X at the top right of the control ?
2. How do I setup the xBrowse object as to when the user double clicks on a row, it is the same as ENTER being pressed.
I trap the ENTER key as follows:
Code (fw): Select all Collapse
SETKEY(VK_RETURN, {|| Action(), oDlg:End() } )


Thank you.
Posts: 4043
Joined: Wed Dec 19, 2007 06:40 PM
Re: Simple questions...
Posted: Fri Nov 22, 2013 10:59 PM

Gustavo,

Please have a look at Your post

viewtopic.php?f=3t=27704

Best regards
Uwe :lol:

&

Since 1995 ( the first release of FW 1.9 )

i work with FW.

If you have any questions about special functions, maybe i can help.
Posts: 4840
Joined: Fri Nov 18, 2005 04:52 PM
Re: Simple questions...
Posted: Tue Nov 26, 2013 03:08 PM
Hunter,

1. How can I find out when an user has closed a dialog or window via the X at the top right of the control ?


I would suggest just removing the X --it is confusing; does it mean Cancel or OK?

James
FWH 18.05/xHarbour 1.2.3/BCC7/Windows 10
Posts: 187
Joined: Mon Oct 20, 2008 06:33 PM
Re: Simple questions...
Posted: Tue Nov 26, 2013 06:56 PM

James,

How can I remove X freom dialogs and Windows?

Oscar Ribeiro

OASyS Informática

Fwh18.02 + xHarbour 1.2.3 + Bcc72
Posts: 41
Joined: Sat Mar 09, 2013 08:17 AM
Re: Simple questions...
Posted: Tue Nov 26, 2013 07:54 PM
Hi,
Code (fw): Select all Collapse
    DEFINE DIALOG oWnd TITLE OemToAnsi("Fivewin Passwort Brcke - Version : "+cVersion+" vom :"+cVDatum) ICON oIcon;
    STYLE WS_CAPTION


Manni
Manfred Groß
Posts: 4840
Joined: Fri Nov 18, 2005 04:52 PM
Re: Simple questions...
Posted: Wed Nov 27, 2013 12:51 AM

Note that when you remove the close button (X) then the Escape key doesn't work to close the dialog either. To get the Escape function back do this:

oDlg:bKeyDown:= {|nKey| if(nKey==VK_ESCAPE,oDlg:end(),) }

FWH 18.05/xHarbour 1.2.3/BCC7/Windows 10
Posts: 187
Joined: Mon Oct 20, 2008 06:33 PM
Re: Simple questions...
Posted: Wed Nov 27, 2013 09:28 AM

You can also cancel <Alt><F4> ?

Oscar Ribeiro

OASyS Informática

Fwh18.02 + xHarbour 1.2.3 + Bcc72
Posts: 44162
Joined: Thu Oct 06, 2005 05:47 PM
Re: Simple questions...
Posted: Wed Nov 27, 2013 11:09 AM

Oscar,

You use the VALID for that:

ACTIVATE DIALOG oDlg VALID OnValid()

where function OnValid() has to return .T. or .F., or simply don't use a function and write the code on the VALID clause

regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 187
Joined: Mon Oct 20, 2008 06:33 PM
Re: Simple questions...
Posted: Wed Nov 27, 2013 12:23 PM

Thanks

Oscar Ribeiro

OASyS Informática

Fwh18.02 + xHarbour 1.2.3 + Bcc72
Posts: 4840
Joined: Fri Nov 18, 2005 04:52 PM
Re: Simple questions...
Posted: Wed Nov 27, 2013 02:43 PM
Well, I did some tests, and it seems things have changed. With earlier versions of FWH the Esc key did not work when the close button was removed. Now (with ver 13.05) it does work (see test below).

So the simple answer to how to remove the close button is just to add, STYLE WS_CAPTION, to the dialog definition.

James

Code (fw): Select all Collapse
Function Main()
   local oDlg

   DEFINE DIALOG oDlg ;
      STYLE WS_CAPTION

   ACTIVATE DIALOG oDlg CENTERED

return nil
FWH 18.05/xHarbour 1.2.3/BCC7/Windows 10
Posts: 9022
Joined: Thu Oct 06, 2005 08:17 PM
Re: Simple questions...
Posted: Wed Nov 27, 2013 06:45 PM
James,

James Bott wrote:I would suggest just removing the X --it is confusing; does it mean Cancel or OK?


It means Cancel. Please look at how it works on any system dialogs (ie. Desktop properties or any other).

EMG
Posts: 990
Joined: Thu Nov 17, 2005 05:49 PM
Re: Simple questions...
Posted: Sat Nov 30, 2013 01:05 PM
I think I got this code from Marcelo. I can't remember, but it works to get rid of the x on the top right hand corner:
Code (fw): Select all Collapse
   ACTIVATE DIALOG oDlg ON INIT DisableX( oDlg, .T. )…

...

//---------------------------------------------------------------------------------
// FUNCTION DisableX(oWin, lDisable) to Disable X button of Window/Dialog 
//---------------------------------------------------------------------------------
#define MF_BYPOSITION 1024 // 0x0400 
#define MF_DISABLED   2

FUNCTION DisableX(oWin, lDisable)

LOCAL hMenu  := 0
LOCAL nCount := 0

IF lDisable
   hMenu  = GetSystemMenu(oWin:hWnd, .F.)
   nCount = GetMItemCount(hMenu)
   IF oWin:ClassName() = "TDIALOG"
      RemoveMenu(hMenu, 1, nOR( MF_BYPOSITION, MF_DISABLED) )
   ELSE
      RemoveMenu(hMenu, nCount - 1, nOR( MF_BYPOSITION, MF_DISABLED) )
      RemoveMenu(hMenu, nCount - 2, nOR( MF_BYPOSITION, MF_DISABLED) )
   ENDIF     
   DrawMenuBar( oWin:hWnd )
ELSE
   GetSystemMenu( oWin:hWnd, .T. )
   DrawMenuBar( oWin:hWnd )
ENDIF

RETURN nil



Reinaldo.
Posts: 4840
Joined: Fri Nov 18, 2005 04:52 PM
Re: Simple questions...
Posted: Sat Nov 30, 2013 05:35 PM

Hi Rienaldo,

This is all you need to get rid of the X. Just add STYLE WS_CAPTION.

DEFINE DIALOG oDlg ;
STYLE WS_CAPTION

James

FWH 18.05/xHarbour 1.2.3/BCC7/Windows 10
Posts: 1387
Joined: Fri May 23, 2008 01:33 PM
Re: Simple questions...
Posted: Fri Dec 26, 2014 03:58 PM

Hi,

I want to trap ESCAPE key in a dialog. I want to change first page in folderx when my page is bigger than first.

Is it possible with ESCAPE key.

Thanks.

Regards,



Hakan ONEMLI



Harbour & MSVC 2022 & FWH 23.06
Posts: 44162
Joined: Thu Oct 06, 2005 05:47 PM
Re: Simple questions...
Posted: Fri Dec 26, 2014 04:29 PM

Hakan,

The VALID clause of the dialog will let you control if the user can close a dialog pressing Escape

regards, saludos

Antonio Linares
www.fivetechsoft.com