|
11-08-2009, 12:56 PM
|
#1
|
Human being with feelings
Join Date: Jun 2009
Location: Buffalo, NY
Posts: 777
|
Couple of questions
I have to run to work, so i'll post this real quick:
Does anyone have any idea on how to make radio buttons? Or is there a function for the radio buttons?
How do I display a value, say above a knob I want to display the frequency?
~Rob.
|
|
|
11-08-2009, 01:01 PM
|
#2
|
Human being with feelings
Join Date: Jun 2009
Location: Buffalo, NY
Posts: 777
|
hmm actually, I see this:
// A set of buttons that maps to a single selection. Bitmap has 2 states, off and on.
class IRadioButtonsControl : public IControl
{
public:
IRadioButtonsControl(IPlugBase* pPlug, IRECT* pR, int paramIdx, int nButtons, IBitmap* pBitmap,
EDirection direction = kVertical);
~IRadioButtonsControl() {}
void OnMouseDown(int x, int y, IMouseMod* pMod);
bool Draw(IGraphics* pGraphics);
protected:
WDL_TypedBuf<IRECT> mRECTs;
IBitmap mBitmap;
};
// Output text to the screen.
class ITextControl : public IControl
{
public:
ITextControl(IPlugBase* pPlug, IRECT* pR, IText* pText, const char* str = "")
: IControl(pPlug, pR), mText(*pText)
{
mStr.Set(str);
}
~ITextControl() {}
void SetTextFromPlug(char* str);
void ClearTextFromPlug() { SetTextFromPlug(""); }
bool Draw(IGraphics* pGraphics);
protected:
IText mText;
WDL_String mStr;
};
not really sure how to use it though.. ??
~Rob
|
|
|
11-08-2009, 03:57 PM
|
#3
|
Human being with feelings
Join Date: Jul 2008
Location: The Netherlands
Posts: 3,646
|
Code:
IBitmap bitmap = pGraphics->LoadIBitmap(MY_RADIO_ID, MY_RADIO_FN, 2); // 2 bitmaps: Off and On
int nButtons = 3; // Number of radio buttons
pGraphics->AttachControl(new IRadioButtonsControl(this, &IRECT(x, y, x + bitmap.W, y + nButtons * 0.5*bitmap.H), paramIdx, nButtons, &bitmap, kVertical));
This will display 3 off/on buttons below one another. If you switch one of the buttons, the other two are automatically switched off. (Duh, it's a radio button.) :-p
Code:
pGraphics->AttachControl(new ICaptionControl(this, &IRECT(x1, y1, x2, y2), paramIdx, &IText(&COLOR_BLACK), true));
This will display a parameter's value. However, I'm not sure I'm doing this correctly, because when I just tested this the caption didn't always redraw itself.
|
|
|
11-08-2009, 04:33 PM
|
#4
|
Mortal
Join Date: Dec 2008
Location: France
Posts: 1,969
|
Quote:
Originally Posted by Tale
This will display a parameter's value. However, I'm not sure I'm doing this correctly, because when I just tested this the caption didn't always redraw itself.
|
hey Tale! I faced the same issue, this thread may help: http://forum.cockos.com/showthread.php?t=33893
|
|
|
11-08-2009, 09:58 PM
|
#5
|
Human being with feelings
Join Date: Jun 2009
Location: Buffalo, NY
Posts: 777
|
Why are there x1, y1, x2, y2 ?? instead of just x1, y1 ?? and what is paramIdx ??
error C2065: 'paramIdx' : undeclared identifier
Here is the knob i'm trying to have a readout for :
pGraphics->AttachControl(new IKnobRotaterControl(this, kHPCuttoff1_x, kHPCuttoff1_y, kHPCuttoff1, &bitmap));
~Rob.
|
|
|
11-09-2009, 02:06 AM
|
#6
|
Mortal
Join Date: Dec 2008
Location: France
Posts: 1,969
|
Rob, paramIdx should be replaced with one of -your- EParams enum. About x2, y2, I was first surprised too but it's a native iplug constrainst that finally gives more flexibility..
|
|
|
11-09-2009, 06:14 AM
|
#7
|
Human being with feelings
Join Date: Jun 2009
Location: Buffalo, NY
Posts: 777
|
Thank you, the readout is in, but doesn't move. But I will try other suggestions in that other post. Thank you!
EDIT: Yep, its a redraw issue, cause once I reload the gui the value is changed. Will work on this later.
~Rob.
|
|
|
11-09-2009, 07:57 AM
|
#8
|
Human being with feelings
Join Date: Jun 2009
Location: Buffalo, NY
Posts: 777
|
There has got to be an easier way to redraw the screen no??
~Rob.
|
|
|
11-09-2009, 09:18 AM
|
#9
|
Human being with feelings
Join Date: Jul 2008
Location: The Netherlands
Posts: 3,646
|
Quote:
Originally Posted by Jeffos
|
Thanks for pointing me to that thread, I will look into it.
|
|
|
11-10-2009, 01:56 AM
|
#10
|
Human being with feelings
Join Date: Jun 2009
Location: Buffalo, NY
Posts: 777
|
ok, I'm having a problem with getting the radio button working. It has to deal with resource.h, I believe:
#define BG_ID 100
#define KNOB_ID 101
#define MY_RADIO_ID 102
I get an assertion error and the plug will not load when I set the ID to 102. If I set it to 100, I get 3 buttons lol, but they have the bg as their image, same if I do 101, but I have knobs as the images lol. BUT, the plug will load.
Assertion error using 102 as ID... any thoughts?
EDIT:
Opened myproject.rc and added : MY_RADIO_ID PNG MY_RADIO_FN
Worked fine
~Rob.
Last edited by RRokkenAudio; 11-10-2009 at 02:18 AM.
|
|
|
11-10-2009, 02:59 AM
|
#11
|
Human being with feelings
Join Date: Jun 2009
Location: Buffalo, NY
Posts: 777
|
Actually, now that I have 3 buttons, I hooked up a caption and see that button 1 outputs zero, button 2 outputs 1, and button 3 does nothing
I really need 0,1,2
??
~Rob.
|
|
|
11-10-2009, 05:15 AM
|
#12
|
Human being with feelings
Join Date: Jul 2008
Location: The Netherlands
Posts: 3,646
|
Perhaps you've inited your param with a range of 0..1 instead of 0..2? Your param init should look something like:
Code:
int default = 0, min = 0, max = 3;
GetParam(paramIdx)->InitInt("Radio", default, min, max);
Or when using Enum instead of Int:
Code:
int default = 0, nOptions = 3;
GetParam(paramIdx)->InitEnum("Radio", default, nOptions);
|
|
|
11-10-2009, 05:17 AM
|
#13
|
Human being with feelings
Join Date: Jun 2009
Location: Buffalo, NY
Posts: 777
|
Wow, Tale, you know your stuff.. It's so hard figuring this out uhhhhh....
~Rob
Thanks for your help..
|
|
|
11-10-2009, 05:36 AM
|
#14
|
Human being with feelings
Join Date: Jul 2008
Location: The Netherlands
Posts: 3,646
|
You're very welcome.
At first I had a hard time figuring out things too. But now that I'm acquainted with the IPlug coding style, it all makes sense to me.
|
|
|
11-12-2009, 01:51 AM
|
#15
|
Human being with feelings
Join Date: Aug 2008
Location: Buffalo NY
Posts: 1,091
|
ok, is there any reason i cant have 2 sets of radio buttons ? I cant seem to get my second set to switch at all...??
~Rob.
|
|
|
11-12-2009, 04:12 AM
|
#16
|
Human being with feelings
Join Date: Jul 2008
Location: The Netherlands
Posts: 3,646
|
I've just tried, but two (and three) sets work just fine here.
|
|
|
11-13-2009, 03:14 AM
|
#17
|
Human being with feelings
Join Date: Aug 2008
Location: Buffalo NY
Posts: 1,091
|
Turns out, I wasn't changing the x value on the second x arg lol
~Rob.
|
|
|
Thread Tools |
|
Display Modes |
Linear Mode
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
All times are GMT -7. The time now is 09:02 AM.
|