Calling Jog panel from button code not working.

If you think you've found a bug post it here.

Re: Calling Jog panel from button code not working.

Postby beefy » Sun Mar 17, 2019 11:45 am

Thanks Dan,

that's very interesting.

I tried the same but made 3 buttons for each jog code. ALL worked great in the latest development version and the jog panel opened / closed as expected.

I'll get back to this tomorrow and try and figure out why a buttonpress event in the plugin works great, yet putting code "exec.Callbutton(770);" in a macro and calling the macro from MDI does not.

I'll also try some different plugin code (not in the buttonpress event) and see if I can get that to work.

Keith
beefy
 
Posts: 449
Joined: Mon Sep 05, 2016 10:34 am

Re: Calling Jog panel from button code not working.

Postby Dan911 » Sun Mar 17, 2019 11:52 am

I just created a macro M20566 with exec.Callbutton(770) than created a button in screen editor with button #20566 and worked no problem, 49, 08


Tried Calling Macro via MDI and didn't work.
Dan911
 
Posts: 613
Joined: Mon Oct 31, 2016 1:22 am
Location: USA

Re: Calling Jog panel from button code not working.

Postby ger21 » Sun Mar 17, 2019 1:47 pm

The macro does not work here either, using 1.2109.
Gerry
UCCNC 2022 Screenset - http://www.thecncwoodworker.com/2022.html
ger21
 
Posts: 2714
Joined: Sat Sep 03, 2016 2:17 am

Re: Calling Jog panel from button code not working.

Postby beefy » Sun Mar 17, 2019 2:13 pm

So much for me getting to bed, just couldn't get this out of my mind. At least I'll go to bed contented now :lol:

We know that using a plugin buttonpress event to execute Callbutton(770); works WHEN the button press was an actual mouse click on a screen button (5678 in this case).

Code: Select all
//Called when the user presses a button on the UCCNC GUI or if a Callbutton function is executed.
//The int buttonnumber parameter is the ID of the caller button.
// The bool onscreen parameter is true if the button was pressed on the GUI and is false if the Callbutton function was called.
       
public void Buttonpress_event(int buttonnumber, bool onscreen)
{
            //if (onscreen)
            //{
                       if (buttonnumber == 5678)
                       {
                              UC.Callbutton(770);
                       }
           //}       
}


So instead of mouse clicking that screen button, I tried calling the screen button in the plugin - UC.Callbutton(5678);
And also commenting out the "if (onscreen)" so the plugin buttonpress event did not care what pressed the screen button (i.e. mouse click or Callbutton() function)

That did the trick. Not a perfect solution as I have to create 2 screen buttons to execute Jog Panel Show and Jog Panel Hide functions via a plugin.

But at least it's a workaround :)

So there does seem to be a bug. Should simply be able to execute UC.Callbutton(770); anywhere in the plugin, but seems that's not the case.

Thanks for all the brains that helped work this out.

Keith
beefy
 
Posts: 449
Joined: Mon Sep 05, 2016 10:34 am

Re: Calling Jog panel from button code not working.

Postby ger21 » Sun Mar 17, 2019 2:22 pm

beefy wrote:
That did the trick. Not a perfect solution as I have to create 2 screen buttons to execute Jog Panel Show and Jog Panel Hide functions via a plugin.

Keith


You can make them very small, and invisible.
Gerry
UCCNC 2022 Screenset - http://www.thecncwoodworker.com/2022.html
ger21
 
Posts: 2714
Joined: Sat Sep 03, 2016 2:17 am

Re: Calling Jog panel from button code not working.

Postby Dan911 » Sun Mar 17, 2019 3:20 pm

Dan911 wrote:I just created...
Code: Select all
public void buttonnum(int num)
        {
            UC.Callbutton(num);
           
        }


And worked NP in 49 and 08 :?



Keith you can use UC.Callbutton(770) in plugin, I just used button event for quick test to show you no bug and you just weren't writing it correctly. This can also be done in macro.

The only thing I found not working is calling macro from MDI, maybe Balaz will explain why.
Dan911
 
Posts: 613
Joined: Mon Oct 31, 2016 1:22 am
Location: USA

Re: Calling Jog panel from button code not working.

Postby dezsoe » Sun Mar 17, 2019 6:12 pm

I also tried it with a macro from MDI when it did not show up:

Code: Select all
exec.Callbutton(770); // Jog Panel show
exec.Wait(1000);
exec.Callbutton(771); // Jog Panel hide
dezsoe
 
Posts: 2093
Joined: Sun Mar 12, 2017 4:41 pm
Location: Csörög, Hungary

Re: Calling Jog panel from button code not working.

Postby ger21 » Sun Mar 17, 2019 6:29 pm

So it's a bug?
Gerry
UCCNC 2022 Screenset - http://www.thecncwoodworker.com/2022.html
ger21
 
Posts: 2714
Joined: Sat Sep 03, 2016 2:17 am

Re: Calling Jog panel from button code not working.

Postby beefy » Sun Mar 17, 2019 9:56 pm

Yep, I must have been writing something wrong in the plugin before because now I'm using UC.Callbutton(770); without any problem.

Also tried using an array, and using a value in the array element as the Callbutton parameter, and all working good e.g. UC.Callbutton(MyArray[elementNo]);

To be honest I'm completely stumped where I may have been writing the code wrong previously, maybe I was just tired and couldn't see the forest for the trees. Apologies to all if I messed up there.

But there does seem to be a bug with exec.Callbutton(770); in a macro.

Keith
beefy
 
Posts: 449
Joined: Mon Sep 05, 2016 10:34 am

Re: Calling Jog panel from button code not working.

Postby cncdrive » Tue Mar 19, 2019 4:46 pm

I will have to check this, it is probably something about the Form focus, because in MDI you put the focus on the main Form with entering the MDI, and maybe the code execution gets the focus back to the main Form and so the jog panel then looses focus and so it dissapears, but this is just an idea for now, I will need some time to check it out.
cncdrive
Site Admin
 
Posts: 4887
Joined: Tue Aug 12, 2014 11:17 pm

Previous

Return to Report a bug

Who is online

Users browsing this forum: No registered users and 14 guests