KEYBOARD status

Moderator: Enrico Maria Giordano

KEYBOARD status

Postby Maverich » Tue Aug 22, 2006 9: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
User avatar
Maverich
 
Posts: 31
Joined: Sun Oct 09, 2005 8:29 pm
Location: Prato, Italia

Re: KEYBOARD status

Postby Enrico Maria Giordano » Tue Aug 22, 2006 11:36 am

Le due soluzioni che ho proposto non vanno bene?

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

Postby Maverich » 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
User avatar
Maverich
 
Posts: 31
Joined: Sun Oct 09, 2005 8:29 pm
Location: Prato, Italia

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


Return to All products support

Who is online

Users browsing this forum: No registered users and 3 guests