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

    How to Change DialogBox Title?

    In my program i am invoking the same dialogbox for four different Items. So depending on the
    item i want to change the Title . how can i do it?


  2. #2
    Join Date
    May 1999
    Location
    Atlanta, GA, USA
    Posts
    443

    Re: How to Change DialogBox Title?

    Hi.

    this->SetWindowText("Your Title");
    Or we can omit this.
    So, SetWindowText("Your Title");

    Hope for help.
    -Masaaki Onishi-


  3. #3
    Join Date
    Apr 1999
    Posts
    3

    Re: How to Change DialogBox Title?

    the dialogbox is invoked from Mainframe.
    so i can't use this->.
    void CMainFrame::OnChangeGroup()
    {
    CSetUpDlg tDlg;
    tDlg.DoModal();

    }

    void CMainFrame::OnChangePhase()
    {
    CSetUpDlg tDlg;
    tDlg.DoModal();

    }
    tDlg.SetWindowText() gives some assertion failure.




  4. #4
    Join Date
    Apr 1999
    Posts
    3

    Re: How to Change DialogBox Title?

    i got it.
    i can do it on OnInitDialog() ;
    thanks for your help.
    Viju


  5. #5
    Join Date
    Apr 1999
    Posts
    1

    Re: How to Change DialogBox Title?

    In that case do the following procedure.
    for example, CInvoker is a dialog invoking a InvokedDlg whose title is
    supposed to be changed.

    CInvoker::Test1()
    {
    CInvokedDlg InvokedDlg;

    // key position before DoModal()
    InvokedDlg.GetTitle("Title that I want to change");

    if(InvokerDlg.DoModal() == IDOK)
    {
    ...
    }
    }
    -----------------
    class CInvokedDlg : public CDialog
    {
    ...
    private:
    CString m_pTitle;
    ...
    }


    CInvokedDlg::CInvokedDlg(Wnd* pParent.....) // constructer
    {
    // insert the following line.
    m_pTitle = _T("");
    }

    void CInvokedDlg::GetTitle(CString szTitle)
    {
    m_pTitle = szTitle;
    }

    BOOL CAlertDlg::OnInitDialog()
    {
    CDialog::OnInitDialog();

    SetWindowText(m_pTitle); // insert to change the title

    return TRUE; // return TRUE unless you set the focus to a control
    // EXCEPTION: OCX Property Pages should return FALSE
    }

    P.S.: 4 hours has passed to know this solution. ^)^


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