Communication between frames

If you are using wxDev-C++ for your wxWidgets design, please ask your questions here instead of in IDE Related.
Post Reply
Lord Asriel
In need of some credit
In need of some credit
Posts: 6
Joined: Thu Nov 17, 2011 1:28 am

Communication between frames

Post 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).

So...is there any advice on this? Or is "communication" improbable between frames?
jgrzybowski
Earned some good credits
Earned some good credits
Posts: 113
Joined: Sat Sep 24, 2011 9:32 pm
Location: Poland

Re: Communication between frames

Post 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):
YourDialog->Show();
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;
Post Reply