Focus on combobox

Focus on combobox

Postby Enrico Maria Giordano » Sun Mar 03, 2013 10:13 pm

Please try to run this sample using the manifest file on Vista or newer Windows versions:

Code: Select all  Expand view
#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
User avatar
Enrico Maria Giordano
 
Posts: 8713
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia

Re: Focus on combobox

Postby Antonio Linares » Mon Mar 04, 2013 3: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: Select all  Expand view
#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
User avatar
Antonio Linares
Site Admin
 
Posts: 42092
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: Focus on combobox

Postby Enrico Maria Giordano » Mon Mar 04, 2013 9: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
User avatar
Enrico Maria Giordano
 
Posts: 8713
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia

Re: Focus on combobox

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

Re: Focus on combobox

Postby Enrico Maria Giordano » Mon Mar 04, 2013 11:41 am

So this is not a proper workaround. :-(

A sample:

Code: Select all  Expand view
#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
User avatar
Enrico Maria Giordano
 
Posts: 8713
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia

Re: Focus on combobox

Postby Enrico Maria Giordano » Mon Mar 04, 2013 11:43 am

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

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

Re: Focus on combobox

Postby Antonio Linares » Mon Mar 04, 2013 12:18 pm

Enrico,

This seems to work fine:

Code: Select all  Expand view
   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
User avatar
Antonio Linares
Site Admin
 
Posts: 42092
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: Focus on combobox

Postby Enrico Maria Giordano » Mon Mar 04, 2013 12:26 pm

Thank you, Master! :-)

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


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 89 guests