WDL-OL set location of IBitmapControl

DSP, Plugin and Host development discussion.
Post Reply New Topic
RELATED
PRODUCTS

Post

Hey guys, I'm using successfully the cool wdl-ol library from Oliver Larkin, by the way i've seen that I don't know why, i can't move programmatically an IBitmapControl

Code: Select all

int positionX = start_add_plus_x;
int positionY = start_add_plus_y;
IBitmap bitmapOver = pGraphics->LoadIBitmap(PLUS_CLICK_SQUARE_OVER_ID, PLUS_CLICK_SQUARE_OVER_FN, 1);
plus_over = pGraphics->AttachControl(new IBitmapControl(this, positionX, positionY, &bitmapOver));
GetGUI()->GetControl(plus_over)->Hide(true);
In the first line I'm creating the IBitmap, in the second one i'm adding it's ID to a integer value, on the last one I'm hiding it, now i want to dynamically move it by clicking two others IBitmapControl. The fact is that i can understand which one called the setPosition() void function which should move the plus_over IBitmapControl

Code: Select all

GetGUI()->GetControl(plus_over)->Hide(false);
int positionX = start_add_plus_x + (value * 45);
int positionY = start_add_plus_y;
IRECT target = IRECT(positionX, positionY, 40, 25);
GetGUI()->GetControl(plus_over)->SetTargetArea(target);
GetGUI()->GetControl(plus_over)->Redraw();
I don't know why, but setting the target area to the new value, doesn't work, my plus_over IBitmapControl always stay there, any advice?
Last edited by clau_ste on Sat Jan 21, 2017 7:51 pm, edited 1 time in total.

Post

If I understand correctly, you want to move the control to a different physical location, right? You're only changing the target rect, the mTargetRect field of the control—note that the comment for GetTargetRECT is "The mouse target area (default = draw area)". If you look in Control.cpp, you'll see that controls are drawn based on the mRect field. There is no "set" accessor, but you should really create a moveable/changeable control anyway. For instance, you might make a new subclass of a control and perhaps add a SetLocation method that you can pass the top-left point of the control, and have the method adjust the mRect and mTargetRect accordingly and redraw.
My audio DSP blog: earlevel.com

Post

Yes, you have understanded correcly what i want to do.

I did the new subclass extending IBitmapControl, then i added the setPosition(int x, int y) method, but how can i call this method?

I need to cast this into a OverElement (the class i created) object

Code: Select all

GetGUI()->GetControl(plus_over)->?;
plus_over int was this:

Code: Select all

plus_over = pGraphics->AttachControl(new OverElement(this, positionX, positionY, &bitmapOver));

Post

Since plus_over is the control index, you can use IGraphics::GetControl to get a pointer to your OverElement control, and call ->YourMoveMethod. (Equivalently, you could save the control pointer when you create it, and skip the GetControl step.)
My audio DSP blog: earlevel.com

Post

But there's no method when i write "GetGUI()->GetControl(plus_over)->SetPosition(x, y);

Post Reply

Return to “DSP and Plugin Development”