choices

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

Moderators: davidv, seb@plogue

Hansje
Posts: 823
Joined: Wed Jun 23, 2004 6:22 pm
Location: Utsira, Norway

choices

Postby Hansje » Mon Apr 10, 2006 11:04 am

How to use getParameterChoices(long id, std::vector<std::string>& vec)?
Simply listing the choices here with vec.push_back("xxx") doesn't work.
The function is defined empty in BiduleSDK.cpp. Is that right?

seb@plogue
Site Admin
Posts: 9593
Joined: Tue Mar 02, 2004 7:23 pm
Location: Montreal
Contact:

Postby seb@plogue » Mon Apr 10, 2006 11:29 am

Simply listing the choices here with vec.push_back("xxx") doesn't work.


quickly looking at the sdk wrapper code, it should work. it's only used
when the parameter is INTPARAM, is that the case? if you put a breakpoint there does it get called at all?

The function is defined empty in BiduleSDK.cpp. Is that right?


yes you should implement the method in your derived class

Hansje
Posts: 823
Joined: Wed Jun 23, 2004 6:22 pm
Location: Utsira, Norway

Postby Hansje » Mon Apr 10, 2006 11:50 am

The parameter is INTPARAM and the function does get called.
I suspect it doesn't get called with the right id.
id is the parameter id isn't it?

seb@plogue
Site Admin
Posts: 9593
Joined: Tue Mar 02, 2004 7:23 pm
Location: Montreal
Contact:

Postby seb@plogue » Mon Apr 10, 2006 11:58 am

id is the parameter id isn't it?


Well it should be but it seems I have some remnants of how I was thinking to do it first and send the number of ParameterChoices in the ptr. d'oh!!

I'll fix that but in the meantime you would need to switch on the number of choices (if with some luck they all have different values...)

Hansje
Posts: 823
Joined: Wed Jun 23, 2004 6:22 pm
Location: Utsira, Norway

Postby Hansje » Mon Apr 10, 2006 12:03 pm

Right.
I was just going to tell you that all worked ok if I didn't test for id.
So I'll insert some "don't click me" choices if need be.
Please don't fix this without telling me! :)

Breeze
Posts: 125
Joined: Mon Apr 05, 2010 5:34 pm

Re: choices

Postby Breeze » Thu Mar 27, 2014 5:11 pm

I'm trying to set up two parameters with GUICTRL_CHOICE. Is getParameterChoices(long id, std::vector<std::string>& vec) still functioning as described in this thread? I can't seem to get it to work with a second parameter without crashing Bidule.

dts350z
Posts: 1521
Joined: Thu Jan 15, 2009 1:18 pm

Re: choices

Postby dts350z » Thu Mar 27, 2014 9:08 pm

Snipits

Code: Select all

int _iModeSteering;

Code: Select all

void
ArcTan7_1::getParametersInfos(ParameterInfo* pinfos) {
        p26 = 3;
   pinfos[p26].id = p26;
   STRCPY(pinfos[p26].name, "Steering");
   pinfos[p26].type = INTPARAM;
   pinfos[p26].ctrlType = GUICTRL_CHOICE;
   pinfos[p26].linkable = 1;
   pinfos[p26].saveable = 1;
   pinfos[p26].paramInfo.pi.defaultValue = 0;
   pinfos[p26].paramInfo.pi.numChoices = 3;
}

Code: Select all

void
ArcTan7_1::getParameterChoices(long id, std::vector<std::string>& vec) {
   if(id == p26) {
      vec.push_back("Amplitude");
      vec.push_back("Power");
      vec.push_back("Vector Addition");
   }
}


Code: Select all

void
ArcTan7_1::parameterUpdate(long id){
   if(id == p26) {
      getParameterValue(p26, _iModeSteering);
      if ( _iModeSteering == 2)
         enableParameter(p0, 1);
      else
         enableParameter(p0, 0);
   }
}

Breeze
Posts: 125
Joined: Mon Apr 05, 2010 5:34 pm

Re: choices

Postby Breeze » Thu Mar 27, 2014 10:10 pm

Brilliant! Love those snipits! Finding example code is like mining for gold around here. :lol:

Thanks for the quick reply. It works perfectly now. :mrgreen:

Actually, what's really cool about working with the SDK is that's it's making me remember how C++ is structured. It's kind of funny to feel light bulbs turn on a regular basis... "oh yeah..." ;)


Return to “Bidule SDK”

Who is online

Users browsing this forum: No registered users and 2 guests