FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour Combobox open and ESC
Posts: 1091
Joined: Thu Nov 17, 2005 11:08 AM
Combobox open and ESC
Posted: 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

Marco Boschi
info@marcoboschi.it
Posts: 601
Joined: Wed Jul 04, 2007 03:51 PM
Combobox open and ESC
Posted: Wed Dec 10, 2008 01:03 PM

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

Espero te sirva.
Saludos desde Argentina, Esteban.

Ojeda Esteban Eduardo.

Buenos Aires - Argentina.

FWH - PellesC - DBF/CDX - ADS - Gloriosos .Bat - MySql - C# .net - FastReport

Skype: jreduojeda
Posts: 4840
Joined: Fri Nov 18, 2005 04:52 PM
Combobox open and ESC
Posted: Wed Dec 10, 2008 03: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

FWH 18.05/xHarbour 1.2.3/BCC7/Windows 10
Posts: 1091
Joined: Thu Nov 17, 2005 11:08 AM
Combobox open and ESC
Posted: Wed Dec 10, 2008 04:26 PM

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

thanks

Marco Boschi
info@marcoboschi.it
Posts: 1467
Joined: Mon Oct 10, 2005 11:26 AM
Combobox open and ESC
Posted: Wed Dec 10, 2008 04:54 PM
I didn't test it, but this might be a solution ?
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. 25.12 - Harbour 3.2.0 (May 2025) - xHarbour Builder (January 2020) - Bcc773

Posts: 1467
Joined: Mon Oct 10, 2005 11:26 AM
Combobox open and ESC
Posted: Wed Dec 10, 2008 04: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. 25.12 - Harbour 3.2.0 (May 2025) - xHarbour Builder (January 2020) - Bcc773

Posts: 3358
Joined: Fri Oct 07, 2005 08:20 PM
Combobox open and ESC
Posted: Wed Dec 10, 2008 05:17 PM
Marco:

Try this way

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
Posts: 4840
Joined: Fri Nov 18, 2005 04:52 PM
Combobox open and ESC
Posted: Wed Dec 10, 2008 05: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

FWH 18.05/xHarbour 1.2.3/BCC7/Windows 10
Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
Combobox open and ESC
Posted: Wed Dec 10, 2008 05:53 PM
Marco,

From FWH 8.08 you can do:

...

SetDialogEsc( .F. )

DEFINE DIALOG oDlg

...
regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 4840
Joined: Fri Nov 18, 2005 04:52 PM
Combobox open and ESC
Posted: Wed Dec 10, 2008 05: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

FWH 18.05/xHarbour 1.2.3/BCC7/Windows 10
Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
Combobox open and ESC
Posted: Wed Dec 10, 2008 06:31 PM
James,

That code would not process any KeyDown received msgs.

We could try with:
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
Posts: 4840
Joined: Fri Nov 18, 2005 04:52 PM
Combobox open and ESC
Posted: Wed Dec 10, 2008 06: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

FWH 18.05/xHarbour 1.2.3/BCC7/Windows 10
Posts: 9020
Joined: Thu Oct 06, 2005 08:17 PM
Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
Combobox open and ESC
Posted: Wed Dec 10, 2008 08:37 PM

James,

Already implemented for next FWH build.

Thanks! :-)

regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 1091
Joined: Thu Nov 17, 2005 11:08 AM
Combobox open and ESC
Posted: Thu Dec 11, 2008 05:42 PM
I'm shocked :-) about how many beautiful minds :-)

in this forum!!!!

:-)

dear friends thanks to all
Marco Boschi
info@marcoboschi.it

Continue the discussion