   [Win32 C++] Advice on Propert Window Coding
  Hi, I have something relatively simple I want to do, but I am not sure where to code it(within another class or seperate).I have a Win32 Custom Control that I made, yes custom controls again :P, & I am making it so that when you right click the control a window pops up called a property window where the user can change the controls background & text colour to something different. The property window is very simple & will just contain 2 statics, 2 edits, & a "Change Attribute" button & a "Cancel" button.If you were making this custom control (that creates this "property window" when its right clicked) how would you do the following?:Quote:- Because this "property window" is really simple do you think it should be "modal dialog" OR should it be its own new class that I register & I give it its own Windows Proceedure function? Would you be able to provide an example how to create a modal dialog so I can place my controls on it(static, edits, buttons). - Should the Custom control handle the "property window" messages or as I said before should the "property window" handle its own message.- Do you think this "property window" should be declared as part of the Custom Control class or should it be a seperate class?- When the user changes the text colour & clicks the "Change Attribute" button; How will I be able to change the Custom Controls background colour? I ask this because if you see my code below the variable for the control's text colour is a private member of a class?// Example of Custom Control#ifndef CC_H#define CC_Hvoid RegisterCustomControl();LRESULT CALLBACK CustomCtrWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam);class CustomControl {  public:    CustomControl();   // When this control is right clicked a window(property window) opens that allows the user to change the    // Controls' background & text colours to a different colour.    // Questions:    //  - Should this "property window" be a registered class or a (modal?) dialog    //  - Do you think this "property window" should be declared & part of the Custom Control class    //    or should it be seperate?    //  - Should the Custom Control's WndProc handle the "property window" msgs or should the    //"property window" have its own WndProc?    //  - When the user changes the text/background colour in the "property window" HOW can I change    //this classes private variables backgroundCol & textCol to those colour values?    void openPropertyDialog();    LRESULT CALLBACK CustomCtrPropertiesWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam);   private:    HBRUSH backgroundCol;    HBRUSH textCol;};#endif[Edited by - gretty on April 21, 2010 12:56:01 AM]
  Well, right clicking on a control normally brings up a context menu. I think you should think about whether the functionality of your property window could be taken care of with a standard context menu because popping up some window with edit controls and so forth when a user right clicks on something is a fairly seriously non-standard thing to do.But, that said, there's been a couple of threads on this board lately about whether to use dialogs or "real windows" for various things. One thing to understand is that there is no difference between the two as far as Win32 is concerned, so there are no right or wrong answers. Use what is convenient for what you want to do.Use a dialog box if you want to lay the thing out with a resource editor or if you want to make it modal. If you're not using resources or want a different kind of modal-ness than what you get from the DialogBox() Win32 call then register a window class, use create window, and write your own DoModal() call. If you want to control what the window contains or how it's laid out dynamically then don't use a dialog box, etc.   