FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour Focus on combobox
Posts: 9020
Joined: Thu Oct 06, 2005 08:17 PM
Focus on combobox
Posted: Sun Mar 03, 2013 10:13 PM
Please try to run this sample using the manifest file on Vista or newer Windows versions:

Code (fw): Select all Collapse
#include "Fivewin.ch"


FUNCTION MAIN()

    LOCAL oDlg

    LOCAL cItem := ""

    DEFINE DIALOG oDlg

    @ 1, 1 COMBOBOX cItem

    ACTIVATE DIALOG oDlg;
             CENTER

    RETURN NIL


I noticed that if you run the program using double click you cannot see the dotted rectangle on the combobox while you can if the program is started using Enter key. Why? Any solutions? With the current behavior It's difficult for the user to know where is the focus.

EMG
Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
Re: Focus on combobox
Posted: Mon Mar 04, 2013 03:01 AM
Enrico,

I don't know where such different behavior comes from. Maybe the enter key becomes an event for the dialog itself ?

Anyhow, in the meantime, here you have a workaround:
Code (fw): Select all Collapse
#include "Fivewin.ch"


FUNCTION MAIN()

    LOCAL oDlg, oCbx

    LOCAL cItem := ""

    DEFINE DIALOG oDlg

    @ 1, 1 COMBOBOX oCbx VAR cItem

    ACTIVATE DIALOG oDlg;
             CENTER ;
             ON INIT oCbx:PostMsg( WM_KEYDOWN, VK_TAB )

    RETURN NIL
regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 9020
Joined: Thu Oct 06, 2005 08:17 PM
Re: Focus on combobox
Posted: Mon Mar 04, 2013 09:20 AM

Thank you, Antonio! I will try it later but I think that doing so the focus will move on the next control, or am I wrong?

EMG

Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
Re: Focus on combobox
Posted: Mon Mar 04, 2013 10:44 AM

Yes, in the case that the combo is the first control in the dialog

regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 9020
Joined: Thu Oct 06, 2005 08:17 PM
Re: Focus on combobox
Posted: Mon Mar 04, 2013 11:41 AM
So this is not a proper workaround. :-)

A sample:

Code (fw): Select all Collapse
#include "Fivewin.ch"


FUNCTION MAIN()

    LOCAL oDlg

    LOCAL cItem := ""
    LOCAL cVar  := SPACE( 30 )

    DEFINE DIALOG oDlg

    @ 1, 1 COMBOBOX cItem

    @ 3, 1 GET cVar

    ACTIVATE DIALOG oDlg;
             ON INIT oDlg:aControls[ 1 ]:PostMsg( WM_KEYDOWN, VK_TAB );
             CENTER

    RETURN NIL


Any better suggestions? :-)

EMG
Posts: 9020
Joined: Thu Oct 06, 2005 08:17 PM
Re: Focus on combobox
Posted: Mon Mar 04, 2013 11:43 AM

And please, keep in mind that we cannot change each dialog of a big application... :-)

EMG

Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
Re: Focus on combobox
Posted: Mon Mar 04, 2013 12:18 PM
Enrico,

This seems to work fine:

Code (fw): Select all Collapse
    ACTIVATE DIALOG oDlg;
             ON INIT oDlg:PostMsg( WM_KEYDOWN, VK_TAB ) ;
             CENTER


Lets find a way to solve it and then we may look for a generic solution for all dialogs :-)
regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 9020
Joined: Thu Oct 06, 2005 08:17 PM
Re: Focus on combobox
Posted: Mon Mar 04, 2013 12:26 PM

Thank you, Master! :-)

EMG

Continue the discussion