Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Numlock

Status
Not open for further replies.

fdservices

IS-IT--Management
Mar 10, 2005
52
FR
Having some problems with the state of the numlock key with my tcltk programmes. Problem is I am running Linux (numlock enabled) and windows in Virtualbox (numlock enabled) but when I open my tcltk programme I find that the numlock is disabled.

How can I tell the state of the numlock key and then toggle it if necessary, from within my code?

Thanks

Andrew
 
In Windows, at least, you need to do it in Assembler:
check here

_________________
Bob Rashkin
 
Well, there is a way of doing through KDE but with other desktops it looks like you need to use 3rd party software (numlockx). see here

_________________
Bob Rashkin
 
Counter intuitively it seems that if I add:

catch {exec numlockx off}

then it solves the problem, but then I have to turn it back on when I leave the programme. Weird.

Here is my solution:
wm protocol . WM_DELETE_WINDOW {catch {exec numlockx on}
exit}
# set numlock off so that we can use it
bind . <Enter> {catch {exec numlockx off}}
bind . <Leave> {catch {exec numlockx on}}
bind . <FocusIn> {catch {exec numlockx off}}
bind . <FocusOut> {catch {exec numlockx on}}
catch {exec numlockx off}

Thanks for the help

Andrew
 
Status
Not open for further replies.

Similar threads

Part and Inventory Search

Sponsor

Back
Top