Get parameters in init()?

Discussion about the Bidule SDK, post your questions, feature request and plugins here.

Get parameters in init()?

Postby dts350z » Sun Mar 20, 2011 9:56 pm

I have something I want to run during loading of my plugin, so I have it in init() and all is fine.

But now I only want it to run IF a checkbox "run at startup" is checked.

Here's my parameter setup:

Code: Select all
pinfos[0].id = 0;
    pinfos[0].type = BOOLPARAM;   
    pinfos[0].ctrlType = GUICTRL_CHECKBOX;
    STRCPY(pinfos[0].name, "Check At Startup:");
    pinfos[0].linkable = 1;
    pinfos[0].saveable = 1;
    pinfos[0].paramInfo.pb.defaultValue = false;
    pinfos[0].paramInfo.pb.isTrigger = false;


STRCPY is defined as strcpy_s under windows, and strcpy under OSX.

Now my problem is that when I do:

Code: Select all
getParameterValue(0, CheckAtStart);
  if (CheckAtStart == 1 ) {


inside init() it seems that CheckAtStart is always ==0 regardless of whether or not it's checked.

Here's my parameterUpdate()

Code: Select all
Version4_8::parameterUpdate(long id){

      if(id == 0)
      getParameterValue(0, CheckAtStart);
      if(id == 1)
      getParameterValue(1, CheckNow);
}


Is it just that at the time of init we don't have the parameter values yet?
dts350z
 
Posts: 942
Joined: Thu Jan 15, 2009 1:18 pm

Re: Get parameters in init()?

Postby seb@plogue » Mon Mar 21, 2011 8:52 am

Is it just that at the time of init we don't have the parameter values yet?


Yes, once init is done, parameterUpdate is called for every parameter.
seb@plogue
Site Admin
 
Posts: 7911
Joined: Tue Mar 02, 2004 7:23 pm
Location: Montreal


Return to Bidule SDK

Who is online

Users browsing this forum: No registered users and 1 guest

cron