Page 1 of 1

Communication between frames

Posted: Thu Nov 17, 2011 1:39 am
by Lord Asriel
Hello everybody. I am very, VERY new to wxwdigets and I've only checked a couple of tutorials.

I have a uni project of making a sparse array. Details are not needed, it just has three functions: insert, delete, and print.

So I thought I'd make a "central" frame with the appropriate three buttons. The insert and delete open frames with text control for input and insert/delete and close keys,
while the print opens a frame with a single static text control, which label is filled by my print function.

I went for frames (and not dialogs) because I hoped I could actualy make them nonmodal and have the print frame/static text control update each time I press the Insert key on the insert frame, or the delete key in the delete frame. Also, I'd like a frame not to be able to have a duplicate of itself (reminds modal, but i dont want to stop the control on the rest of the program).

I failed miserably. EG I tried to make a bool print_frame_exists, which would be set to false as default and each time the print frame is closed, and true when the print frame opens. Couldn't find a place to put it, since I need to call it both from the central frame (for the open) and from the print frame (for the close). there any advice on this? Or is "communication" improbable between frames?

Re: Communication between frames

Posted: Sat Nov 19, 2011 10:30 pm
by jgrzybowski
I am not quite sure if I have understood your problem exactly, but my suggestions are following:
1)"frames (and not dialogs)": wxDialog also can be mode less (non modal):
2)"place to put it": Try to put in YourMainFrame.cpp as a global variable and do not forget declaration in YourPrintFrame.cpp like:
extern bool print_frame_exists;