Languages

Menu
Sites
Language
Header in the Application

I have created an EMPTY application and want to add a form and header to it. I know there is a form based style that I can make and attach a header to it using the UI builder. But I want to construct the header without using the UI builder. I have the code inside the OnAppInitializing.

Hello* pAddSubFrame = new Hello;
    pAddSubFrame->Construct();
    pAddSubFrame->SetName(L"Hello");
    AddFrame(*pAddSubFrame);

//Create an instance of the form and attach it to the frame
    Form *pform = new Form();
    pform->Construct(FORM STYLE NORMAL | FORM_STYLE_HEADER);
    pAddSubFrame->AddControl(pform);

     // Adds a header
    Header* pHeader = GetHeader();
    pHeader->SetStyle(HEADER_STYLE_TITLE);
    pHeader->SetTitleText(L"Hello");

However my application closes unexpectedly saying that the Header has not been constructed. I think that using the statement pform->Construct(FORM_STYLE_HEADER) should construct the header. Is there anything I am missing?

Thanks,

Raju Khanal

Responses

2 Replies
Sergey Khasanov

Did you mean 

Header* pHeader = pform->GetHeader();

or i misunderstood something?

Levan Gogohia

You must init header in the functiont OnInitialize()