Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

graphic application

Status
Not open for further replies.

Leibnitz

Programmer
Apr 6, 2001
393
0
0
CA
I have created an MFC application for drawing poligons,i have a window which is the main window for the program,i use this window to display the image of the poligons. ( i have created a class to handle the routines for the main window) But before to start drawing a polygon, i use 2 Dialog Boxes to get some information from the user.(the class for the dialog boxes are in a different file) I use the first dialog box the get the type of polygon that the user want to draw( regular polygon, star polygon, star figure) after that that i use a second dialog box to get the number of sides that the polygon should have and some other informations. Now,my problem is once i have finished to get the informations that i needed to draw the polygon,i dont know how to get back to main class so that i can draw the polygons on the main window.
 
Store a pointer to the main class in each of the two dialogs, then just call whatever methods you need to update it from those dialogs.
 
> Store a pointer to the main class in each of the two dialogs, then just call whatever methods you need to update it from those dialogs.

How do i do this? I mean i have two class, "CDrawerApp" and "CDialogClass". "CDrawerApp" is the class where i have the code to draw the polygons. "CDialogClass" is the class where i define my Dialog Boxes. Your method seems interesting but i dont know how applied it.
 
Well your code for drawing the polygons should probably be in a CWnd derived class. I haven't used MFC for a while, but if they aren't, move them to one. When you create the other dialogs, pass the main window as a parameter to the constructor to set it as the parent (I think that's how you do it). Then when something changes in the dialog, cast the parent member to a pointer to whatever your class is, and call its update method.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top