LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

toolbar window style

Is it possible to create MS toolbar style floating windows in LV? They have very thin title bars and float on top.
0 Kudos
Message 1 of 12
(4,448 Views)
You could either:

1. Design your own floating toolbar using a separate VI panel. Open it dynamically and use the WINUTIL32 VIs to set the window/panel to be "always on top". Checkout the LabVIEW GUI book by Dave Ritter. I think I remember it has some examples of this:

http://www.amazon.com/exec/obidos/tg/detail/-/0071364935/qid=1063351460/sr=8-1/ref=sr_8_1/103-3312723-6787838?v=glance&s=books&n=507846

2. Or you could do it all in active-X using Microsofts "cool bar" OCX component. I'm pretty sure its free, too. An easier, but more expensive option is to use the ActiveBar OCX component available from Data Dynamics:

http://www.datadynamics.com/Products/AB/ProductOverview.aspx
http://www.medicollector.com
0 Kudos
Message 2 of 12
(4,442 Views)
Actually, I don't think the MS CoolBar allows floating toolbars. They allow dragging and moving the toolbars, but not detaching into floating toolbars. So that leaves you with a "pure-G" solution using a separate panel, or some other kind of OCX like ActiveBar.
http://www.medicollector.com
0 Kudos
Message 3 of 12
(4,442 Views)
Ok. But if using a subvi, can I still get the thin title bar effect?

Bill F
0 Kudos
Message 4 of 12
(4,442 Views)
The trick would be to use VI Properties to remove the tile bar, the toolbar and the scroolbar. Then you are left with just a grey box for your panel. Then you can add your own thin title bar as an image. I have attached an example.

The only thing that is missing is the ability to move the window. This is tough, but its possible by tracking mouse clicks. You can also implement mouse-over highlighting of the toolbar buttons. Sorry I don't have much more time right now.

See the attached example to get you started. Don't despair! Its possible!
http://www.medicollector.com
0 Kudos
Message 5 of 12
(4,442 Views)
Hi,

You don't have to remove the title bar. You can give it the
"WS_EX_TOOLWINDOW" extended style. This also eliminates the moving
problem...

Regards,

Wiebe.


"John Paul Osborne" wrote in message
news:506500000005000000E6210100-1042324653000@exchange.ni.com...
> The trick would be to use VI Properties to remove the tile bar, the
> toolbar and the scroolbar. Then you are left with just a grey box for
> your panel. Then you can add your own thin title bar as an image. I
> have attached an example.
>
> The only thing that is missing is the ability to move the window.
> This is tough, but its possible by tracking mouse clicks. You can
> also implement mouse-over highlighting of the toolbar buttons. Sorry
> I d
on't have much more time right now.
>
> See the attached example to get you started. Don't despair! Its
> possible!
0 Kudos
Message 6 of 12
(4,442 Views)
Ok. But how do I do that for a LabVIEW window? I cant find anything in properties where that can be set.

Bill F
0 Kudos
Message 7 of 12
(4,442 Views)
Hi,

You'll have to use window API's (assuming you use windows...). The
properties can be changed by e.g. SendMessage. You'll need a hWnd (window
reference) which can be obtained by FindWindow.

Regards,

Wiebe.

"bfarley" wrote in message
news:50650000000500000029220100-1042324653000@exchange.ni.com...
> Ok. But how do I do that for a LabVIEW window? I cant find anything
> in properties where that can be set.
>
> Bill F
0 Kudos
Message 8 of 12
(4,442 Views)
Just in case anyone else is interested, here is a quick class that shows how I did it. Beware - C# code ahead.

using System;
using System.Runtime.InteropServices;

class WinUtil
{
const int GWL_EXSTYLE = -20;
const int WS_EX_TOOLWINDOW = 0x00000080;
const int WS_EX_APPWINDOW = 0x00040000;

[DllImport("user32.dll", EntryPoint="FindWindow")]
static extern IntPtr FindWindowWin32(string className, string windowName);
[DllImport("user32.dll")]
static extern int GetWindowLong(
IntPtr window,
int index);
[DllImport("user32.dll")]
static extern int SetWindowLong(
IntPtr window,
int index,
int value);
public void MakeToolWindow(string WindowName)
{
IntPtr ptr =
FindWindowWin32(null, WindowName);
int windowStyle = GetWindowLong(ptr, GWL_EXSTYLE);
SetWindowLong(ptr, GWL_EXSTYLE, windowStyle | WS_EX_TOOLWINDOW);
}
}
0 Kudos
Message 9 of 12
(4,442 Views)
My solution was 'pure' LV... No external code, exept for the standard API's.

I'll see if I can recreate it. It sure was an interresting vi. Most of the
code is needed to bypass LabVIEW's way of doing things (BTW: this way is
99.9% of the time very welkom...)

Regards,

Wiebe.

"bfarley" wrote in message
news:50650000000500000043230100-1042324653000@exchange.ni.com...
> Just in case anyone else is interested, here is a quick class that
> shows how I did it. Beware - C# code ahead.
>
> using System;
> using System.Runtime.InteropServices;
>
> class WinUtil
> {
> const int GWL_EXSTYLE = -20;
> const int WS_EX_TOOLWINDOW = 0x00000080;
> const int WS_EX_APPWINDOW = 0x00040000;
>
> [D
llImport("user32.dll", EntryPoint="FindWindow")]
> static extern IntPtr FindWindowWin32(string className,
> string windowName);
> [DllImport("user32.dll")]
> static extern int GetWindowLong(
> IntPtr window,
> int index);
> [DllImport("user32.dll")]
> static extern int SetWindowLong(
> IntPtr window,
> int index,
> int value);
> public void MakeToolWindow(string WindowName)
> {
> IntPtr ptr = FindWindowWin32(null, WindowName);
> int windowStyle = GetWindowLong(ptr, GWL_EXSTYLE);
> SetWindowLong(ptr, GWL_EXSTYLE, windowStyle |
> WS_EX_TOOLWINDOW);
> }
> }
0 Kudos
Message 10 of 12
(4,442 Views)