Modal Windows

For help with anything that CEGUI doesn't offer straight out-of-the-box, e.g.:
- Implementation of new features, such as new Core classes, widgets, WindowRenderers, etc. ...
- Modification of any existing features for specific purposes
- Integration of CEGUI in new engines or frameworks and writing of new plugins (Renderer, Parser, ...) or modules

Moderators: CEGUI MVP, CEGUI Team

User avatar
spannerman
Home away from home
Home away from home
Posts: 330
Joined: Wed Jan 12, 2005 12:06

Modal Windows

Postby spannerman » Tue Dec 06, 2005 01:54

Hola,

Ive discovered the setModalState function, and I think that this could be quite useful if it is what I think it is. But what exactly is it? :P

The comments say that if I pass true in as an argument when calling this function on a window then "this Window will be activated and set as the modal target."
Ive done just this as a quick test, but it doesnt seem to do anything. I think my understanding of a modal window in this context is not quite right: if a window is modal, then only this window will be active i.e. continue to receive events, and all other windows in the system will be inactive. Am I on the wrong track here?

User avatar
lindquist
CEGUI Team (Retired)
Posts: 770
Joined: Mon Jan 24, 2005 21:20
Location: Copenhagen, Denmark

Re: Modal Windows

Postby lindquist » Tue Dec 06, 2005 07:05

Setting a window's modal state to 'true' should ensure that only this window and it's children will be able to receive input events.

It can be used to create dialogs that require input before allowing use of the rest of the gui again etc..

User avatar
spannerman
Home away from home
Home away from home
Posts: 330
Joined: Wed Jan 12, 2005 12:06

Re: Modal Windows

Postby spannerman » Thu Dec 08, 2005 13:37

Sorry, lindquist, this question was a waste of time. Going back to my original test I did with this modal window functionaity, I see that it IS actually working :roll:

Dunno why I thoughht it wasnt! Sorry :hammer:

User avatar
Gaal
Not too shy to talk
Not too shy to talk
Posts: 28
Joined: Thu Jul 21, 2005 03:36
Location: Ô Toulouse

Postby Gaal » Sat May 20, 2006 06:08

The "Modal" functionnality works just until another modal window is opened then closed.

Here is the problem I encountered :
First please excuse my English, this is not my mother language!

I have a set of cascading windows making some configuration setting:
Window0 : containing some buttons calling several windows let's say Button1 calling Window11, button2 calling Window12, etc...

Window11 : also containing buttons calling other windows (21, 22, etc...)

All of these windows are set Modal when they are called.

Here is what I noticed :

Firstly: Window0 calls Window11.
Then Window11 calls Window21
So I have such a cascade :

Code: Select all

Window0
   |----Window11  (modal)
           |----Window21 (Modal)

When I close Window21, Window11 is no longer modal !
This is verified by accessing all buttons from Window0 !!! and the worst of that, Window0 can be closed leading to an orphan Window11 that makes the program to crash besause Window0 is not there !

Has anybody already noticed this?
Does anybody have a solution?

Looking forward to hearing good news from you :wink:

Gaal

franckypoune
Just popping in
Just popping in
Posts: 18
Joined: Tue Apr 18, 2006 08:19

Postby franckypoune » Mon Sep 11, 2006 13:10

I also notice this problem.
Someone have a solution for this?
Thanks

User avatar
lindquist
CEGUI Team (Retired)
Posts: 770
Joined: Mon Jan 24, 2005 21:20
Location: Copenhagen, Denmark

Postby lindquist » Mon Sep 11, 2006 13:22

you could implement your own modal stack

franckypoune
Just popping in
Just popping in
Posts: 18
Joined: Tue Apr 18, 2006 08:19

Postby franckypoune » Mon Sep 11, 2006 14:03

That 's to say , i manage a dialog list where when you add a new dialog in it, you set the flag Modal state to true and the previous to false?

nebukadnezzar
Just popping in
Just popping in
Posts: 7
Joined: Sun Jul 09, 2006 10:42
Contact:

Postby nebukadnezzar » Mon Sep 11, 2006 14:42

when you open Window21

call Window11->setModal(false)




and when you close window21

call Window11->setModal(true)

... this should do it i think....

Rackle
CEGUI Team (Retired)
Posts: 534
Joined: Mon Jan 16, 2006 11:59
Location: Montréal

Postby Rackle » Mon Sep 11, 2006 17:02

You could give Dialog System a try; it does more than simply code the ok-cancel-apply behaviors. The dialog portion may provide the functionality you are seeking.

franckypoune
Just popping in
Just popping in
Posts: 18
Joined: Tue Apr 18, 2006 08:19

Postby franckypoune » Mon Sep 11, 2006 20:37

I create a manager (singleton) which manages a list of modal window anf it works fine.

When i add a new window in the list:
the last one in the list lose the modal flag and the new has the modal flag
and when a window is destroyed, this window is removed from the list and set the modal flag to the last window of the list.

Thanks for your help

franckypoune
Just popping in
Just popping in
Posts: 18
Joined: Tue Apr 18, 2006 08:19

Postby franckypoune » Mon Sep 11, 2006 20:46

for dialog box (message box windows like), i create a window which has in its constructor a pointer on a result function.
This function sets data in a structure (argument of the function) when the user clicks on one button (YES, NO, OK ,CANCEL)
The parent of this window tests if the action is finished (tests the data of the structure which contains the action result (OK,NOT_DONE)) when its receives the event RendererStart.
I don't know if i am clear on my explanation, sorry it is late...
And i want to know if it is ok to use this method?


Return to “Modifications / Integrations / Customisations”

Who is online

Users browsing this forum: No registered users and 12 guests