Page 2 of 2

Re: Calling Jog panel from button code not working.

PostPosted: Sun Mar 17, 2019 11:45 am
by beefy
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

Re: Calling Jog panel from button code not working.

PostPosted: Sun Mar 17, 2019 11:52 am
by Dan911
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.

Re: Calling Jog panel from button code not working.

PostPosted: Sun Mar 17, 2019 1:47 pm
by ger21
The macro does not work here either, using 1.2109.

Re: Calling Jog panel from button code not working.

PostPosted: Sun Mar 17, 2019 2:13 pm
by beefy
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

Re: Calling Jog panel from button code not working.

PostPosted: Sun Mar 17, 2019 2:22 pm
by ger21
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.

Re: Calling Jog panel from button code not working.

PostPosted: Sun Mar 17, 2019 3:20 pm
by Dan911
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.

Re: Calling Jog panel from button code not working.

PostPosted: Sun Mar 17, 2019 6:12 pm
by dezsoe
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

Re: Calling Jog panel from button code not working.

PostPosted: Sun Mar 17, 2019 6:29 pm
by ger21
So it's a bug?

Re: Calling Jog panel from button code not working.

PostPosted: Sun Mar 17, 2019 9:56 pm
by beefy
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

Re: Calling Jog panel from button code not working.

PostPosted: Tue Mar 19, 2019 4:46 pm
by cncdrive
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.