Difference between mouse and keyboard

Difference between mouse and keyboard

Postby MarcoBoschi » Thu Nov 12, 2009 8:08 am

Hi,
please compile this little sample program.

Code: Select all  Expand view
#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.

Image

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

Any suggestions?
Marco
User avatar
MarcoBoschi
 
Posts: 1027
Joined: Thu Nov 17, 2005 11:08 am
Location: Padova - Italy

Re: Difference between mouse and keyboard

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

Re: Difference between mouse and keyboard

Postby MarcoBoschi » Sat Nov 14, 2009 7:17 am

Antonio,
the solution is to simulate an "Alt" press?
Thanks
User avatar
MarcoBoschi
 
Posts: 1027
Joined: Thu Nov 17, 2005 11:08 am
Location: Padova - Italy

Re: Difference between mouse and keyboard

Postby Antonio Linares » Sat Nov 14, 2009 9: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: Select all  Expand view

#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 view

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

Re: Difference between mouse and keyboard

Postby Rossine » Sat Nov 14, 2009 12:16 pm

Hi,

See if this works to you :

Code: Select all  Expand view

#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++
Rossine
 
Posts: 344
Joined: Tue Oct 11, 2005 11:33 am

Re: Difference between mouse and keyboard

Postby Antonio Linares » Sat Nov 14, 2009 12:21 pm

Rossine,

Very good! :-)

many thanks!
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 41439
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: Difference between mouse and keyboard

Postby hua » Mon Nov 16, 2009 2: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
hua
 
Posts: 1052
Joined: Fri Oct 28, 2005 2:27 am

Re: Difference between mouse and keyboard

Postby Antonio Linares » Mon Nov 16, 2009 10:07 am

Hua,

Please change hb_parvnl() with hb_parnl() calls
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 41439
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: Difference between mouse and keyboard

Postby hua » Tue Nov 17, 2009 1: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
hua
 
Posts: 1052
Joined: Fri Oct 28, 2005 2:27 am

Re: Difference between mouse and keyboard

Postby MarcoBoschi » Mon Nov 23, 2009 4: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
User avatar
MarcoBoschi
 
Posts: 1027
Joined: Thu Nov 17, 2005 11:08 am
Location: Padova - Italy


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 47 guests