Page 1 of 1
Can't reconfigure the hotkeys for the control buttons.
Posted: Fri Dec 20, 2024 11:48 pm
by AlexSV
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?
Re: Can't reconfigure the hotkeys for the control buttons.
Posted: Sat Dec 21, 2024 1:09 am
by TomKerekes
Hi Alex,
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)
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.
Re: Can't reconfigure the hotkeys for the control buttons.
Posted: Sat Dec 21, 2024 7:09 am
by AlexSV
Where is this function located? Does it require Visual Studio ?
Re: Can't reconfigure the hotkeys for the control buttons.
Posted: Sat Dec 21, 2024 7:43 am
by TomKerekes
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
Re: Can't reconfigure the hotkeys for the control buttons.
Posted: Sun Dec 22, 2024 7:54 am
by AlexSV
I adjusted the function, everything seems to work.
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;
}