Page 1 of 1

Re: Question on activating a plugin with a button

PostPosted: Sun Nov 04, 2018 9:55 pm
by dezsoe
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();
  }
}

Re: Question on activating a plugin with a button

PostPosted: Sun Nov 04, 2018 10:22 pm
by dezsoe
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.

Re: Question on activating a plugin with a button

PostPosted: Sun Nov 11, 2018 9:11 pm
by dezsoe
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();
            }
        }

Re: Question on activating a plugin with a button

PostPosted: Sun Nov 11, 2018 10:51 pm
by Dan911
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