Log in

View Full Version : Dynamic Toolbar


rakesh_mahajan
02-14-2006, 08:48 AM
I am creating a dialog based application. I am dynamically attaching a
toolbar to dialog at the bottom.
The problem which I am facing is that the toolbar is showing at the behind
of the "command bar" instead of displaying it above the command bar.

What should be the problem.

I am using following function call to create toolbar:
CreateEx(m_pMainWnd, TBSTYLE_FLAT, WS_CHILD | WS_VISIBLE | CBRS_BOTTOM );



Please help me in solving this problem.
I am using Visual studio 2005 and VC++.



Regards,
Rakesh

Guest979
02-14-2006, 05:41 PM
This is a guess and may not work, but...

Windows Mobile forms/windows/dialogs can be very fussy, and draw incorrectly, if they do not have a menu-bar object attached to them. I recommend attaching a menu bar to every window you create. You don't have to put any menus or menu items in it, and it will not affect the appearance of the form if you don't. The only potential harm I can think of in doing this, besides the slight inconvenience, is that it may slightly increase the size of the resulting application.

rakesh_mahajan
02-15-2006, 08:16 AM
I am trying to attach a menu bar to a dialog box.

I have written following code but menu is not showing on dialog:

CMenu menu;
menu.LoadMenuW(IDR_MENU1);
bool b=SetMenu(&menu);
DrawMenuBar();

What could be the problem?

Regards,
Rakesh

Guest979
02-15-2006, 06:13 PM
Well, it's normal for a menu object to be invisible if it doesn't have any menus or menu items.

I'm a little unclear what you mean by a Dialog-based app. I'm mostly experienced with C# .NETcf on PocketPCs, but in that system, the only thing called a "dialog" is the small pop-up error box that isn't especially interactive - although you can take a Form and have it drawn in a "dialog"-style appearance. What do you mean by dialog?

rakesh_mahajan
02-16-2006, 11:27 AM
I am creating a dialog based application for smart device under VC++ section.

I tried to attach menu to dialog but it's not showing.
I also tried to create command bar using comman_create method and attaching menu using command_insertmenu function but nothing is working.

I am using Visual studio 2005 and using pocket PC 2003 SE square Emulator.

I am stuck at this please help me in solving the problem.

Thanks,

Rakesh

Guest979
02-16-2006, 05:40 PM
Well, like I said, it is normal for a menu bar to have minimal visible appearance if it doesn't have any associated menus or menu items. Are you saying that attaching the menu object doesn't help with the toolbar either?

Since you said the original problem is that the toolbar is appearing in the wrong place, have you tried just altering the dimensions of the dialog itself?

Isn't Visual Studio 2005 VC++ based on .NET? I'm sure it supports .NET, but I'm not sure if that is the only option. Your code doesn't look like normal .NET to me - in fact, with .NET and .NETcf, you can usually just use the graphic designer to draw the features you want rather than creating everything in code, although creating the code does work if you need it (actually, the drawing environment just generates the code for you).