Advertisement

ToolBar Woes

Started by June 09, 2000 10:29 PM
4 comments, last by Zimans 24 years, 6 months ago
This is sort of off-topic, but it''s a part of my editor. (Which is one of the most important elements of game development so) I want a toolbar that is positioned on the window but not aligned to the top or bottom. Problem is it refuses to co-operate. I create the toolbar upon the WM_CREATE message of my main window with the CCS_NOPARENTALIGN style, and it gets created fine, problem is when I go to move it (With a MoveWindow (..) call) it dissapears. I know it''s possible because I''ve had non-aligned toolbars in VB programs before.. Most of you here seem pretty talented, so I''m hoping one of you may have some incling as to why this tool-bar refuses to play nice.. Here''s the init code for the toolbar FYI: (Hope this wraps semi-readable) // Create the Project Tool Bar Window.hProjBar = CreateWindowEx (0, TOOLBARCLASSNAME, "Proj Tool Bar", WS_CHILD / WS_VISIBLE / CCS_NOPARENTALIGN, 0, 0, 120, 30, hWnd, (HMENU)IDC_PROJ_BAR, hInstance, NULL ); SendMessage (Window.hProjBar, TB_BUTTONSTRUCTSIZE, sizeof (TBBUTTON), 0); SendMessage (Window.hProjBar, TB_ADDBITMAP, numPBitmaps, (LPARAM)&tbPBitmap); SendMessage (Window.hProjBar, TB_ADDBUTTONS, numPButtons, (LPARAM)&tbPButtons); SendMessage (Window.hProjBar, TB_AUTOSIZE, 0, 0); Thx, Any insight would be greatly appreciated. -Zims
Just a wild guess: Have you tried adding the TBSTYLE_WRAPABLE style?

Advertisement
It''s not that there are too many buttons, it''s just that the damn thing dissapears, and no matter what I do I can''t seem to make it show itself..

I''m new to the whole visual aspect of c programming, I''m learning it as I go. But I just can''t seem to get this toolbar to showup.. I''m beginning to think that toolbars just do not like to be un-aligned from the top or bottom...

-Zims
I think toolbars have to appear at the top or bottom of the window. If you want to create a toolbar that floats around, one way woul be to create a dialog box, load it up with buttons, and create it by making it a modalless dialogbox.

VB makes a lot of things easy. Tooltips are easy in Visual Basic. heck, you can even have ToolTips when you move your mouse over buttons, scrollbars, literally everything. I don''t even know how to do this under win32. So you shouldn''t really compare VB to C. What you do in VB without effort could be hell to implement in C.



========================================================
If something sounds stupid but works, it's not stupid
==========================================In a team, you either lead, follow or GET OUT OF THE WAY.
Well, as far as I know (along with everyone else), the toolbar has to appear on the top or bottom. But an easy way to solve your problem is not using the main HWND as the parent to the toolbar. If you want to use the common dialog of a toolbar rather than make it by yourself, just create a child window as the frame for the toolbar, and create the toolbar in the child window. Then just position the child window wherever you want. This isn''t the best or most efficient way to approach this, but it works.
You have to tell the toolbar to move with the main window when the main
window moves. It doesn''t move by itself. Same thing with statusbars.

This topic is closed to new replies.

Advertisement