How do you minimize?


#1

I know I saw this somewhre but I can’t find it now…

How does one minimize a JUCE app?


#2

Like this:

[code]void JUCEGUIWindow2::MinButtonPressed()
{
NativeDesktopWindow* const w = getNativeWindow();

if(w->isMinimised())
	w->setMinimised(false);
else
	w->setMinimised(true);

}[/code] :wink: (not sure if you need the w->isMinimised(false) bit)

I’ve been trying to make a standard (ish) window with the usual min, max and close buttons myself, and I just worked out how to use the ResizerComponent (it’s not as simple as I though it would be).

  • Niall.

#3

So should JUCE take care of unminising that app when the user selects it from the task bar?

What is happening currently is that my gui is restoring from minised state incorrectly. I’m just getting a small window in teh top left hand corner.

I can’t find an onMinimiseStateChanged style handler to override, and override a resize handler seems a little hacky.

:?


#4

Is this an app or a VST? Windows takes care of restoring the size, so unless you’re doing something strange, it should work fine.

There is a minimisation state callback in Component, but you shouldn’t use it to change the size.


#5

It’s an app.

http://adam.adbe.org/misc/sampleeditor.zip

I know there is something screwed up somewhere with the windows interfacing 'cos it wont shut down from the taskbar (right click, close) either.

:?

I can’t see what I’ve done wrong[1] but I haven’t got much of a feel for the JUCE way of working yet. :oops:

[1] actually I can’t see at all – f-cking drywall dust[2]. :frowning:

[2] anyone here good with fitting frywall? cos my Joint Tape is bubbling in places and I’ll be buggered if I can see why. It’s driving me freakin mental right now. :evil:


#6

Out of interest, I just tried compiling that…

2 things:

  1. You’re a crazy fool to try writing a sample editor! Work out how long it’ll take you, then quadruple it and add 12 months to get VSTs working…

  2. It minimised/restored fine for me, though I had to mess around to get it to build - when I removed your command-line library references, the -lwinmm etc, and used the browser to choose them instead, it linked ok. So I think you might be linking to some duff function calls from the wrong mingw library.


#7

actually, the version linked above was out of date when I posted it.

I just reuploaded the zip file now with the proper version.


#8

hmmm… I tried it as well, and it restores to a little rectangle in the upper left corner… :shock:


#9

[quote=“jules”]Out of interest, I just tried compiling that…

2 things:

  1. You’re a crazy fool to try writing a sample editor! Work out how long it’ll take you, then quadruple it and add 12 months to get VSTs working…[/quote]

Ya’know, a funny thing that. That’s exactly what my dad told me to expect when rebuilding my studio room. That’s why a month after my planned done date I’m currently covered in gypsum, and just about to make my tenth trip to the hardware store this week for some part I didn’t envisage needing until I start dicking with the electrics…

Seriously, I’m kind of playing this by ear cos I want to see whether this is going to be a one man project (in which case it’ll be more of a practsing my C++ effort). The structure is going to be modular enough that an open source development would work. We’ll see. I’ll be happy with a basic but scriptable sample chopper. Everything else for me is gravy. How much gravy there is depends on how many people join in.

[quote]
2. It minimised/restored fine for me, though I had to mess around to get it to build - when I removed your command-line library references, the -lwinmm etc, and used the browser to choose them instead, it linked ok. So I think you might be linking to some duff function calls from the wrong mingw library.[/quote]

Hmmm, I’ll look into that.


#10

well I tried add the linked files using the browser, but the same thing is happening :?

As mod says, it just restores to a funny small rectangle in the top left.

It is clearly the titlebar area that is showing, so the application is coming back as a window around 200 x 22px


#11

I did get my drywall installed though so the day hasn;t been a total loss. :slight_smile:


#12

Hrm. using the browser causes some errors at times it seems.

Damn dev-C++.

Im with ya valley, Im still figuring out som things and cleaning up after the storm.


#13

the more I think about it, that funny little rectangle is familiar. Basically, the interface is NOT being restored. It’s just making it visible in a minimized state (dunno how to explain that any better). When I wrote tacky, I played around with all kinds of window states (love HWND’s!!)… and that is what T looks like when it’s minimized but visible. Actually, more like minimized into a parent component. You can also see this if you use a windows shell which lacks a taskbar… it just folds into a little rectangle like the one we’re seeing. So the question is, how is the HWND info from windows interpreted by JUCE? Like when you hit restore on the taskbar, it’s gonna post a message to the MyJUCEAppBlah.exe… do we have a means of intercepting those messages? What JUCE functions handle this kinda stuff since it being crossplatform means things are not the same on the ol’ mac?


#14

Ahhhhh…

That’s exactly what it is Mod.

I wasn’t recognising it because it lacked the win32 chrome. It is indeed a fully collapsed window.

Dunno how to uncollapse it, so I’m still looking into Jules’ theory on linked files, but devc++ is giving me a headache (and vc is big download/install).


#15

there is something else weird that I’m noticing too… I reset the size of the main window… and the children didn’t adjust their positions. "Insted they are just cutoff and not there, much like what it looks like with that “little” box. It seems to me as if the children are using the desktop as the parent. and not the main window. Which might explain (tho I don’t know how), why the entire thing is not restoring…

I’m still investigating… :shock:


#16

I dunno whether JUCE automatically resizes components that were created with proportional sizes, but it certainly wont resize components that were created with static sizes (such as in my quick sample editor gui knockup).

You probably need to override a function for size changing and handle resizing the children yourself.

I haven’t looked into size changing yet as the sample editor is going ot be full screen only, like Tracktion.


#17

The weird thing is I’m not trying to resize anythig… I just set up the main window with this…

so I would think when firing it up… the buttons should be in the right place, and they are not. They are not there at all…


#18

basically getParentWidth() is not getting the witdh of the main window… it’s taking the width from the desktop. :shock: and I don’t know why… or am i foolishly not understanding what you are talking about? :help:


#19

I;m not sure I’m following you here. Can you post the code, or even some code fragments?


#20

this…

[code]//==============================================================================
ApplicationMainWindow::ApplicationMainWindow()
: Component (T(“Sample Editor”))
{
addToDesktop(windowAppearsOnTaskbar);
setBounds (0,0,1024,768);
setVisible (true);
// add title bar
addAndMakeVisible(titleBar = new ApplicationTitleBar(), 0);
// add track section
addAndMakeVisible(midSection = new ApplicationMidSection(), 0);
// add control panel
addAndMakeVisible(baseSection = new ApplicationBaseSection(), 0);
}

ApplicationMainWindow::~ApplicationMainWindow()
{
deleteAllChildren();
}[/code]

only change is the setBounds… nothing else has changed… but now the buttons are cut off (not there). My desktop is 1400x1050… it’s as if getParentWidth() used in the the titlebar setBounds reports the desktop as it’s parent and not the mainwindow…