How to use the same class for two dialogs? (avoiding IDD clash...)
-
Hi, I am creating a class for a dialog that can be used either in modal or modeless form, and I would like to use them both at the same time in a dialog-based app. The complication is that the modal form and the modeless form use different resources (modal form has an 'OK' and 'Cancel' button, modeless does not) wondering if it's possible to use them in the same application since VS2005 puts the following line in CDialog-derived classes: [code] // Dialog Data enum { IDD = IDD_DX9MATERIAL_DIALOG }; [/code] which seems to tie the class to the dialog, no? Is it not possible to the use the same class for two dialogs? Or should I just create another version of the class for the two types of docs? Thanks - @LRG
-
Hi, I am creating a class for a dialog that can be used either in modal or modeless form, and I would like to use them both at the same time in a dialog-based app. The complication is that the modal form and the modeless form use different resources (modal form has an 'OK' and 'Cancel' button, modeless does not) wondering if it's possible to use them in the same application since VS2005 puts the following line in CDialog-derived classes: [code] // Dialog Data enum { IDD = IDD_DX9MATERIAL_DIALOG }; [/code] which seems to tie the class to the dialog, no? Is it not possible to the use the same class for two dialogs? Or should I just create another version of the class for the two types of docs? Thanks - @LRG
@largeinsd wrote:
which seems to tie the class to the dialog, no?
Yes. It's only source code....feel free to alter it for your own use :) The IDD is used only one place by default - it is passed to the CDialog constructor. With a little modification you can pass whatever resource ID you want to the base class. Another alternative in this case, is to use one resource and show or hide the two buttons depending on if the dialog is used modal or modeless. Mark
Mark Salsbery Microsoft MVP - Visual C++ :java:
-
@largeinsd wrote:
which seems to tie the class to the dialog, no?
Yes. It's only source code....feel free to alter it for your own use :) The IDD is used only one place by default - it is passed to the CDialog constructor. With a little modification you can pass whatever resource ID you want to the base class. Another alternative in this case, is to use one resource and show or hide the two buttons depending on if the dialog is used modal or modeless. Mark
Mark Salsbery Microsoft MVP - Visual C++ :java:
Mark Salsbery wrote:
Another alternative in this case, is to use one resource and show or hide the two buttons depending on if the dialog is used modal or modeless.
Kaboom! That's why you're the MVP... and I'm just glad we're on the same team. :) Thanks Mark, I will implement that.
-
Mark Salsbery wrote:
Another alternative in this case, is to use one resource and show or hide the two buttons depending on if the dialog is used modal or modeless.
Kaboom! That's why you're the MVP... and I'm just glad we're on the same team. :) Thanks Mark, I will implement that.
-
Team MFC/C++! Of course :)
Mark Salsbery Microsoft MVP - Visual C++ :java:
-
Team MFC/C++! Of course :)
Mark Salsbery Microsoft MVP - Visual C++ :java:
Mark Salsbery wrote:
Team MFC/C++!
I thought that you and largeinsd were co-woring on some specific project. ;)
Maxwell Chen
-
Mark Salsbery wrote:
Team MFC/C++!
I thought that you and largeinsd were co-woring on some specific project. ;)
Maxwell Chen
Heh - nah....I took it more as an expression - same thing as "I'm glad we aren't enemies" or "glad we're not working against each other" :) Cheers, Mark
Mark Salsbery Microsoft MVP - Visual C++ :java: