PDA

View Full Version : Minimize Window programatically?



zuilin
November 2nd, 2020, 05:08
Is it possible to minimize a window programatically?

I can't find any calls to any functions with "minimize" in their names in CoreRPG. How does the radial minimize button do it?

Thanks.

Moon Wizard
November 2nd, 2020, 05:44
The radial menus are built into the client. There is a windowinstance.minimize() API that hasn't been documented yet.

Regards,
JPG

zuilin
November 2nd, 2020, 05:46
The radial menus are built into the client. There is a windowinstance.minimize() API that hasn't been documented yet.

Regards,
JPG

Thanks!

zuilin
November 3rd, 2020, 00:11
Interesting. Yes, .minimize() is there because I can call it on the image window from inside my toolbar. However, I get the error: "Unable to minimize; only top-level windows can be minimized."

I'm executing from a button in the image toolbar like this:


<toolbar_30 name="toolbar_ztrackpad_minimize" insertbefore="ztrackpad_k1">
<anchored to="toolbar_anchor">
<top />
<right parent="" anchor="right" offset="-10" />
</anchored>
<button>
<id>z_minimize</id>
<icon>zlogo</icon>
<tooltipres>z_tooltip_minimize</tooltipres>
</button>
<script>
function onButtonPress(id)
if id == "z_minimize" then
window.minimize();
end
end
</script>
</toolbar_30>



Thoughts?

Moon Wizard
November 3rd, 2020, 01:06
That's correct. The toolbar window is not the top level window. You'll need to traverse to the top level window (i.e. "imagewindow" window class) before you can call .minimize().

Regards,
JPG

zuilin
November 3rd, 2020, 04:12
I'll have to figure that out. Interesting that window.getImage() gives me the image but window.minimize() isn't the window I need. Time to learn about traversing the windows...

zuilin
November 3rd, 2020, 06:17
Got it!


window.parentcontrol.window.minimize()

Voila.