Form Height


#1

Okay, I can use setSize to resize the form for the plugin but it doesn't resize the actual plugin container, the actual plugin window.  How might I approach that?

Thanks.


#2

Try looking at how the demo plugin in the examples folder does it with the ResizableCornerComponent. That's how I've been doing it for plugins. You could probably use the ResizableBorderComponent and ResizableEdgeComponent too. You can use the ComponentBoundsConstrainer to set the resize limits.


#3

Thanks a lot.  I'll look that over.  While I'm here I might as well ask...

Does (or can it using any methodology?)) setSize work on the plugin window container directly (plugin)->setSize or does it only work on the graphic elements from JUCE, the form inside the plugin window container?

I appreciate you guys help.


#4

Yeah... that's not working so well.

The demo plugin has a resize handle and mine doesn't show any, even when I duplicate those code bits, and resizing that one is pretty flaky, the redraws.   Aside from that I want to change the height of the window on button toggle and that's not working either.  So when I click the button I change the bounds and then change the size of the form., but only the internals resize, not the window.

           int a = getHeight();

        if (a < 500)
            {
                resizer->setBounds (1065,535,1065,535);
                              setSize(1065,535);  // all I want to do here is change the plugin window height to 535
            }
        else
            {
               resizer->setBounds (1065,256, 1065, 256);
                    setSize(1065,256l);  all I want to do here is change the plugin window height to 256
            }
 

I suppose after I set the new min/max bounds I need to find a way to make the window believe it's been manually resized?    Or, I can just forget the normal / tall toggle completely and just try to make is manually resizable.  I'll come back to that later but here's what it's doing... only sizing the internal form, not the window.

 


#5

I'm really not sure. Could you send me the project (or just an empty project with the resizing you're trying to do) so I can try to help you figure it out? I'm not sure if I can, but I could sure try. I'll send you my email in a private message if you want to.

So what kind of behavior are you looking for exactly? Could you explain that in a bit more detail? 


#6

Hi Jordan,

The plugin has 16 rows in a grid and when all 16 rows are shown it's pretty big vertically.  What I want to do is toggle the plugin window height with a button, between only showing the first six rows (Kick, Snare, Rim, Hats) and bigger to show all 16 rows when the user also wants to program or edit the rest of the kit (Toms, Cymbals, etc).

So for the most part, unless the user is editing those other parts, not so much the fundamental parts of the kit, he could toggle the plugin GUI window shorter, to 256 pixels instead of the larger height, 535 pixels, and it won't take up so much space.

I thought like with most other languagese there would be a simple command to change the main / parent window height (or width) directly, without going through any hoops.   I know C++ is not like VB or similar other managed languages but what I would do there is Me.Height = X and the parent class form conforms to that.  Here I've spent hours trying to do that very simple thing, change the height of the top level parent window in real time, with no luck.

And obviously, part of that is me not being a C++ coder to start with.

Thanks.

 

 

 

 


#7

You need to call the setSize on the approriate object or objects. It looks like currently only the Component showing the grid is resizing when you call setSize. That would appear to suggest you are calling setSize in the class that is the grid component. You need to also call setSize on the parent component then, or maybe even on the parent of the parent component. But it's difficult to comment properly about these without seeing your whole code...

Your problems are not really about C++ the language. C++ doesn't know anything about plugins or GUI or audio. The problems you are having now are about how things should be dealt with in Juce based code. I am sure horribly difficult to use libraries could also be written with Visual Basic or C#. (I don't imply with that Juce is horribly difficult to use, by the way. :) )

Well, one thing that seems to be tripping you up a bit is that C++ doesn't have first class "properties" on objects like other languages have. C++ only has dumb member variables, assigning to which generally can't cause side effects such as GUI window sizes changing. Because such side effects can't usually be achieved with simple assignment, the member variables are often "hidden" in the class and then they must be read and manipulated with explicit function calls, such getWidth() or setSize(). Have you read the Juce classes documentation...? That should be very helpful in learning what the objects can do and what information you can get out of them...

http://www.juce.com/api/classes.html

The Component class is the crucial one for GUI work. All GUI objects like buttons and labels, as well as top level windows are subclassed from that. So reading the Component documentation is important to understand a lot about how GUI objects work in Juce.


#8

I'm calling setSize from in the pluginEditor .cpp.   Should it be in another class or form to automatically hit the main plugin window?

Thanks.


#9

Sorry, I can't say based on the information available so far. The code file isn't as important as the class from which you are making the calls. (One set of .h/.cpp files can have multiple classes in them.)


#10

Source Code Link:   http://theaudiocave.com/devstuff/code.zip


#11

Well for simple resizing from a button click, I just called setSize() (from within the AudioProcessorEditor) in the buttonClicked() function. For a simple resizing between two szes, I just used a Boolean to keep track of the "button state" to where the next click would be a different size. So something like this would work for switching between two sizes:

In the private section of PluginEditor.h:

ScopedPointer<TextButton> resizeButton;

// start at initial (smaller) size state (400 x 200)
// first click will trigger the larger size (800 x 400)
bool buttonStateTracker = false; 

In buttonClicked():


    if (resizeButton == buttonThatWasClicked) {
        // Alternate between two sizes each time button is clicked.
        if (buttonStateTracker == true) {
            setSize(400, 200);
            resizeButton->setButtonText("Resize Larger");
            buttonStateTracker = false;
        }
        else if (buttonStateTracker == false) {
            setSize(800, 400);
            resizeButton->setButtonText("Resize Smaller");
            buttonStateTracker = true;
        }
    }

 

I'l take a look at your code and see if I can get it working the way you want. Maybe this little example of how I just tried resizing from a button can help.

 


#12

I am officially an idiot. :)

I just loaded my plugin in Repaer and it resizes the plugin window as I expexct.

I suppose somethiung in Studio One is preventing that from happening.


#13

Lol. That doesn't make you an idiot. I wonder why Studio One won't let you do that. Can you resize windows in Studio One at all?


#14

I think it supports plugins resizing (VST3 anyway) but I can't say that I've actually seen one do that.

At any rate, I appreciate your efforts to help, very cool, thanks a lot.   I'm beginning to think that what I'm doing for my first C++ project may be a bit too ambitious, that maybe I should start without something much easier than a drum sequencer, especially after searching the forum about how to sync it up to the transport and trigger midi notes reliably in real time.

For now, I'll keep trying to send simple midi messages (haven't even figured that out yet after searching for a couple of days) and take baby steps.   I'll keep searching and trying MidiMessage until I stumble on something that actually works.

Thanks Jordan.