FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index All products support KEYBOARD status
Posts: 31
Joined: Sun Oct 09, 2005 08:29 PM
KEYBOARD status
Posted: Tue Aug 22, 2006 09:34 AM
Ho ritrovato un msg di EMG sulle luci della tastiera disallineate al contenuto della status bar, che quoto:

When KEYBOARD clause is used we can click with the mouse on the Num, Caps and Ins items to toggle their status. But, specifically for Num and Caps, the status change is not reflected by the keyboard light and this brings to an inconsistency between the status itself and what the keyboard lights say.

Possible fixes are:

1) remove the item click at least on Num and Caps (but I would remove it on Ins also).

2) use the appropriate API to correctly change the lights status.

For the point 2, the following sample is from Francesco Saverio Giudice:

Code:
#include "common.ch"

PROCEDURE MAIN()

? "Attiva capslock"
SetCapsLock( TRUE )

Inkey( 0 )

? "Attiva numlock"
SetNumLock( TRUE )

Inkey( 0 )

? "Stato CAPSLOCK : " + IIF( GetCapsLock(), "ON ", "OFF" )
? "Stato NUMLOCK : " + IIF( GetNumLock(), "ON ", "OFF" )

Inkey( 0 )

? "Disattiva capslock"
SetCapsLock( FALSE )

Inkey( 0 )

? "Disattiva numlock"
SetNumLock( FALSE )

Inkey( 0 )

? "Stato CAPSLOCK : " + IIF( GetCapsLock(), "ON ", "OFF" )
? "Stato NUMLOCK : " + IIF( GetNumLock(), "ON ", "OFF" )

Inkey( 0 )

RETURN


#pragma BEGINDUMP

#include <windows.h>

#include "hbapi.h"

#define TOGGLED 0x0001

void SetKeyLock( BYTE vKey, BOOL bState )
{
BOOL bCurrentState;

bCurrentState = ( GetKeyState( vKey ) & TOGGLED );

if( (bState && !bCurrentState) ||
(!bState && bCurrentState) )
{
// Simulate a key press
keybd_event( vKey,
0,
KEYEVENTF_EXTENDEDKEY | 0,
0 );

// Simulate a key release
keybd_event( vKey,
0,
KEYEVENTF_EXTENDEDKEY | KEYEVENTF_KEYUP,
0);
}
}

BOOL GetKeyLock( int vKey )
{
return ( GetKeyState( vKey ) & TOGGLED );
}

HB_FUNC( SETCAPSLOCK )
{
SetKeyLock( VK_CAPITAL, hb_parl( 1 ) );
}

HB_FUNC( SETNUMLOCK )
{
SetKeyLock( VK_NUMLOCK, hb_parl( 1 ) );
}

HB_FUNC( GETCAPSLOCK )
{
hb_retl( GetKeyLock( VK_CAPITAL ) );
}

HB_FUNC( GETNUMLOCK )
{
hb_retl( GetKeyLock( VK_NUMLOCK ) );
}

#pragma ENDDUMP


EMG
_________________
EMAG Software Homepage: http://www.emagsoftware.it/
The EMG's ZX-Spectrum Page: http://www.emagsoftware.it/spectrum
The Best of Spectrum Games: http://www.emagsoftware.it/tbosg
The EMG Music page: http://www.emagsoftware.it/emgmusic


qualcuno nel frattempo ha trovato soluzioni?
uso ancora fw 2.6
Riccardo
Posts: 9020
Joined: Thu Oct 06, 2005 08:17 PM
Re: KEYBOARD status
Posted: Tue Aug 22, 2006 11:36 AM

Le due soluzioni che ho proposto non vanno bene?

EMG

Posts: 31
Joined: Sun Oct 09, 2005 08:29 PM
KEYBOARD status
Posted: Tue Sep 12, 2006 10:00 AM

Enrico,
scusa la mia ignoranza ma pensavo che il tuo msg fosse una semplice riflessione sull'argomento. Allora dovresti guidarmi un pò per capire quali sono le modifiche da fare, se non ti dispiace naturalmente.
ciao

Riccardo
Posts: 9020
Joined: Thu Oct 06, 2005 08:17 PM
KEYBOARD status
Posted: Tue Sep 12, 2006 11:40 AM

Le modifiche vanno apportate alla classe TMsgBar ma ci vorrebbe troppo tempo a spiegarle. Prova a farlo e se hai problemi specifici sono qui.

EMG

Continue the discussion