Valhalla Legends Forums Archive | C/C++ Programming | [problem resolved] Using a static as a container

AuthorMessageTime
JJBot
Hello,

I am working on a program and need it so that when you click a button it will bring up a different container that holds static controls/buttons/etc...

For instance, a person clicks Button A so it makes frame A visible and sets other frames to invisible. The person clicks Button B then it makes frame B visible and so on.

I am currently using a static control as my frame, in which I make buttons/other statics child windows of the static control so I only have to set 1 window to visible/not visible rather than the whole group of windows.

The problem is now how do I set the background color/font of the child windows in the static "frame"? I tried using WM_SETFONT but it only works for windows that are childs of the main window.

So basically the structure is like this:

Main Window ----> Child of Main Window: Frame -----> Child of Frame Window: Label 1

Label 1's backcolor/font won't change but if I make Label 1 a child of Main window it will. But that defeats the whole purpose of having a frame control the visibility of all the other windows in it.

Heres a sample of my code:

[code]
    //GENERATE CONTAINERS
    for(int i = 1; i < 4; i++)frame[i] = CreateWindow("Static", "", WS_CHILD | WS_CLIPSIBLINGS, 3, 200, 790, 350, hwndMain, (HMENU)FRAME_START + (i * 20),hThisInstance, 0);

    //HOST A TABLE FRAME
    HWND dispHost = CreateWindow("Static", "This is the host a table frame", WS_CHILD | WS_CLIPSIBLINGS, 0, 0, 300, 20, frame[1], (HMENU)FRAME_START + 20 + 1,
                hThisInstance, 0);
    SendMessage(dispHost, WM_SETFONT,(WPARAM)font,0);
    ShowWindow(dispHost, 1);
[/code]

Should I be using another method to group the windows? Help is greatly appreciated. Thanks.

Edit: Nvm, problem resolved. Figured out that I had to subclass it.
July 31, 2006, 8:19 PM

Search