Combobox open and ESC

Combobox open and ESC

Postby MarcoBoschi » Wed Dec 10, 2008 11:35 am

Hi,
when combo is open and I press Escape dialog closes.
I expect that only combo closes
Any ideas
Thanks
marco

#include "Fivewin.ch"

FUNCTION MAIN()

LOCAL oDlg

LOCAL oCombo
LOCAL cVariab := SPACE( 10 )

DEFINE DIALOG oDlg

@ 1, 1 COMBOBOX oCombo VAR cVariab ITEMS { "AAAAAA", "BBBBBB", "CCCCCC", "DDDDDD", "EEEEEE" }

ACTIVATE DIALOG oDlg CENTER

? "Dialog closed"

RETURN NIL
User avatar
MarcoBoschi
 
Posts: 1065
Joined: Thu Nov 17, 2005 11:08 am
Location: Padova - Italy

Postby jrestojeda » Wed Dec 10, 2008 1:03 pm

Hola amigo...
Prueba con un VALID en el ACTIVATE del DIALOG.

Espero te sirva.
Saludos desde Argentina, Esteban.
User avatar
jrestojeda
 
Posts: 601
Joined: Wed Jul 04, 2007 3:51 pm
Location: Buenos Aires - Argentina

Postby James Bott » Wed Dec 10, 2008 3:14 pm

Marco,

I think that this may be a bug in TCombobox as other apps do close the combobox, not the dialog.

You can try adding this to the KeyChar() method:

if nKey == VK_ESCAPE
::close()
return 0
endif

I'm am not sure if you need to call the ::close() or ::closeUp() method so try both.

Let us know what you find.

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

Postby MarcoBoschi » Wed Dec 10, 2008 4:26 pm

James,
no good
I've tried but ....nothing :(

thanks
User avatar
MarcoBoschi
 
Posts: 1065
Joined: Thu Nov 17, 2005 11:08 am
Location: Padova - Italy

Postby driessen » Wed Dec 10, 2008 4:54 pm

I didn't test it, but this might be a solution ?
Code: Select all  Expand view
FUNCTION MAIN()

LOCAL oDlg

LOCAL oCombo
LOCAL cVariab := SPACE( 10 )

LOCAL CbRet := .T.

DEFINE DIALOG oDlg

@ 1, 1 COMBOBOX oCombo VAR cVariab ITEMS { "AAAAAA", "BBBBBB", "CCCCCC", "DDDDDD", "EEEEEE" }

oCombo:bGotFocus  := { || CbRet := .F. }
oCombo:bLostFocus := { || CbRet := .T. }

ACTIVATE DIALOG oDlg CENTER VALID CbRet

? "Dialog closed"

RETURN NIL


Let us know if it works.
Regards,

Michel D.
Genk (Belgium)
_____________________________________________________________________________________________
I use : FiveWin for (x)Harbour v. 24.07 - Harbour 3.2.0 (February 2024) - xHarbour Builder (January 2020) - Bcc773
User avatar
driessen
 
Posts: 1422
Joined: Mon Oct 10, 2005 11:26 am
Location: Genk, Belgium

Postby driessen » Wed Dec 10, 2008 4:57 pm

Meanwhile I did the test myself but I noticed that I couldn't open the combobox anymore.

But if I click on the combobox (unfortunately without opening), pushing the Escape-key doesn't end the dialog box anymore. After having clicked on another field, the dialog box does end again if I push the Escape-key.

So looking for a solution in this direction might be the right one.

Good luck.
Regards,

Michel D.
Genk (Belgium)
_____________________________________________________________________________________________
I use : FiveWin for (x)Harbour v. 24.07 - Harbour 3.2.0 (February 2024) - xHarbour Builder (January 2020) - Bcc773
User avatar
driessen
 
Posts: 1422
Joined: Mon Oct 10, 2005 11:26 am
Location: Genk, Belgium

Postby Armando » Wed Dec 10, 2008 5:17 pm

Marco:

Try this way

Code: Select all  Expand view
ACTIVATE DIALOG oDlg CENTER VALID ! GetASyncKey(VK_ESCAPE)


Regards
SOI, s.a. de c.v.
estbucarm@gmail.com
http://www.soisa.mex.tl/
http://sqlcmd.blogspot.com/
Tel. (722) 174 44 45
Carpe diem quam minimum credula postero
User avatar
Armando
 
Posts: 3209
Joined: Fri Oct 07, 2005 8:20 pm
Location: Toluca, México

Postby James Bott » Wed Dec 10, 2008 5:40 pm

Armando,

The problem is that the first time you press Esc the combobox should close, and then if you press Esc again, the dialog should close. Your VALID clause will prevent the dialog from closing when pressing Esc.

I did some testing and the combobox is getting closed, but then the dialog is also closed. So, I now think the problem is in the TDialog:KeyChar() method.

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

Postby Antonio Linares » Wed Dec 10, 2008 5:53 pm

Marco,

From FWH 8.08 you can do:

...

SetDialogEsc( .F. )

DEFINE DIALOG oDlg

...
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 Dec 10, 2008 5:54 pm

OK, I have found the solution. Add this line to the method definitions in TCombobox.

METHOD KeyDown inline ::close(), 1

Antonio, will you add this to the FW source?

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

Postby Antonio Linares » Wed Dec 10, 2008 6:31 pm

James,

That code would not process any KeyDown received msgs.

We could try with:
Code: Select all  Expand view
METHOD KeyDown( nKey, nFlags ) CLASS TComboBox

   if nKey == VK_ESC
      ::Close()
      return 1
   endif

return Super:KeyDown( nKey, nFlags )
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 Dec 10, 2008 6:56 pm

Antonio,

Of course. I didn't think it through.

I tried your solution and it seems to be working. The incremental search is working as are the up and down arrows, home, end, pg dn, and pg up keys.

You do need to change VK_ESC to VK_ESCAPE.

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

Postby Enrico Maria Giordano » Wed Dec 10, 2008 7:06 pm

Great!

EMG
User avatar
Enrico Maria Giordano
 
Posts: 8710
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia

Postby Antonio Linares » Wed Dec 10, 2008 8:37 pm

James,

Already implemented for next FWH build.

Thanks! :-)
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 MarcoBoschi » Thu Dec 11, 2008 5:42 pm

I'm shocked :shock: about how many beautiful minds :idea:

in this forum!!!!

:wink:

dear friends thanks to all
User avatar
MarcoBoschi
 
Posts: 1065
Joined: Thu Nov 17, 2005 11:08 am
Location: Padova - Italy


Return to FiveWin for Harbour/xHarbour

Who is online

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