How to create an MDI'sh program




I'm pretty bad at explaining problems, so I apologize for my explanation.

I've been working on a sound editor, and have run into some problems.  I
can build the interface just fine.  However, I'm not sure that I'm setting
everything up correctly.

First I'll describe how the program works.  The interface is setup very
similar to the gimp. There is a main toolwindow
which contains things like new, open, open as... etc.  When you click on
new, a window pops up asking for the speed, stereo, etc.  Once you choose
those and click ok, the last window pops up which is the wave editor,
build with a function called buildWaveEditor(......).

My question is, how do I create seperate data for each window?

The user
can open up as many waveEditor windows as they want.  All the same, they
can open up as many "newSound" windows as they want.  The only way I've
seen to find out what item is selected in a list<box> is to set up a
signal handler for selection_changed.  With this, it seems you need to use
global variables (or static to the file) to maintain the status of the
list<boxes>. These get reused over and over again by the handler, even
though there may be 2 or more windows open. How can I keep the variables
that get updated by the handler individual to each window?

An example of the problem is as follows.

Keep in mind the newSound window is made up of 2 listboxes that contain
stereo/mono, and 6khz/8khz...48khz, and 2 buttons (ok/cancel).
I have a signal handler for each list that catches the "selection_changed"
signal.  The signal handler for the OK button prints out the current
status of the stereo/mono box, and the khz box.

I open up 2 newSound windows at the same time.  I change #1 to 22khz, and
#2 to 44khz.  Then I click 'OK' on #1.  It prints out 44khz.  I understand
why it does this, but I want to know how to fix this.

I know I will have the same problem with the waveEditor window.  All
windows will share the same data variables (static to the file). I don't
want this.  I want some way to maintain a seperate set of data with each
window.

Is there an extra member in the widget structure that allows for this,
similar to the SetWindowLong() function of Win32's?

Again, I'm sorry for my problem with explaining problems :)

I can post the source code for the newSound window if necessary so you can
see exactly whats going on.

Dave
lndshark@megsinet.net



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