top of page

Customize Your Title Bar!

A LabVIEW front panel title bar is not what you'd call "open." You can modify its text through the VI Properties—you can make it visible or not, but when you do, it will automatically look exactly like the standard title bar you chose for your OS. Here are two tips to customize your title bar.

Change the window icon anytime you want

It's only logical to believe the title bar icon should be the same as the owning application icon—it helps to instantly recognize which window belongs to which process. However, in some cases it can be nice to change the window icon, for a settings window or an emergency dialog box for example.

LabVIEW does not offer an API to tweak this, but Windows does, through Windows Messages. Windows Messages is a very low-level and powerful way to access any windows' properties, or interact with them (iIf you want to read more about them, right here is a good place to start.) Basically, I only use them when I can't figure out another way to do something. So this subVI sends a message to a window (found by its name) and tells it to use whatever icon or image you would like. Make sure the VI is opened when the subVI runs.

Make your own title bar!

Take a quick look at these famous software apps: Chrome, the Office suite, Spotify, Visual Studio... they all replaced or removed the title bar. As cool as it looks, removing a front panel title bar can have a huge impact on the usability: no more closing, resizing, or moving the window! While resizing is not always needed, closing and moving are an essential.

If you know about splitters and panes (if you don't, go read my first blog post), there is something you can do: turn a pane into a title bar! Create a header pane (and more panes inside it if you want). You can easily add a button that replaces the native Close Window red cross, and write the appropriate code in an event structure to respond to its click.

Moving the window is more complicated. Moving a graphical object is a {Mouse Down+Mouse Move+Mouse Up} combo. That would require a long time to code every time you need it. Instead, you can encapsulate it in a drop-in VI.

A drop-in VI is a subVI that can alter the behavior of its calling VI with minimal programming efforts, simply by dropping it on the block diagram, with very limited terminal wiring, and usually placed in parallel of all your code. This behavior is triggered using events happening on the front panel. It uses the Register Event Callback primitive to register to these events. In our case, these events will be the three mouse events mentioned earlier, applied to the top pane (the one with the My Frameless App text). We can now close our front panel, and move our window.

Oh, wait, please make sure you previously removed the native title bar and the window frame! This comes with two options in the VI Properties>Window Appearance dialog box.

Do it only once the above workaround runs properly to avoid bad situations ;-)

bottom of page