Question on activating a plugin with a button

This is where you talk about Plugins. How they are made and how they work, show examples.

Re: Question on activating a plugin with a button

Postby dezsoe » Sun Nov 04, 2018 9:55 pm

It should work. There must be something else in myform that inactivates your plugin (or just the form).

Some comments on showing plugins this way. Don't use the 2xxxx buttoncodes, because the main program will search for a macro M2xxxx. If you want to activate your plugin with exec.Callbutton() then don't check for the onscreen parameter.

Code: Select all
public void Buttonpress_event(int buttonnumber, bool onscreen)
{
  if (buttonnumber == 10000)
  {
    // myform = new PluginForm(this);
    myform.Show();
    myform.BringToFront();
  }
}
dezsoe
 
Posts: 589
Joined: Sun Mar 12, 2017 4:41 pm
Location: Csörög, Hungary

Re: Question on activating a plugin with a button

Postby dezsoe » Sun Nov 04, 2018 10:22 pm

Yes. I don't know the upper limit, but the hotkey (and all trigger) settings are limited to 0..21000. Only the input fields, so it is only an error in the screenset file from the past.
dezsoe
 
Posts: 589
Joined: Sun Mar 12, 2017 4:41 pm
Location: Csörög, Hungary

Re: Question on activating a plugin with a button

Postby dezsoe » Sun Nov 11, 2018 9:11 pm

Hi Terry,

I had to make it first, because I don't program in C# and I don't use this technique. :) (I program in VB and I have a "central" plugin which handles all buttons, LEDs, etc. and I have to change only the profile to activate my plugins. Nothing is fixed, all buttonnumbers are changeable in the profile.)

This is the Buttonpress_event of the sample code modified to start on button 5432:

Code: Select all
        public void Buttonpress_event(int buttonnumber, bool onscreen)
        {
            if (buttonnumber == 5432)
            {
                if (myform == null)
                    myform = new PluginForm(this);
                if (myform.IsDisposed)
                    myform = new PluginForm(this);
                if (!myform.Visible)
                    myform.ShowDialog();
                else
                    myform.BringToFront();
            }
        }
dezsoe
 
Posts: 589
Joined: Sun Mar 12, 2017 4:41 pm
Location: Csörög, Hungary

Re: Question on activating a plugin with a button

Postby Dan911 » Sun Nov 11, 2018 10:51 pm

Terry, you or anyone who wants to write plugins have to put a little more effort in to learn C# and google, I posted this on Zone over a year ago.
Why I didn't reply here is it was a lot more than not putting something in the right place.

cnczone.JPG
Dan911
 
Posts: 501
Joined: Mon Oct 31, 2016 1:22 am
Location: USA


Return to Plugins

Who is online

Users browsing this forum: No registered users and 4 guests