Page 1 of 1
Difference between mouse and keyboard
Posted: Thu Nov 12, 2009 8:08 am
by MarcoBoschi
Hi,
please compile this little sample program.
Code: Select all | Expand
#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
Re: Difference between mouse and keyboard
Posted: Fri Nov 13, 2009 10:02 am
by Antonio Linares
Marco,
If you press "Alt" then the dotted line will appear.
Somehow, Windows seems not to show it if only using the mouse.
Re: Difference between mouse and keyboard
Posted: Sat Nov 14, 2009 7:17 am
by MarcoBoschi
Antonio,
the solution is to simulate an "Alt" press?
Thanks
Re: Difference between mouse and keyboard
Posted: Sat Nov 14, 2009 9:34 am
by Antonio Linares
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: Select all | Expand
#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: Select all | Expand
#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
Re: Difference between mouse and keyboard
Posted: Sat Nov 14, 2009 12:16 pm
by Rossine
Hi,
See if this works to you :
Code: Select all | Expand
#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
Re: Difference between mouse and keyboard
Posted: Sat Nov 14, 2009 12:21 pm
by Antonio Linares
Rossine,
Very good!

many thanks!
Re: Difference between mouse and keyboard
Posted: Mon Nov 16, 2009 2:19 am
by hua
When compiled, I got an error message Unresolved external '_hb_parvnl'. What lib am I missing?
Re: Difference between mouse and keyboard
Posted: Mon Nov 16, 2009 10:07 am
by Antonio Linares
Hua,
Please change hb_parvnl() with hb_parnl() calls
Re: Difference between mouse and keyboard
Posted: Tue Nov 17, 2009 1:49 am
by hua
Antonio Linares wrote:Please change hb_parvnl() with hb_parnl() calls
It worked. Thanks.
Re: Difference between mouse and keyboard
Posted: Mon Nov 23, 2009 4:49 pm
by MarcoBoschi
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