Click to See Complete Forum and Search --> : Editing the title bar of a dialog box
Malc
May 4th, 1999, 11:25 AM
The software I am working on manages a set of objects. Each object has a name. A dialog box allows you to change the properties of the object. The name of the object is shown in the title bar of the dialog box. I want to be able to change the name of the object by clicking in the title bar and editing the name directly. Does anyone know whether, and how this can be done?
Many thanks.
Paul McKenzie
May 4th, 1999, 12:17 PM
There isn't a way that I know of to edit the dialog title bar directly as you stated. Unless you're creating an application that allows the user to create their own dialogs (for example, a resource editor), I don't think you need to do what you're trying to do.
As an alternative, how about naming the dialog to "Object Properties", and have an edit field that contains the name of the object? You don't change the name of the dialog, and the object name is changed in an edit field. This is how most property editor dialogs handle this (Check out VC++ when you edit a resource's properties).
Regards,
Paul McKenzie
gradyc
May 4th, 1999, 03:57 PM
To change the Title of a dialog box do the following:
AfxGetMainWnd()->SetWindowText("Testing");
Hope this helps.
Chuck Grady
Malc
May 5th, 1999, 02:21 AM
Thanks for the reply.
Your suggested solution is actually the way we do things at the moment. The problem is that many of the property dialogs are property sheets. The Name edit field is then on just one page of sheet.
I want the user to be able to see the name of the object they are editing no matter what the active property page is. I also want to allow users to change the name in place.
Having thought about it, another solution might be to have the Name field on the property sheet rather than on a page (ie. on the same part of the dialog as the OK and Cancel buttons). I guess this would mean some overrides to CPropertySheet. If you have any thoughts, I'd be very interested in hearing them.
Cheers again.
Malc
May 5th, 1999, 02:24 AM
I actually want users to be able to edit the text in the title bar in order to change the name of the object.
Thank you very much for the reply.
Paul McKenzie
May 5th, 1999, 11:06 AM
You would dynamically create the edit control and place it on an area of the property sheet that is always visible. The control would be a child of the property sheet.
I did this with a combo-box that had to be displayed and could be accessed by the user, regardless of the current page.
Since I'm away from my code, I can't remember 100% when the control is to be created (OnCreate() of the PropertySheet?).
In any event, this is what you need to do.
Regards,
Paul McKenzie
Malc
May 6th, 1999, 02:09 AM
Thanks, I'll give it a try.
codeguru.com
Copyright Internet.com Inc., All Rights Reserved.