[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

RE: Keeping Track of More Than One Window in an App



>
>Sean Nichols wrote:
>> 
>>    I have an app that I'm developing that consists of a number of windows
>> spun off a main window (which contains little more than a menubar and
>> toolbar). Unfortunately, I am having a bit of trouble getting the various
>> windows to talk to one another. As an example of what I'm talking about,
>> consider the following situation, which is one of the ones I've run up
>> against.
>> 
>
>My answer to this problem is to use a linked list of structs, each of which
>contains a pointer to a single window. The best thing about this
>is that no one window has to be the 'base' window, and I can happily close
>windows at random without the risk of closing the whole application. I've
>used this principle successfully with a 'file manager' like utility (it's
>actually a port of moxfm - the Motif version of xfm - to GTK+).
>
>If I needed a parent window, which had menu items referring to each child
>window, I would dynamically add a menuitem for each child window as it
>is created.
>
>Hope this helps,
>
>Chris
>-- 
>           Yahoo! UK
>email: chrisw@uk.yahoo-inc.com
>phone: +44 (0)171 664 0447
>pager: chris_wareham
>


Well... it does and it doesn't.

   You slightly misunderstood the bit about the base struct. base isn't
actually a window at all, but just a struct to hold the "real" windows...
which means that I actually don't have the problem of mistakenly closing the
whole app like that. In my particular case, I also don't have to worry about
dynamically adding windows, so that's not an issue either.

   But anyway, aside from that one difference (base struct as opposed to
linked list), the solutions sound like they're pretty much the same. Which
doesn't help my primary problem, in that I'm carrying this huge global
dataset around, which I don't like. But it does seem as if this is a
more-or-less "standard" way of doing things.

   Well... thanks anyway.

   If anyone else has another way of doing it, I'd love to hear about it!
      - Sean



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]