Jump to content

Floating toolframe style (?) window


mje

Recommended Posts

Is it possible to set a front panel VI to have a "toolbox" style window frame (the real name for this style has long escaped me). The one with a tiny frame, and a small "X" in the corner etc. Like this:

post-11742-0-93979100-1299793373_thumb.p

You see frame styles like that all the time for floating windows. There a way to do this in LabVIEW?

Link to comment

Heh, thought I might have to bust out the Win32 calls again. I guess at this point there's no LabVIEW way of doing it.

Indeed, that's exactly what I wanted to do, thanks for the code. I like how you reset the original style when the VI returns. Also the hiding, and re-displaying of the window is a nice touch, I take it to force a redraw?

Link to comment
  1. I believe the term you're looking for is "modeless".
  2. I haven't looked at the code, but can't you simply do this by changing the VI's display options to be floating and removing the minimizing and resizing options? That shouldn't require any code.

Link to comment

Nope. In that case the window still has the large frame. Though the settings you describe get everything else done (no appearance in the task bar, fixed size, always on top). So at this point, LabVIEW gets all the functionality right, its really only about delivering an aesthetic consistent with standard user interface design.

I'll also add that while the code above works, and I have implemented it successfully in one case, I have another VI where it does not work. The call to set the extended style generates an exception each time. Have yet to figure out why.

Link to comment

Hello i think this might do a trick (see attachment). Is this what you are looking for?

Toolbar.vi

Something must be bad with this VI as it crashes on my system. Win XP SP3 fully updated. LabVIEW 2010. The third parameter of SetWindowLongA is a DWORD and that is an unsigned 32 bit value, not a signed 64bit value.

And there is a strange line under the title bar where the background shines through.

post-349-0-33113000-1300069295_thumb.png

Link to comment

Good catch. Truth be told I never executed the attached code, I just saw the Win32 calls and adapted it to my use case.

Passing a 64 bit value in place of a 32 bit one would produce at best a crash or exception. The weirdness you're seeing might be the result of stomping over memory which corrupted the display state.

Link to comment

Good catch. Truth be told I never executed the attached code, I just saw the Win32 calls and adapted it to my use case.

Passing a 64 bit value in place of a 32 bit one would produce at best a crash or exception. The weirdness you're seeing might be the result of stomping over memory which corrupted the display state.

No no. I fixed the mismatch of course. Without the fix I get error 1097 from the CLN which is logical since there is an exception that gets catched by the CLN wrapper in LabVIEW.

Without fix it won't even work correctly. With fix I get the weird look, although maybe it's a Win XP quirk or something.

Link to comment

Hello,

At the beginning sorry for my mistake. I run the VI on LV2009 and it did not return error so I overlooked the wrong data type.

Regarding the strange look of the window. I have the same configuration: Win XP SP3 and under LV2010 I get a proper look of the window.

The corrected and, this time, commented code is in the attachment.

Toolbar Window.vi

Link to comment

Seeing that one version works and one doesn't and one major difference is the change from the "Run in UI Thread" to "Run in Any Thread". I don't understand why that would make the difference?

Hello,

The change that fixed the problem is changing the parameter of 'GetWindowLongA' and 'SetWindowLongA' from I64 to U32.

Regarding the background shining through I did not encounter that issue on my machine.

Link to comment
  • 5 months later...

I noticed that as part of the solution you used the FP.NativeWindow. Is that one of those super secret properties? cause I can't find it anywhere in the listing.

I hadn't noticed the code even used that (I've always manually done a FindWindow() call to get the HWND), but yeah, that's one of the super secret properties.

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.