15 мая 2023 года "Исходники.РУ" отмечают своё 23-летие!
Поздравляем всех причастных и неравнодушных с этим событием!
И огромное спасибо всем, кто был и остаётся с нами все эти годы!

Главная Форум Журнал Wiki DRKB Discuz!ML Помощь проекту


CDialogBar SetWindowText fails

Simon Young -- young_simon@jpmorgan.com
Wednesday, November 27, 1996

Environment: NT 3.51,VC++ 4.0

When I do SetWindowText for a CDialogBar just after creating it, the caption 
shows the title I want.

However, when I set it subsequently, the text refuses to change.

Any ideas?

Simon




Dong Chen -- d_chen@ix.netcom.com
Thursday, November 28, 1996

At 06:21 AM 11/27/96, you wrote:
>Environment: NT 3.51,VC++ 4.0
>
>When I do SetWindowText for a CDialogBar just after creating it, the caption 
>shows the title I want.
>
>However, when I set it subsequently, the text refuses to change.
>
>Any ideas?
>
>Simon
>
>
>

I am using VC++ 4.2b under Windows 95. No problem here. I can change the
title by an menu command at any time. And I can change it back and forth
within one function.
In the mainframe file, I have:

	if (!m_wndDlgBar.Create(this, IDD_DIALOG1,
		CBRS_LEFT|CBRS_TOOLTIPS|CBRS_FLYBY, IDD_DIALOG1))
	{
		TRACE0("Failed to create DlgBar\n");
		return -1;      // fail to create
	}
	m_wndDlgBar.SetWindowText("change to this");
                // do sth.
	m_wndDlgBar.SetWindowText("stay here");

And in some menu handler, I have:
void CMainFrame::OnSomethingHappened() 
{
	m_wndDlgBar.SetWindowText("another title");
	
}





Shaju Mathew -- shajum@hpptc51.rose.hp.com
Sunday, December 01, 1996

Did you override PreCreateWindow()??

BOOL CYourDlgBar::PreCreateWindow(CREATESTRUCT& cs)
{
	// TODO: Modify the Window class or styles here by modifying
	//  the CREATESTRUCT cs
	cs.style &= ~FWS_ADDTOTITLE;//Overridden so that we can set the title
...etc...
	return CDialogBar::PreCreateWindow(cs);
}
> 
> Environment: NT 3.51,VC++ 4.0
> 
> When I do SetWindowText for a CDialogBar just after creating it, the caption 
> shows the title I want.
> 
> However, when I set it subsequently, the text refuses to change.
> 
> Any ideas?
> 
> Simon
> 
> 
PS: You'll have to manually do this since ClassWiz's not THAT smart..
Good luck

--
***********************************************************************
                              .---.         .---.
Shaju Mathew                 /" "  \  WWW  /  " "\    Off:(916)785-9018 
Performance Technology  Lab / / ""  \(*|*)/  "" \ \ 
Hewlett-Packard Company    //////   '. V .`   \\\\\\ Home:(916)722-4576
8000, Foothills Blvd      //// / // : """ : \\ \ \\\\
MS 5723, Roseville       // /   /  /`.""" '\  \   \ \\Fax:(916)785-1264
CA 95747-5723           //          //.".\\          \\
                     ------------- -UU---UU---------------
Shaju_Mathew@hp.com                '//|||\\`
                                     '' ``     
***********************************************************************



Simon Young -- young_simon@jpmorgan.com
Wednesday, December 04, 1996

>Did you override PreCreateWindow()??
>
>BOOL CYourDlgBar::PreCreateWindow(CREATESTRUCT& cs)
>{
> // TODO: Modify the Window class or styles here by modifying
> //  the CREATESTRUCT cs
> cs.style &= ~FWS_ADDTOTITLE;//Overridden so that we can set the title
>...etc...
> return CDialogBar::PreCreateWindow(cs);
>}
>> 
>> Environment: NT 3.51,VC++ 4.0
>> 
>> When I do SetWindowText for a CDialogBar just after creating it, the caption 
>> shows the title I want.
>> 
>> However, when I set it subsequently, the text refuses to change.

I tried that. I even tried OR'ing the FWS_ADDTOTITLE in rather than AND'ing it 
out :-)

It still doesn't work.

Simon




Kostya Sebov -- sebov@is.kiev.ua
Monday, December 09, 1996

>   >Did you override PreCreateWindow()??
>   >
>   >BOOL CYourDlgBar::PreCreateWindow(CREATESTRUCT& cs)
>   >{
>   > // TODO: Modify the Window class or styles here by modifying
>   > //  the CREATESTRUCT cs
>   > cs.style &= ~FWS_ADDTOTITLE;//Overridden so that we can set the title
>   >...etc...
>   > return CDialogBar::PreCreateWindow(cs);
>   >}
>   >>
>   >> Environment: NT 3.51,VC++ 4.0
>   >>
>   >> When I do SetWindowText for a CDialogBar just after creating it, the caption
>   >> shows the title I want.
>   >>
>   >> However, when I set it subsequently, the text refuses to change.
>
>   I tried that. I even tried OR'ing the FWS_ADDTOTITLE in rather than AND'ing it
>   out :-)
>
>   It still doesn't work.
>
>   Simon
>
>
Just an idea... Try:

pYourDialogBar->GetParentFrame()->SetWindowText( _T("The caption you prefer"));

The thing is that usually floating control bars are embedded in the CMiniDockFrame
(or something like this) and that's the frame caption that carries the title.

HTH


--- 
Kostya Sebov. 
----------------------------------------------------------------------------
Tel: (38 044) 266-6387 | Fax: (38 044) 266-6195 | E-mail: sebov@is.kiev.ua




| Вернуться в корень Архива |