Page 1 of 1

A decent way to manage MDI

Posted: Wed Jan 18, 2012 5:41 am
by FragSax
I want to make an app that utilises the MDI gadget for a text editor but I'm having trouble figuring out a way to properly manage the creation of new child windows. Every time I try to the new window looks good but the other windows have their editor gadgets removed. What would I have to do to create a theoretically infinite amount of windows without the need for defining the same number of window numbers.

Re: A decent way to manage MDI

Posted: Wed Jan 18, 2012 11:40 am
by Fred
You can look at the MDIGadget.pb example to see how to manage it. The key is to use #PB_Any as window number.

Re: A decent way to manage MDI

Posted: Wed Jan 18, 2012 7:26 pm
by Demivec
FragSax wrote:I want to make an app that utilises the MDI gadget for a text editor but I'm having trouble figuring out a way to properly manage the creation of new child windows. Every time I try to the new window looks good but the other windows have their editor gadgets removed. What would I have to do to create a theoretically infinite amount of windows without the need for defining the same number of window numbers.
If each of the MDI windows has an editor gadget and the editor gadgets all share the same gadget number (i.e. a constant) then when you create a new window the previous editor gadget will be recreated on the new window. Simply switch the gadget numbers so the gadgets placed on each new MDI gadget have a unique constant or use #PB_Any for each new gadget (and keep track of their numbers).


@Edit: corrected some of the wording so that my response is more incoherent.

Re: A decent way to manage MDI

Posted: Thu Jan 19, 2012 10:53 am
by FragSax
Thanks for the help, it's much appreciated.