Wizards update

Discuss the creation and usage of Wizards

Re: Wizards update

Postby Dan911 » Thu May 31, 2018 5:39 pm

Hi Terry,
I started writing this menu plugin before I decided just to put all wizards into 1 plugin. It needs a button created on screen with # 44444. I can make it be able to be called with a macro/mdi if any 1 needs or prefers it.

Macro Menu.zip
(6.45 KiB) Downloaded 1290 times
Attachments
Macro menu2.JPG
Macro menu1.JPG
Dan911
 
Posts: 613
Joined: Mon Oct 31, 2016 1:22 am
Location: USA

Re: Wizards update

Postby Dan911 » Fri Jun 01, 2018 1:20 am

Thanks Terry and yes, can be called via a hotkey. Probably failed to mention because not a big fan of hotkeys, especially of windows that may need to be opened and closed often. I know your preference is the opposite.

Now I have one small button on screen to open the macro menu and all macros/plugins to call by name with a click. I find it a pain to remember different key combinations and macro numbers. I see I'm going to have to increase the amount of items in the comboBox.

Dan
Dan911
 
Posts: 613
Joined: Mon Oct 31, 2016 1:22 am
Location: USA

Re: Wizards update

Postby Dan911 » Fri Jun 01, 2018 2:26 am

Vmax549 wrote:Dan here is a thought, Instead of having to create a NEW button on screen simply setup the wizard as a hotkey in UCCNC I use {ALT_W} to call your Wizard up instead of creating a new screen button.

(;-) TP


The QuickCam Wizard CANNOT be open with a macro and needs a on screen button to work, if called with a M code you will get a [STATHREAD]
exemption when you try to open a wizard. I posted this on the download page. It is opening a form within a form and cannot be handled in plugin unless I change the interface that I like.

Dan
Dan911
 
Posts: 613
Joined: Mon Oct 31, 2016 1:22 am
Location: USA

Re: Wizards update

Postby dezsoe » Fri Jun 01, 2018 8:25 am

To prevent key code collision you could have a key in the profile to define the button code. E.g.:

Code: Select all
[MyPlugins]
Wiz1button=44444

On startup the plugin could read this key (in Init_event) and check the read code in Buttonpress_event.
dezsoe
 
Posts: 2049
Joined: Sun Mar 12, 2017 4:41 pm
Location: Csörög, Hungary

Re: Wizards update

Postby dezsoe » Fri Jun 01, 2018 2:40 pm

I think the difference is in the sample code:

Code: Select all
        // 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 == 128)
                {
                   
                }
            }
        }

If you check the onscreen value then Callbutton won't work. :) I did the same some time ago, reported to Balázs as an error. He told me to read the comment before the function declaration... :)

Edit: Hotkeys also make GUI calls.
dezsoe
 
Posts: 2049
Joined: Sun Mar 12, 2017 4:41 pm
Location: Csörög, Hungary

Re: Wizards update

Postby Dan911 » Fri Jun 01, 2018 4:07 pm

Vmax549 wrote:It is odd that the hotkey will start the Wiz but not Callbutton().


(;-) TP


Yes I did that deliberately by leaving the onscreen bool check like Dezsoe pointed out with the QuickCam plugin, other plugins I removed to leave the option to use Callbutton(). Yes it's true we learn something new everyday, I never realized you could set a hotkey for a button directly that wasn't on screen. I thought it had to be put in a macro with a callbutton() or create the button.

That's why I prefer using a button and now I see hotkey than a M code to call. Using the callbutton() in macro with a wizard or plugin leaves UCCNC kind of inoperable until it closes.

Dan
Dan911
 
Posts: 613
Joined: Mon Oct 31, 2016 1:22 am
Location: USA

Re: Wizards update

Postby Dan911 » Fri Jun 01, 2018 4:35 pm

dezsoe wrote:I think the difference is in the sample code:

Code: Select all
        // 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 == 128)
                {
                   
                }
            }
        }

If you check the onscreen value then Callbutton won't work. :) I did the same some time ago, reported to Balázs as an error. He told me to read the comment before the function declaration... :)

Edit: Hotkeys also make GUI calls.



Also If a macro number between 20000-21999 is used with a callbutton(???) that bool check is ignored.

Dan
Dan911
 
Posts: 613
Joined: Mon Oct 31, 2016 1:22 am
Location: USA

Re: Wizards update

Postby dezsoe » Fri Jun 01, 2018 6:49 pm

I didn't try that range, because that's for the macros. I use the Button_event to prevent writing macros to start (or do anything) in a plugin. For me the Button_event is the best way to start a plugin when reset is active. In my plugins I have no Button_event check exept the SwLED plugin, which calls other stuff, because this way if I want to change the buttonnumber I don't have to recompile the plugin(s).
dezsoe
 
Posts: 2049
Joined: Sun Mar 12, 2017 4:41 pm
Location: Csörög, Hungary

Re: Wizards update

Postby Dan911 » Sat Jun 02, 2018 12:23 pm

Hi Dezsoe,

Using ##20000-21999 is just something I observed testing/experimenting with the do's and don'ts for the Macro Menu plugin I'm working on.
I agree, I been using the button event from the start of creating any plugin that required a form to be called.

Dan
Dan911
 
Posts: 613
Joined: Mon Oct 31, 2016 1:22 am
Location: USA

Re: Wizards update

Postby Dan911 » Sun Jun 10, 2018 9:05 pm

dezsoe wrote:To prevent key code collision you could have a key in the profile to define the button code. E.g.:

Code: Select all
[MyPlugins]
Wiz1button=44444

On startup the plugin could read this key (in Init_event) and check the read code in Buttonpress_event.


Hi Dezsoe,

I tried your suggested solution and many others with no success, I'm not convinced it is a Directory issue. QuickCam works fine with a created button or hotkey(GUI) but when opened with the CallButton()
inside UCCNC macro class it will only allow the first 2 Forms created to open regardless of order and will get the STAthread exemption on the other 3 when tried to open.

I did find a solution to open it with a M code, I added a informsplugin event to plugin and call button event there. I used exec.informsplugin to call from macro and all works like it should.

Ultimately I would prefer to use informplugin(Quickcam, button#) and not write to all plugins but can't get around that function needing a return. Any idea's?

Thanks, your help is always very much appreciated.

Dan
Dan911
 
Posts: 613
Joined: Mon Oct 31, 2016 1:22 am
Location: USA

Next

Return to Conversational Wizards

Who is online

Users browsing this forum: No registered users and 2 guests