Hello Tom!
I'm trying to configure the jog and step buttons in the Screen Editor so that pressing the arrow, page up/down, +, - keys on the keyboard would trigger the step mode, and their combination with the CTRL key would trigger the run mode, which is the opposite of how it's done by default. I can't change it. Is there a way to configure this?
Can't reconfigure the hotkeys for the control buttons.
Moderators: TomKerekes, dynomotion
- TomKerekes
- Posts: 2745
- Joined: Mon Dec 04, 2017 1:49 am
Re: Can't reconfigure the hotkeys for the control buttons.
Hi Alex,
That functionality is hard coded. To change that behaviour you would need to modify the function:
Then re-compile KMotionCNC.
3 Screen buttons act in a group that share the same hotkey. That function decides based on the shift and control states which buttons to press or release.
That functionality is hard coded. To change that behaviour you would need to modify the function:
Code: Select all
int DoCheckShiftAndKey(int Key,WPARAM wParam, LPARAM lParam, CMotionButton &Button, CMotionButton &Button2, CMotionButton &ButtonStep)
3 Screen buttons act in a group that share the same hotkey. That function decides based on the shift and control states which buttons to press or release.
Regards,
Tom Kerekes
Dynomotion, Inc.
Tom Kerekes
Dynomotion, Inc.
Re: Can't reconfigure the hotkeys for the control buttons.
Where is this function located? Does it require Visual Studio ?
- TomKerekes
- Posts: 2745
- Joined: Mon Dec 04, 2017 1:49 am
Re: Can't reconfigure the hotkeys for the control buttons.
You can locate it by doing a find-in-files search such as the one in Visual Studio.
Yes you would need Visual Studio 2022
Yes you would need Visual Studio 2022
Regards,
Tom Kerekes
Dynomotion, Inc.
Tom Kerekes
Dynomotion, Inc.
Re: Can't reconfigure the hotkeys for the control buttons.
I adjusted the function, everything seems to work.
Thanks!
Thanks!
Code: Select all
int DoCheckShiftAndKey(int Key,WPARAM wParam, LPARAM lParam, CMotionButton &Button, CMotionButton &Button2, CMotionButton &ButtonStep)
{
if (wParam == VK_SHIFT)
{
if (lParam & 0x80000000)
{
// shift went up
if (Button2.DrawPushed)
{
Button.HandleButtonDown();
Button2.HandleButtonUp();
}
}
else
{
// shift went down
if (Button.DrawPushed)
{
Button2.HandleButtonDown();
Button.HandleButtonUp();
}
}
}
if (Key == wParam)
{
if (GetKeyState(VK_CONTROL)&0x80000000)
{
if (lParam & 0x80000000)
{
if (Button.DrawPushed)
{
Button.HandleButtonUp();
}
}
else
{
if (!Button.DrawPushed)
{
Button.HandleButtonDown();
}
}
}
else if (GetKeyState(VK_SHIFT)&0x80000000)
{
if (lParam & 0x80000000)
{
if (Button2.DrawPushed)
{
Button2.HandleButtonUp();
}
}
else
{
if (!Button2.DrawPushed)
{
Button2.HandleButtonDown();
}
}
}
else
{
if ((lParam & 0x80000000)==0)
{
// arrow key was pressed while
ButtonStep.HandleButtonDown();
}
else
{
// arrow key was released while
ButtonStep.HandleButtonUp();
}
}
return 1;
}
return 0;
}