Use SetDialogEsc( lOnOff )?

Use SetDialogEsc( lOnOff )?

Postby JC » Wed Sep 03, 2008 1:29 pm

Dear Antonio and friends!

I tried to use the SetDialogEsc( lOnOff ) function behavior the dialog defined, but not works!
Code: Select all  Expand view
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
User avatar
JC
 
Posts: 445
Joined: Thu Feb 21, 2008 11:58 am
Location: Brazil

Postby Antonio Linares » Wed Sep 03, 2008 2:04 pm

Julio,

Here you have a working example:
Code: Select all  Expand view
#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
User avatar
Antonio Linares
Site Admin
 
Posts: 42080
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Postby Otto » Wed Sep 03, 2008 2:14 pm

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

Unresolved external is reportred with my version.

Regards,
Otto
User avatar
Otto
 
Posts: 6328
Joined: Fri Oct 07, 2005 7:07 pm

Postby Antonio Linares » Wed Sep 03, 2008 2: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
User avatar
Antonio Linares
Site Admin
 
Posts: 42080
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Postby JC » Wed Sep 03, 2008 2:31 pm

Antonio,

This is my source
Code: Select all  Expand view
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
User avatar
JC
 
Posts: 445
Joined: Thu Feb 21, 2008 11:58 am
Location: Brazil

Postby James Bott » Wed Sep 03, 2008 3:26 pm

Julio,

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

Code: Select all  Expand view
ACTIVATE DIALOG oDlg;
         VALID !GETKEYSTATE( VK_ESCAPE )


Regards,
James
User avatar
James Bott
 
Posts: 4840
Joined: Fri Nov 18, 2005 4:52 pm
Location: San Diego, California, USA

Postby JC » Wed Sep 03, 2008 4: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.

Code: Select all  Expand view
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
User avatar
JC
 
Posts: 445
Joined: Thu Feb 21, 2008 11:58 am
Location: Brazil

Postby Antonio Linares » Wed Sep 03, 2008 6: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
User avatar
Antonio Linares
Site Admin
 
Posts: 42080
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Postby James Bott » Wed Sep 03, 2008 7: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
User avatar
James Bott
 
Posts: 4840
Joined: Fri Nov 18, 2005 4:52 pm
Location: San Diego, California, USA

Postby Antonio Linares » Wed Sep 03, 2008 7: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
User avatar
Antonio Linares
Site Admin
 
Posts: 42080
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Postby JC » Wed Sep 03, 2008 7: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
User avatar
JC
 
Posts: 445
Joined: Thu Feb 21, 2008 11:58 am
Location: Brazil

Postby James Bott » Wed Sep 03, 2008 8:38 pm

Antonio,

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

James
User avatar
James Bott
 
Posts: 4840
Joined: Fri Nov 18, 2005 4:52 pm
Location: San Diego, California, USA

Postby Antonio Linares » Wed Sep 03, 2008 8:55 pm

James,

It just ignores the ESC key.
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42080
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Postby James Bott » Thu Sep 04, 2008 1:11 am

Antionio

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

James
User avatar
James Bott
 
Posts: 4840
Joined: Fri Nov 18, 2005 4:52 pm
Location: San Diego, California, USA


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: Google [Bot] and 86 guests