For each button on a toolbar I have created an accelerator key. The user can take an action by pressing the toolbar button or by pressing the accelerator keys. I want to control which action is taken depending on whether accelerator keys were pressed or whether the user pressed the toolbar button.
Instead of putting code under each Case to test for the message source. I'd rather put the test code in one place, to take action if an accelerator key was pressed and then, regardless of whether an accelerator key was pressed, I want the app to also take the response that would come from pressing the toolbar button.
This seems to provide that result (uses acceleration key detection code mentioned in an earlier thread) and requires only 1 line of code under %WM_Command, not a line of code for each Case.
This action is to support a change to an existing app, where the app have the better part of 1000 toolbar buttons and the approach above cuts down on how many lines of code I have to add to the existing app.
Instead of putting code under each Case to test for the message source. I'd rather put the test code in one place, to take action if an accelerator key was pressed and then, regardless of whether an accelerator key was pressed, I want the app to also take the response that would come from pressing the toolbar button.
This seems to provide that result (uses acceleration key detection code mentioned in an earlier thread) and requires only 1 line of code under %WM_Command, not a line of code for each Case.
Code:
%WM_Command If Hi(Word,Cb.WParam) = 1 Then TakeMonitorAction 'if message came from Accel key, then take action. then take action on the button press Select Case Cb.Ctl Case %IDT_A : TaskA Case %IDT_B : TaskB Case %IDT_C : TaskC End Select
Comment