Ability to use screen buttons in Hotkeys

Here is where you can request new features or special features.

Ability to use screen buttons in Hotkeys

Postby johnsattuk » Sun Feb 06, 2022 2:04 pm

If it was possible to designate screen buttons to use in HotKeys it would allow all sorts of possibilities :D :D
johnsattuk
 
Posts: 79
Joined: Thu Aug 12, 2021 1:24 pm

Re: Ability to use screen buttons in Hotkeys

Postby cncdrive » Sun Feb 06, 2022 2:11 pm

It's possible, I mean that is exactly how it works now.
In the hotkeys menu you can assign a hotkey to a button code.
So, when you pressing the hotkey it calls the button code just like as if you were pressing that button on the screen.
cncdrive
Site Admin
 
Posts: 4887
Joined: Tue Aug 12, 2014 11:17 pm

Re: Ability to use screen buttons in Hotkeys

Postby johnsattuk » Sun Feb 06, 2022 3:21 pm

What I really meant was, Pressing a screenbutton initiates a hotkey

At the moment hotkeys only allow KEY presses I think

Perhaps a HotButtons menu
johnsattuk
 
Posts: 79
Joined: Thu Aug 12, 2021 1:24 pm

Re: Ability to use screen buttons in Hotkeys

Postby cncdrive » Sun Feb 06, 2022 3:35 pm

Sorry, I don't understand what you wrote. :(
Could you please explain?
cncdrive
Site Admin
 
Posts: 4887
Joined: Tue Aug 12, 2014 11:17 pm

Re: Ability to use screen buttons in Hotkeys

Postby johnsattuk » Sun Feb 06, 2022 4:07 pm

OK
example-
I create a screen button and give it the number 900
I would like to use the button number 900 in HotKeys to initiate functions 148 and 149
I can do this using keyboard Key numbers, but it would be great if it were possible with screen buttons
johnsattuk
 
Posts: 79
Joined: Thu Aug 12, 2021 1:24 pm

Re: Ability to use screen buttons in Hotkeys

Postby eabrust » Sun Feb 06, 2022 5:21 pm

How about a floating jog panel plugin? I prefer working w/ plugins vs screenset alterations and macros.

jogbox.PNG



I had made this as a demo a while ago as a plugin example. I added diagonal jog buttons pretty quickly today. It could use more work/refinement, but I won't put more time into it if no one will use it.


JogBox.zip
(113.93 KiB) Downloaded 427 times



Just drop it in your plugins folder, enable to show on startup. I can clean it up and make the source available if there is any interest in it.


regards
Eric
CraftyCNC: Plugins for UCCNC (and other neat stuff): http://www.craftycnc.com/plugins-for-uccnc/
eabrust
 
Posts: 357
Joined: Fri Sep 16, 2016 2:32 am
Location: Near Shirland IL, USA

Re: Ability to use screen buttons in Hotkeys

Postby johnsattuk » Sun Feb 06, 2022 5:27 pm

Will give it a go :D :D
johnsattuk
 
Posts: 79
Joined: Thu Aug 12, 2021 1:24 pm

Re: Ability to use screen buttons in Hotkeys

Postby cncdrive » Sun Feb 06, 2022 5:27 pm

You can do that with button codes 20000 to 21999.
Then you can add a macro to the M20000.txt file and you can put in that macro the exec.Callbutton(148); etc.
cncdrive
Site Admin
 
Posts: 4887
Joined: Tue Aug 12, 2014 11:17 pm

Re: Ability to use screen buttons in Hotkeys

Postby johnsattuk » Sun Feb 06, 2022 6:48 pm

Thank you, that starts the diagonal movement :D
How do I stop it when the button is released :o
johnsattuk
 
Posts: 79
Joined: Thu Aug 12, 2021 1:24 pm

Re: Ability to use screen buttons in Hotkeys

Postby dezsoe » Thu Feb 10, 2022 11:52 am

OK, now I could finally get to write a macroloop for you. Honestly, I've never used AS3.Getbutton(), so first I had to try it. Change the four constants with the Btn in the end (UpRightBtn etc.) to the button numbers that you want to use. In the sample I set them to 55550..55553. Save the following code as Mxxx.txt where xxx is a macro number and set that number in the Macroloops window. Also, check auto run.

Code: Select all
// ================================================================================================
// Diagonal jog buttons
// ================================================================================================

// Read button press states
bool UpRight = AS3.Getbutton(UpRightBtn);
bool DownRight = AS3.Getbutton(DownRightBtn);
bool UpLeft = AS3.Getbutton(UpLeftBtn);
bool DownLeft = AS3.Getbutton(DownLeftBtn);

if (UpRight != lastUpRight)
{
  // Button was pressed or released
  if (UpRight)
  {
    // Button was pressed
    exec.Callbutton(JogOn + YPlus);
    exec.Callbutton(JogOn + XPlus);
  }
  else
  {
    // Button was released
    exec.Callbutton(JogOff + YPlus);
    exec.Callbutton(JogOff + XPlus);
  }
  lastUpRight = UpRight;
}

if (DownRight != lastDownRight)
{
  // Button was pressed or released
  if (DownRight)
  {
    // Button was pressed
    exec.Callbutton(JogOn + YMinus);
    exec.Callbutton(JogOn + XPlus);
  }
  else
  {
    // Button was released
    exec.Callbutton(JogOff + YMinus);
    exec.Callbutton(JogOff + XPlus);
  }
  lastDownRight = DownRight;
}

if (UpLeft != lastUpLeft)
{
  // Button was pressed or released
  if (UpLeft)
  {
    // Button was pressed
    exec.Callbutton(JogOn + YPlus);
    exec.Callbutton(JogOn + XMinus);
  }
  else
  {
    // Button was released
    exec.Callbutton(JogOff + YPlus);
    exec.Callbutton(JogOff + XMinus);
  }
  lastUpLeft = UpLeft;
}

if (DownLeft != lastDownLeft)
{
  // Button was pressed or released
  if (DownLeft)
  {
    // Button was pressed
    exec.Callbutton(JogOn + YMinus);
    exec.Callbutton(JogOn + XMinus);
  }
  else
  {
    // Button was released
    exec.Callbutton(JogOff + YMinus);
    exec.Callbutton(JogOff + XMinus);
  }
  lastDownLeft = DownLeft;
}

// ================================================================================================

#Events

// ================================================================================================

const int UpRightBtn = 55550;
const int DownRightBtn = 55551;
const int UpLeftBtn = 55552;
const int DownLeftBtn = 55553;

const int JogOn = 147;
const int JogOff = 229;

const int XPlus = 0;
const int XMinus = 1;
const int YPlus = 2;
const int YMinus = 3;

bool lastUpRight = false;
bool lastDownRight = false;
bool lastUpLeft = false;
bool lastDownLeft = false;

// ================================================================================================

/*
147    JogX+    Jogs the X axis to positive direction. 
148    JogX-    Jogs the X axis to negative direction. 
149    JogY+    Jogs the Y axis to positive direction. 
150    JogY-    Jogs the Y axis to negative direction. 

229    JogXplusoff    Switches the X axis positive direction jogging off. 
230    JogXminusoff   Switches the X axis negative direction jogging off. 
231    JogYplusoff    Switches the Y axis positive direction jogging off. 
232    JogYminusoff   Switches the Y axis negative direction jogging off. 
*/

// ================================================================================================
dezsoe
 
Posts: 2093
Joined: Sun Mar 12, 2017 4:41 pm
Location: Csörög, Hungary

Next

Return to Feature Request

Who is online

Users browsing this forum: No registered users and 8 guests