Switching tabs in GUI (SOLVED)

I would like to create a GUI like that:

I’m trying to utilize Gooey and Monarch, and tried to create a main “pause” gui which has the buttons representing the tabs and also an exit button. Then, on the top of that there could be a popup for current tab - like on the image, there is some inventory gui below tabs.

The problem is, when I monarch.show(hash("inventory") the “pause” gui below loses its input focus and I can’t click on other buttons nor exit button.

I can create each gui with the tabs above, and paste a code handling those buttons in each of those gui, but that’s not an elegant solution. I do want to have a one gui with background and tabs buttons and exit button below each gui representing inventory, quest log, etc.

What do you think would be better approach? :slight_smile:

Ah, interesting problem! I guess the “pause” gui could maybe reacquire input focus after you navigate to one of the sub-screens. A bit hackish maybe…

Or maybe I could add an option to Monarch that allows you to flag a screen to keep focus when navigating to the next screen.

1 Like

That would be great! :smiley:

That is a good solution too, I will try it!

Also, if it comes to Monarch - the “Timestep Below Popup” was always confusing for me, because I would like to have different timesteps below different popups, so I was always thinking that this sets the timestep for a screen below the actual popup - for example: I don’t want the time to be stopped when being in “dialog” popup, but would like to stop time, while being in this “pause menu” popup. So I thought that I would set timestep to 0 below popup called pause and timestep to 1 below popup called dialog, but as you know it works totally different - so, what do you think about my approach?

Actually releasing input focus from “inventory” popup and reacquiring it in “pause” gui is a bad solution, because I cannot then operate with Inventory :smiley: so probably I will end up with one gui containing all the tabs guis and switching their position to the center of the screen when they’re needed and just enabling them and disabling the rest, but that would be a mess in the Editor :confused:

Is it possible to have two guis acquiring input?

Yes. Return true if you consume the input

1 Like

Nesting screens

Sometimes it might be desirable to have a screen that contains one or more sub-screens or children, for instance popups that are used only by that screen. Monarch supports nested screens only when the parent screen is created via a collection factory. If the parent screen is loaded via a collection proxy the sub/child-screens won’t be able to receive any input.

What about that option in Monarch? It seems like it could resolve that particular issue :smiley:

That describes the case where a screen contains other screens and how you can use Monarch to interact with those sub-screens. It doesn’t really solve your case of keeping input active on multiple screens at the same time.

1 Like

@Pawel This has been implemented on a branch. Could you please give it a try?

1 Like

Yes, I will try this today, thank you very much! :wink:

1 Like

I tried, but my entire project wasn’t working and I didn’t know why. I found out, that the Defold-Input has also changed and my code for handling input wasn’t working anymore :confused:

mapper.bind(mapper.KEY_LEFT, 	"left", 	1)

This was not working because there is no more KEY_LEFT in the mapper (in/mapper) :confused:

How to bind it now?

Are you depending upon master.zip? You should never do that. Always depend upon a specific release to prevent problems with library dependencies introducing breaking changes .

As for your specific problem: The constants have been moved to triggers.lua in 2.0.0+.

1 Like

I’m aware of that, but also, when I’m developing I would like to have a newest version. Thanks for the answer! :wink: And thank you very much for the improvement in Monarch - it works as I imagined! :smiley:

Good to hear! Thank you for confirming that it works for you.

1 Like