• Welcome to Theos PowerBasic Museum 2017.

News:

Attachments are only available to registered users.
Please register using your full, real name.

Main Menu

CWindow AddStatusBar

Started by John Thompson, January 14, 2012, 12:20:57 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

John Thompson

Hi,

I'm adding a status bar using:


pWindow.AddStatusBar ( pWindow.hWnd, %IDC_STATUSBAR, "StatusBar", 0, 0, 0, 0  )


It shows up so that the very top line is visible at the very bottom, but I have to resize the window (larger) to see it entirely.  Once I do, the StatusBar remains in its position until I click AND drag the sizing grip at which point it resizes to be entirely visible at the bottom of the window.

Unfortunately, if I resize the window again the StatusBar stays in the same place until I click and drag the sizing grip again.

I'd tried adjusting the 0,0,0,0 values to position it myself, but it didn't do anything.

Any advice on having it properly placed, permanently, would be greatly appreciated!

Thanks,

-John

John Thompson

I guess posting is giving me enough luck to find the answer!  Well, in case this helps anyone else in the future:

In %WM_SIZE:

         ' // Gets the handle of the status bar
         LOCAL hStatusBar AS DWORD
         hStatusBar = GetDlgItem(hwnd, %IDC_STATUSBAR)
         ' // Resizes it
         SendMessage hStatusBar, %WM_SIZE, wParam, lParam
         ' // Redraws it
         InvalidateRect hStatusBar, BYVAL %NULL, %TRUE
         EXIT FUNCTION

José Roca

I also forget very often these details. This is why I write many examples: to remember what I have to do. Besides the status bar, toolbars also need to be updated in the WM_SIZE message, e.g. ToolBar_AutoSize GetDlgItem(hWnd, %IDC_TOOLBAR).