FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour Use SetDialogEsc( lOnOff )?
Posts: 445
Joined: Thu Feb 21, 2008 11:58 AM
Use SetDialogEsc( lOnOff )?
Posted: Wed Sep 03, 2008 01:29 PM
Dear Antonio and friends!

I tried to use the SetDialogEsc( lOnOff ) function behavior the dialog defined, but not works!
setDialogEsc( .F. )

DEFINE DIALOG ... ACTIVATE oDlg


This is correct?
Peace and lighting!

JĂșlio CĂ©sar M. Ferreira

FWH 8.10 / xHB 1.1.0 / xDevStudio 0.72 / Pelles C 5.0.1 / SQLLIB 1.9
Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
Use SetDialogEsc( lOnOff )?
Posted: Wed Sep 03, 2008 02:04 PM
Julio,

Here you have a working example:
#include "FiveWin.ch" 

function Main() 

   local oDlg, cTest := Space( 10 ) 

   SetDialogEsc( .F. )

   DEFINE DIALOG oDlg TITLE "Test" 
   
   @ 2, 2 GET cTest OF oDlg

   ACTIVATE DIALOG oDlg CENTERED 

return nil
regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 6983
Joined: Fri Oct 07, 2005 07:07 PM
Use SetDialogEsc( lOnOff )?
Posted: Wed Sep 03, 2008 02:14 PM

Hello Antonio,
is SetDialogEsc only from version 8.08 on supported.

Unresolved external is reportred with my version.

Regards,
Otto

Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
Use SetDialogEsc( lOnOff )?
Posted: Wed Sep 03, 2008 02:16 PM

Otto,

Yes, it is a new feature in FWH 8.08. Please review FWH 8.08 whatsnew:

http://forums.fivetechsoft.com/viewtopic.php?t=12342

regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 445
Joined: Thu Feb 21, 2008 11:58 AM
Use SetDialogEsc( lOnOff )?
Posted: Wed Sep 03, 2008 02:31 PM
Antonio,

This is my source
FUNCTION configSistem()

setDialogEsc( .F. )

DEFINE DIALOG oDlg RESOURCE "CAD_SISCFG_ATIVACAO_LOGICA" OF wndMain()

       oDlg:lHelpIcon := .F.
       oDlg:cargo     := .F.
       
       REDEFINE SAY PROMPT aChave[1]    ID 4001 OF oDlg FONT ( getFonte( 13 ) ) COLOR rgb( 61, 73, 52 )
       REDEFINE SAY PROMPT aChave[2]    ID 4002 OF oDlg FONT ( getFonte( 13 ) ) COLOR rgb( 61, 73, 52 )
       REDEFINE SAY PROMPT aChave[3]    ID 4003 OF oDlg FONT ( getFonte( 13 ) ) COLOR rgb( 61, 73, 52 )

       REDEFINE BUTTON oButton ID 4005 OF oDlg ACTION oDlg:end() 

ACTIVATE DIALOG oDlg CENTERED

RETURN( NIL )

But, still not works :-)
When I pressing Escape key, the dialog is ended!
Peace and lighting!

JĂșlio CĂ©sar M. Ferreira

FWH 8.10 / xHB 1.1.0 / xDevStudio 0.72 / Pelles C 5.0.1 / SQLLIB 1.9
Posts: 4840
Joined: Fri Nov 18, 2005 04:52 PM
Use SetDialogEsc( lOnOff )?
Posted: Wed Sep 03, 2008 03:26 PM
Julio,

This doesn't solve the setDialogEsc() problem, but here is an alternate way to prevent the Esc key from working.

ACTIVATE DIALOG oDlg;
         VALID !GETKEYSTATE( VK_ESCAPE )


Regards,
James
FWH 18.05/xHarbour 1.2.3/BCC7/Windows 10
Posts: 445
Joined: Thu Feb 21, 2008 11:58 AM
Use SetDialogEsc( lOnOff )?
Posted: Wed Sep 03, 2008 04:49 PM
James Bott wrote:Julio,

This doesn't solve the setDialogEsc() problem, but here is an alternate way to prevent the Esc key from working.

ACTIVATE DIALOG oDlg;
         VALID !GETKEYSTATE( VK_ESCAPE )


Regards,
James

James, yes!
I tried with this solution... a little different, but executing the same thing!
Thank you!
Peace and lighting!

JĂșlio CĂ©sar M. Ferreira

FWH 8.10 / xHB 1.1.0 / xDevStudio 0.72 / Pelles C 5.0.1 / SQLLIB 1.9
Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
Use SetDialogEsc( lOnOff )?
Posted: Wed Sep 03, 2008 06:38 PM

JĂșlio

We are reviewing the behavior of SetDialogEsc() when there are no controls that process VK_ESCAPE.

We will post a solution for it asap

regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 4840
Joined: Fri Nov 18, 2005 04:52 PM
Use SetDialogEsc( lOnOff )?
Posted: Wed Sep 03, 2008 07:12 PM

Here is another way to disable the Esc key.

Disabling the X (close) Button of a Dialog

In Workshop, double click on the dialog, and under the "Dialog Style" group, uncheck the "system menu" item.

Or, change nStyle by leaving off the WS_SYSMENU:

function main
local oDlg, nStyle :=nOR( DS_MODALFRAME, WS_POPUP, WS_CAPTION )
define dialog oDlg style nStyle
activate dialog oDlg
return nil

If you remove the (X) button then the Escape key doesn't work to close the dialog.

This is really a better solution. When the (X) button is on the dialog it is not obvious what happens when it is used. Is it like pressing OK button, or the Cancel button--the user is never quite sure. So, it is better to just remove it.

James

FWH 18.05/xHarbour 1.2.3/BCC7/Windows 10
Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
Use SetDialogEsc( lOnOff )?
Posted: Wed Sep 03, 2008 07:29 PM

James,

The advantage of using SetDialogEsc( lOnOff ) is that it is a global setting for your application, so you don't have to modify or to code for each dialog.

regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 445
Joined: Thu Feb 21, 2008 11:58 AM
Use SetDialogEsc( lOnOff )?
Posted: Wed Sep 03, 2008 07:39 PM
Antonio Linares wrote:James,

The advantage of using SetDialogEsc( lOnOff ) is that it is a global setting for your application, so you don't have to modify or to code for each dialog.


Very best than!
Peace and lighting!

JĂșlio CĂ©sar M. Ferreira

FWH 8.10 / xHB 1.1.0 / xDevStudio 0.72 / Pelles C 5.0.1 / SQLLIB 1.9
Posts: 4840
Joined: Fri Nov 18, 2005 04:52 PM
Use SetDialogEsc( lOnOff )?
Posted: Wed Sep 03, 2008 08:38 PM

Antonio,

Does SetDialogEsc() also remove the X button, or just disable the Esc key?

James

FWH 18.05/xHarbour 1.2.3/BCC7/Windows 10
Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
Use SetDialogEsc( lOnOff )?
Posted: Wed Sep 03, 2008 08:55 PM

James,

It just ignores the ESC key.

regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 4840
Joined: Fri Nov 18, 2005 04:52 PM
Use SetDialogEsc( lOnOff )?
Posted: Thu Sep 04, 2008 01:11 AM

Antionio

It would be nice if we could turn off the X button for all dialogs. Perhaps a CLASSDATA in TDialog?

James

FWH 18.05/xHarbour 1.2.3/BCC7/Windows 10

Continue the discussion