Welcome, Guest.
Please login or register.
Adding Keyboard Hotkeys
Forum Login
Login Name: Create a new account
Password:     Forgot password

XBLite Forum    General Boards    XBLite Programming  ›  Adding Keyboard Hotkeys
Users Browsing Forum
No Members and 2 Guests

Adding Keyboard Hotkeys  This thread currently has 2,030 views. Print Print Thread
1 Pages 1 Recommend Thread
Carry
March 5, 2013, 8:33am Report to Moderator Report to Moderator
Baby Member
Posts: 36
I have a simple WinX application and I want to add a number of keyboard hotkeys - like 'Ctrl-Z', 'Shift-R', 'ESC' etc. These hotkeys should work regardless of what control has the current focus.

Currently, I have a function 'EditProc()' handling the keyboard codes and I am registering the callback as follows:
#old_proc = SetWindowLongA(#hMain, $$GWL_WNDPROC, &EditProc())

But after I click a pushbutton, the control focus changes and the callback stops working. How can I fix this?
Logged Offline
Private Message Private message
Carry
March 6, 2013, 5:38am Report to Moderator Report to Moderator
Baby Member
Posts: 36
I just stumbled across the answer to my own question.

In 'initWindow()' I added:
ACCEL accel[]
DIM accel[]
WinXAddAccelerator (@accel[], $$mnuHelpContents, $$VK_ESCAPE, $$FALSE, $$FALSE, $$FALSE)
WinXAddAccelerator (@accel[], $$mnuHelpAbout, $$VK_F1, $$TRUE, $$FALSE, $$FALSE)
hAccel = WinXAddAcceleratorTable (@accel[]) ' create accelerator table
WinXAttachAccelerators (#hMain, hAccel) ' attach the accelerator table to the window

Now hotkeys are always directed to the 'onCommand' function.


Overall, I'm really impressed with what XBLite+WinX can do.
Logged Offline
Private Message Private message Reply: 1 - 1
1 Pages 1 Recommend Thread
Print Print Thread

XBLite Forum    General Boards    XBLite Programming  ›  Adding Keyboard Hotkeys

Thread Rating
There is currently no rating for this thread