Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Hotkey for button
#1
Hi there,

Is it possible to set a hotkey(combo) like CTRL+1 for a button in a dialog

Like when i press CTRL+1 a specific button is 'pressed' and the action is started?

Many thanks!
#2
If button text contains &, next character is underlined and you can use Alt+that character.

It also can be used in Static controls to set focus to the next control in Z order.

Function Dialog150
Code:
Copy      Help
\Dialog_Editor

str dd=
;BEGIN DIALOG
;0 "" 0x90C80AC8 0x0 0 0 224 136 "Dialog"
;3 Button 0x54032000 0x0 8 8 64 14 "&Button (Alt+B)"
;4 Button 0x54032000 0x0 8 28 64 14 "Butto&n (Alt+N)"
;5 Static 0x54000000 0x0 8 48 64 12 "Te&xt (Alt+X)"
;6 Edit 0x54030080 0x200 80 48 96 12 ""
;1 Button 0x54030001 0x4 116 116 48 14 "OK"
;2 Button 0x54030000 0x4 168 116 48 14 "Cancel"
;END DIALOG
;DIALOG EDITOR: "" 0x2040201 "*" "" "" ""

str controls = "6"
str e6
if(!ShowDialog(dd &sub.DlgProc &controls)) ret


#sub DlgProc
function# hDlg message wParam lParam

sel message
,case WM_INITDIALOG
,case WM_DESTROY
,case WM_COMMAND goto messages2
ret
;messages2
sel wParam
,case IDOK
,case IDCANCEL
,case 3 ;;&Button (Alt+B)
,out 3
,
,case 4 ;;Butto&n (Alt+N)
,out 4
ret 1
#3
Thank you very much!

I will test this, i think this is the solution to my 'problem'

Greetings
Sonic
#4
And how about these hotkeys when the windows is not 'active' but another program. Is this possible?
#5
Registering hot keys, waiting for hotkeys
#6
Thank You!

When i use this in a tabbed dialog, the first time the dialog is shown it shows all the controls. After using the tabs it is OK. Any idea?
#7
?
#8
I'm sorry,

Placed the code in the wrong position so the dialog could not be drawn properly.


Forum Jump:


Users browsing this thread: 6 Guest(s)