CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 7 of 7
  1. #1
    Join Date
    May 1999
    Posts
    9

    Editing the title bar of a dialog box

    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.






  2. #2
    Join Date
    Apr 1999
    Posts
    27,449

    Re: Editing the title bar of a dialog box

    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


  3. #3
    Join Date
    Apr 1999
    Posts
    10

    Re: Editing the title bar of a dialog box

    To change the Title of a dialog box do the following:

    AfxGetMainWnd()->SetWindowText("Testing");

    Hope this helps.

    Chuck Grady


  4. #4
    Join Date
    May 1999
    Posts
    9

    Re: Editing the title bar of a dialog box

    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.


  5. #5
    Join Date
    May 1999
    Posts
    9

    Re: Editing the title bar of a dialog box

    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.


  6. #6
    Join Date
    Apr 1999
    Posts
    27,449

    Re: Editing the title bar of a dialog box

    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


  7. #7
    Join Date
    May 1999
    Posts
    9

    Re: Editing the title bar of a dialog box

    Thanks, I'll give it a try.


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured