Jump to content

Setting menubar colour


Recommended Posts

So I remember investigating a few things with this menu bar at one time.  My goal was to just remove the menu bar all together, without using VI Server.  If your window implements the menu bar using some kind of standard Windows menu bar then this is relatively trivial, and using the GetMenu on user32.dll returns a reference to the menu, and SetMenu sets the menu.

 

The problem I've found is that LabVIEW implements menus not as a standard menu bar, and using this Get and Set don't work as expected.  I show an example of how to insert notepad in a front panel window here, and I can remove and add the menu bar using this DLL calls. (here is the post with source)

 

My point in all of this is, if you found a way to change the color of a LabVIEW menu bar using OS calls, I'd be very interested in it.  In my investigations I couldn't find a way to easily remove the LabVIEW menubar, let alone change any of its properties.

 

Oh and the color probably comes from the theme applied in Windows, so if you are able to change all menu bar colors then that could be tried.

  • Like 1
Link to comment

Hi All,

 

Does anybody know how to set the menubar colour in an application? I have done some digging and it seems this is possible using the windows API, just wondering if LabVIEW had some way to do this natively? (I doubt it, just thought I would ask).

 

What Hooovahh already said. Windows APIs meant to work for menus specifically, won't work for LabVIEW menus since LabVIEW renders and handles its menus itself, not by using Windows menu infrastructure. As far as Windows is concerned the menu area in a LabVIEW window is simply normal client area.

Link to comment

Thanks guys, I did not know about the menu being non-standard.

 

Do you think there may be some way in via the Qt DLL?

 

Actually, there is pretty much zero % chance I am going to have time to explore that. Will just have to live with it for now.

 

Don't think so. While it seems that LabVIEW does for some things use the QT framework somehow, that is almost certainly not going to be the case for any standard window features like menus, scrollbars and its controls. These originate all from way before LabVIEW 8.0 or so where some QT DLL mysteriously appeared in the LabVIEW directory.

 

LabVIEW draws its controls, menus and most anything including the scrollbars itself in an attempt to provide a multiplattform experience that looks and behaves everywhere as much as possible the same. One of the only things where it relays heavily on the platform itself are fonts.

Link to comment

LabVIEW draws its controls, menus and most anything including the scrollbars itself in an attempt to provide a multiplattform experience that looks and behaves everywhere as much as possible the same. One of the only things where it relays heavily on the platform itself are fonts.

 

Do you know if LabVIEW do this for OS X menubars too? These are meant to be attached to the top of the screen, not to the application window itself (even some Linux distros follow this style).

Link to comment

Do you know if LabVIEW do this for OS X menubars too? These are meant to be attached to the top of the screen, not to the application window itself (even some Linux distros follow this style).

 

I can't say for sure, but at least under MacOS Classic LabVIEW used indead the standard OS menu. However at least the 64 Bit version of LabVIEW for MacOSX had to undergo a serious rewrite since Apple discontinued most of the Carbon APIs for 64 bit applications. Everything UI related and many more things most likely got moved to use the Quartz and Cocoa API rather than the Carbon API. So during that rewrite many things could have changed completely. But it is quite probable that they did not redraw the menu themselves since it is really part of the OS and not part of the individual window.

Link to comment
  • 2 weeks later...

I did not know that was possible, cool. However that sounds like a lot of work for a LabVIEW programmer  :rolleyes:

 

Yes it is. It's not just a few Windows API calls to create a menu and set it as the windows menu but you also need to somehow hook the Windows message queue and intercept the according WM_COMMAND messages and handle them somehow either directly or by redirecting them as user event to an event structure. Not impossible to do but I don't see how this could be easily made into a reusable library.

 

Also there is the potential that your menu command IDs might conflict with command IDs that LabVIEW is using itself and that would mess up the whole pretty good. Not sure LabVIEW is even using the WM_COMAMND messages at all, since it doesn't really use Windows menus but there is still a change that it somewhere somehow does use them for some reasons.

Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.