COCKOS
CONFEDERATED FORUMS
Cockos : REAPER : NINJAM : Forums
Forum Home : Register : FAQ : Members List : Search :
Old 05-02-2019, 12:01 PM   #1
Nonlinear
Human being with feelings
 
Join Date: Apr 2018
Posts: 203
Default How to hide/show an IBitmap control?

I find it curious that HideControl() and GrayOutControl() don't actually work with "controls" per se - they require a parameter Idx. If a control doesn't have an associated parameter HideControl()/GrayOutControl() has no effect.

So, if I have an IBitmap control that is only displaying a bitmap (i.e., a meter with no parameter) is there a means to Hide/Show it?
Nonlinear is offline   Reply With Quote
Old 05-02-2019, 12:08 PM   #2
pressplay
Human being with feelings
 
pressplay's Avatar
 
Join Date: Sep 2017
Location: Berlin
Posts: 47
Default

IBitmapControl is derived from IControl which provides e.g. Hide(bool) and GrayOut(bool).
pressplay is offline   Reply With Quote
Old 05-02-2019, 01:01 PM   #3
Nonlinear
Human being with feelings
 
Join Date: Apr 2018
Posts: 203
Default

Quote:
Originally Posted by pressplay View Post
IBitmapControl is derived from IControl which provides e.g. Hide(bool) and GrayOut(bool).
Yes, please read my OP. Those only work if there is a parameter attached to the control. It doesn't work if the control is simply a bitmap.
Nonlinear is offline   Reply With Quote
Old 05-02-2019, 02:06 PM   #4
pressplay
Human being with feelings
 
pressplay's Avatar
 
Join Date: Sep 2017
Location: Berlin
Posts: 47
Default

I doubt this is true. I've hidden several controls without parameter binding using these methods.
pressplay is offline   Reply With Quote
Old 05-02-2019, 02:15 PM   #5
stw
Human being with feelings
 
stw's Avatar
 
Join Date: Apr 2012
Posts: 250
Default

define a pointer to your BitmapControl (with ParamIdx -1), then: pointer->Hide()
stw is offline   Reply With Quote
Old 05-02-2019, 09:07 PM   #6
Nonlinear
Human being with feelings
 
Join Date: Apr 2018
Posts: 203
Default

Quote:
Originally Posted by pressplay View Post
I doubt this is true. I've hidden several controls without parameter binding using these methods.
I tried lines like this:

IBitmap knob = pGraphics->LoadIBitmap(METER_ID, METER_FN, 61);
mMeterIdx = pGraphics->AttachControl(new IBitmapControl(this, 20, 10, -1, &knob));

GetGUI()->GrayOutControl(mMeterIdx, true);

and

GetGUI()->HideControl(mMeterIdx, true);


Neither of these had any effect unless there was a parameter attached to the control.
Nonlinear is offline   Reply With Quote
Old 05-02-2019, 10:37 PM   #7
pressplay
Human being with feelings
 
pressplay's Avatar
 
Join Date: Sep 2017
Location: Berlin
Posts: 47
Default

As stw said, store a pointer to the control as a plug-in class member. Then:

Code:
// in plug-in ctor:
mBitmapControl = new IBitmapControl(this, 20, 10, -1, &knob);
pGraphics->AttachControl(mBitmapControl);
And later
Code:
mBitmapControl->Hide(true);
pressplay is offline   Reply With Quote
Old 05-03-2019, 09:30 AM   #8
Nonlinear
Human being with feelings
 
Join Date: Apr 2018
Posts: 203
Default

Quote:
Originally Posted by pressplay View Post
As stw said, store a pointer to the control as a plug-in class member. Then:

Code:
// in plug-in ctor:
mBitmapControl = new IBitmapControl(this, 20, 10, -1, &knob);
pGraphics->AttachControl(mBitmapControl);
And later
Code:
mBitmapControl->Hide(true);
OK, so "mBitmapControl->Hide()" and "GetGUI->Hide(mBitmapControl)" are two different things? Wow. OK, will try that. Thanks all.
Nonlinear is offline   Reply With Quote
Old 05-03-2019, 09:56 AM   #9
stw
Human being with feelings
 
stw's Avatar
 
Join Date: Apr 2012
Posts: 250
Default

Quote:
Originally Posted by Nonlinear View Post
OK, so "mBitmapControl->Hide()" and "GetGUI->Hide(mBitmapControl)" are two different things? Wow. OK, will try that. Thanks all.
Yes, they are. First watch out the little difference "Hide()" vs. "HideControl()".

If you follow the definition from HideControl() you'll see that it crawls thru every IControl and uses Hide() for all IControls associated with the matching ParamIdx. So HideControl() would hide/unhide more than one IControl if they exist.

And BTW HideControl() takes no IControl pointer but a ParamIdx!
stw is offline   Reply With Quote
Old 05-03-2019, 05:41 PM   #10
Nonlinear
Human being with feelings
 
Join Date: Apr 2018
Posts: 203
Default

Quote:
Originally Posted by stw View Post
And BTW HideControl() takes no IControl pointer but a ParamIdx!
Yes! That's what I was getting at in my OP here - it doesn't work unless there is a parameter attached to the control, i.e., it needs a "parameterIdx".

OK,great. Will try "Hide()". Thank you.
Nonlinear is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -7. The time now is 01:39 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2019, vBulletin Solutions Inc.