[Gambas-user] Caps Lock - Num Lock state howto

Maximillian Von Kloisterheim maximvonk at ...626...
Thu Apr 3 23:10:23 CEST 2008


Stefano Palmeri wrote:
> Hi.
> 
> Sometime ago, we talked about Caps Lock and Num Lock keys
> state. I think it was a request by MaxVK. 
> I suggested a dirty solution using the Desktop.SendKey function.
> 
> On gambas-it.org, the italian Gambas community site, I found a more clean
> way to get the state of those keys. Thanks to user "fsurfing" I found 
> xset.
> 
> Here is an example (ehi Max, this is more clean :-) )
> 
> PUBLIC SUB Main()
>   
>   DIM sShellOutput AS String
>   DIM iKeyLocks AS Integer
>   
>   SHELL "xset q | grep 'LED mask:'" TO sShellOutput
>   
>   sShellOutput = Replace$(sShellOutput, " ", "")
>   
>   iKeyLocks = Val(Split(sShellOutput, ":")[3])
>   
>   SELECT iKeyLocks
>    
>     CASE 1
>       PRINT "Caps Lock is ON"
>     CASE 2
>       PRINT "Num Lock is ON"
>     CASE 3
>       PRINT "Caps Lock is ON"
>       PRINT "Num Lock is ON"
>   
>   END SELECT         
>       
> END
> 
> Regards,
> 
> Stefano
> 
> 
>      
> 
> -------------------------------------------------------------------------
> Check out the new SourceForge.net Marketplace.
> It's the best place to buy or sell services for
> just about anything Open Source.
> http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace
> _______________________________________________
> Gambas-user mailing list
> Gambas-user at lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/gambas-user
> 
Thanks Stefano, Ill check it out this weekend.

regards

Max




More information about the User mailing list