Solved

Help! How to change the tilebar of a CFormView?

Posted on 2000-02-25
4
269 Views
Last Modified: 2013-11-20
Hi,

I want to change the title of a CFormView,i used SetWindowText, but it does not work. any one knows how to do it?

Thanks  a lot!
0
Comment
Question by:greenbird
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
4 Comments
 
LVL 3

Expert Comment

by:akalmani
ID: 2560396
HI !!
  In OnInitialUpdate() use that SetWindowText("ajfk"); or else get the pointer to CFormView whenever u want to change the title use that pointer and call SetWindowText("kladf");
 
0
 
LVL 8

Accepted Solution

by:
VinExpert earned 5 total points
ID: 2560477
Hi,

I consider that U have 2 child views. Forst one is CFirstView and second one is CSecondView. Ur App class is CMyApp. Now follow the steps.

1. Hava a variable in the app class .h file to know witch child R U opening say
int m_iChildNo; which will be initialised to 0 in the app class consructor.

2. Then in the OnInitialUpdate function of first view access that variable using and as
CMyApp *pApp = (CMyApp *)AfxGetApp();
pApp->m_iChildNo = 1;

3. Then in the OnInitialUpdate function of second view access that variable using and as
CMyApp *pApp = (CMyApp *)AfxGetApp();
pApp->m_iChildNo = 2;

4. Map the SetTitle() function to the CMyDoc class and change it as
void CMyDoc::SetTitle(LPCTSTR lpszTitle)
{
CMyApp *pApp = (CMyApp *)AfxGetApp();
      
switch(pApp->m_iChildNo)
{
case 1:    //First view title
      lpszTitle = "Green";
                break;
case 2:      //Second view
                lpszTitle = "Bird";
                break;
}
CDocument::SetTitle(lpszTitle);
}

Thats it. It will work.

Hope this helps U.
VinExpert
0
 

Author Comment

by:greenbird
ID: 2560567
Hi,

thanks for all the help u had given. i will try it out later, if i got any problem, will come again :)

thanks a lot! and wish u a happy weekend!
0
 

Author Comment

by:greenbird
ID: 2567721
Hi,

hmmm it does not work... the title bar of the CFormView is still: untitled - myapp.... how come?
thanks!
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
isEverywhere  challenge 19 91
tripleUp challenge 7 97
pre4 challenge 19 116
wordappend challenge 8 249
Introduction: Hints for the grid button.  Nested classes, templated collections.  Squash that darned bug! Continuing from the sixth article about sudoku.   Open the project in visual studio. First we will finish with the SUD_SETVALUE messa…
Have you tried to learn about Unicode, UTF-8, and multibyte text encoding and all the articles are just too "academic" or too technical? This article aims to make the whole topic easy for just about anyone to understand.
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.

752 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question