FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour Difference between mouse and keyboard
Posts: 1091
Joined: Thu Nov 17, 2005 11:08 AM
Difference between mouse and keyboard
Posted: Thu Nov 12, 2009 08:08 AM
Hi,
please compile this little sample program.

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


FUNCTION MAIN()

    LOCAL oDlg

    LOCAL cVar := SPACE(10)

    CGETFILE( "*.*", "Select a file" )

    DEFINE DIALOG oDlg

    @ 1, 1 GET cVar

    @ 2, 1 BUTTON "Button1"
    @ 3, 1 BUTTON "Button2"

    ACTIVATE DIALOG oDlg

    RETURN NIL


First time use keyboard to select file into CGETFILE dialog ( you can use mouse and press keyboard just one time)

When you return to dialog oDlg and you change focus into Button1 everything works fine.



Second time use only mouse (please do not touch keyboard)
When Button1 gets focus it does not appear in the right way


Any suggestions?
Marco
Marco Boschi
info@marcoboschi.it
Posts: 44162
Joined: Thu Oct 06, 2005 05:47 PM
Re: Difference between mouse and keyboard
Posted: Fri Nov 13, 2009 10:02 AM

Marco,

If you press "Alt" then the dotted line will appear.

Somehow, Windows seems not to show it if only using the mouse.

regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 1091
Joined: Thu Nov 17, 2005 11:08 AM
Re: Difference between mouse and keyboard
Posted: Sat Nov 14, 2009 07:17 AM

Antonio,
the solution is to simulate an "Alt" press?
Thanks

Marco Boschi
info@marcoboschi.it
Posts: 44162
Joined: Thu Oct 06, 2005 05:47 PM
Re: Difference between mouse and keyboard
Posted: Sat Nov 14, 2009 09:34 AM
Marco,

The problem is that we can not simulate an "Alt" key :-)

We are trying many different ways, but no success. We just need a simple "Alt" simulation there...
Code (fw): Select all Collapse
#include "Fivewin.ch"

#define WM_SYSCOMMAND   0x0112
#define SC_KEYMENU       61696

FUNCTION MAIN()

    LOCAL oDlg, oBtn
    LOCAL cVar := SPACE(10), oGet

    DEFINE DIALOG oDlg

    @ 1, 1 GET oGet VAR cVar

    @ 2, 1 BUTTON oBtn PROMPT "Button1"
    oBtn:bGotFocus = { || oBtn:PostMsg( WM_SYSCOMMAND, SC_KEYMENU ) }
    
    @ 3, 1 BUTTON "Button2"

    ACTIVATE DIALOG oDlg CENTER

    RETURN NIL

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

FUNCTION MAIN()

    LOCAL oDlg, oBtn
    LOCAL cVar := SPACE(10), oGet

    DEFINE DIALOG oDlg

    @ 1, 1 GET oGet VAR cVar

    @ 2, 1 BUTTON oBtn PROMPT "Button1"
    oBtn:bGotFocus = { || __KeyBoard( Chr( ... ) ) }
    
    @ 3, 1 BUTTON "Button2"

    ACTIVATE DIALOG oDlg CENTER

    RETURN NIL
regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 344
Joined: Tue Oct 11, 2005 11:33 AM
Re: Difference between mouse and keyboard
Posted: Sat Nov 14, 2009 12:16 PM
Hi,

See if this works to you :

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

#define VK_LMENU  164
#define VK_A       65

FUNCTION MAIN()

    LOCAL oDlg

    LOCAL cVar := SPACE(10)

    CGETFILE( "*.*", "Select a file" )

    DEFINE DIALOG oDlg

    @ 1, 1 GET cVar

    @ 2, 1 BUTTON oBtn PROMPT "Button1"
    oBtn:bGotFocus = { || SetStateKey( VK_LMENU, .T. ), ;
                          SetStateKey( VK_A, .T. ), ;
                          SetStateKey( VK_LMENU, .F. ) }
   
    @ 3, 1 BUTTON "Button2"

    ACTIVATE DIALOG oDlg

RETURN NIL

#pragma begindump

#include <windows.h>
#include <hbapi.h>

HB_FUNC( SETSTATEKEY )
{
  if( hb_parl(2) )
      keybd_event( hb_parvnl(1), 0x45, KEYEVENTF_EXTENDEDKEY | 0, 0 );
  else
      keybd_event( hb_parvnl(1), 0x45, KEYEVENTF_EXTENDEDKEY | KEYEVENTF_KEYUP, 0);
}

#pragma enddump
Obrigado, Regards, Saludos



Rossine.



Harbour and Harbour++
Posts: 44162
Joined: Thu Oct 06, 2005 05:47 PM
Re: Difference between mouse and keyboard
Posted: Sat Nov 14, 2009 12:21 PM

Rossine,

Very good! :-)

many thanks!

regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 1096
Joined: Fri Oct 28, 2005 02:27 AM
Re: Difference between mouse and keyboard
Posted: Mon Nov 16, 2009 02:19 AM
When compiled, I got an error message Unresolved external '_hb_parvnl'. What lib am I missing?
FWH 11.08/FWH 19.12

BCC5.82/BCC7.3

xHarbour/Harbour
Posts: 44162
Joined: Thu Oct 06, 2005 05:47 PM
Re: Difference between mouse and keyboard
Posted: Mon Nov 16, 2009 10:07 AM

Hua,

Please change hb_parvnl() with hb_parnl() calls

regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 1096
Joined: Fri Oct 28, 2005 02:27 AM
Re: Difference between mouse and keyboard
Posted: Tue Nov 17, 2009 01:49 AM
Antonio Linares wrote:Please change hb_parvnl() with hb_parnl() calls


It worked. Thanks.
FWH 11.08/FWH 19.12

BCC5.82/BCC7.3

xHarbour/Harbour
Posts: 1091
Joined: Thu Nov 17, 2005 11:08 AM
Re: Difference between mouse and keyboard
Posted: Mon Nov 23, 2009 04:49 PM

Hello,
just now I read your answers.
Thanks a lot.
I've tried it but if I press return key in the field it does not work.
It works only if I press TAB button to exit get field.
Anyway, thanks a lot

marco

Marco Boschi
info@marcoboschi.it

Continue the discussion