Interesting Dialog problem
-
I have a program which will generate Images of different objects on the screen.If you choose a menu item (RSC,Folder for example) you are promted to enter a few parametrs related to the object.(Length,Width,Depth and flute) Since all of the objects need the same info I want to use one single dialog.However Each object manipulates the info in different ways..With a single dialog and hence a single "Render" button how can I determine Which object the dialog was called for in my OnRender Function...Is what Im trying to do possible???It has to be this is C++ :o). Any suggestions or hints would be greatly appreciated... Thanks for the time J.Prisco
-
I have a program which will generate Images of different objects on the screen.If you choose a menu item (RSC,Folder for example) you are promted to enter a few parametrs related to the object.(Length,Width,Depth and flute) Since all of the objects need the same info I want to use one single dialog.However Each object manipulates the info in different ways..With a single dialog and hence a single "Render" button how can I determine Which object the dialog was called for in my OnRender Function...Is what Im trying to do possible???It has to be this is C++ :o). Any suggestions or hints would be greatly appreciated... Thanks for the time J.Prisco
Make a base class for all the objects. Put a member variable in it to represent the current ype. Make an enumeration for all your types. Derive all your 'object' classes from this base type. Use the value of the 'type' data item to let your OnRender code know what was selected. The diaog can also use that 'type' variable to know what controls to display to user, or else how to limit the data ranges where user might be entering numbers. You could do the saem thing with C structures, always make the first element of the object structures this type. Then if you have a pointer to some of this memory, you can cast the pointer to this 'type' variable and access the data structure's object type.
-
Make a base class for all the objects. Put a member variable in it to represent the current ype. Make an enumeration for all your types. Derive all your 'object' classes from this base type. Use the value of the 'type' data item to let your OnRender code know what was selected. The diaog can also use that 'type' variable to know what controls to display to user, or else how to limit the data ranges where user might be entering numbers. You could do the saem thing with C structures, always make the first element of the object structures this type. Then if you have a pointer to some of this memory, you can cast the pointer to this 'type' variable and access the data structure's object type.
-
I have a program which will generate Images of different objects on the screen.If you choose a menu item (RSC,Folder for example) you are promted to enter a few parametrs related to the object.(Length,Width,Depth and flute) Since all of the objects need the same info I want to use one single dialog.However Each object manipulates the info in different ways..With a single dialog and hence a single "Render" button how can I determine Which object the dialog was called for in my OnRender Function...Is what Im trying to do possible???It has to be this is C++ :o). Any suggestions or hints would be greatly appreciated... Thanks for the time J.Prisco
I assume that you have one menu item for each object that you want to display. I also assume that each kind of display object is being abstracted as a class and all these classes have a common base class. In the menu handler for each of these menu items, you would probably instantiate an object of the dialog class and call its DoModal(). You can pass a 'C++ object' of the appropriate object to be displayed to the dialog's constructor. In the dialog's OnRender() method, you can call the Render() method of these objects, provided the Render() method of the base class is virtual.
-
I assume that you have one menu item for each object that you want to display. I also assume that each kind of display object is being abstracted as a class and all these classes have a common base class. In the menu handler for each of these menu items, you would probably instantiate an object of the dialog class and call its DoModal(). You can pass a 'C++ object' of the appropriate object to be displayed to the dialog's constructor. In the dialog's OnRender() method, you can call the Render() method of these objects, provided the Render() method of the base class is virtual.
Well I made my initial post when I first discovered the problem .At my fist observation it really seemed to be quite a problem..After a little though I figured a way to do what I needed but in fact What I was planning wasnt even necisarry at all.Once I began coding the app I found the problem was no problem at all...For each menu item handler I use DoModal and upon its return I assign the corresponding objects variables...Although a little inneficient it works just fine.. Thanks for the help I really appreciate all the help I can get and Ill probably need more help with this app which is probably a little too ambitious for me at this point.