mje Posted March 10, 2011 Report Share Posted March 10, 2011 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: You see frame styles like that all the time for floating windows. There a way to do this in LabVIEW? Quote Link to comment
GPiotr Posted March 11, 2011 Report Share Posted March 11, 2011 Hello i think this might do a trick (see attachment). Is this what you are looking for? Toolbar.vi Quote Link to comment
mje Posted March 11, 2011 Author Report Share Posted March 11, 2011 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? Quote Link to comment
GPiotr Posted March 11, 2011 Report Share Posted March 11, 2011 Yes, I had to hide and show again the window in order for it to refresh. Sorry for lack of comments in the code. Quote Link to comment
Yair Posted March 12, 2011 Report Share Posted March 12, 2011 I believe the term you're looking for is "modeless". 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. Quote Link to comment
mje Posted March 12, 2011 Author Report Share Posted March 12, 2011 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. Quote Link to comment
Rolf Kalbermatter Posted March 14, 2011 Report Share Posted March 14, 2011 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. Quote Link to comment
mje Posted March 14, 2011 Author Report Share Posted March 14, 2011 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. Quote Link to comment
Rolf Kalbermatter Posted March 14, 2011 Report Share Posted March 14, 2011 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. Quote Link to comment
GPiotr Posted March 16, 2011 Report Share Posted March 16, 2011 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 Quote Link to comment
Wire Warrior Posted March 16, 2011 Report Share Posted March 16, 2011 Hello All, 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? Jason Quote Link to comment
GPiotr Posted March 17, 2011 Report Share Posted March 17, 2011 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. Quote Link to comment
asbo Posted September 15, 2011 Report Share Posted September 15, 2011 To fix the weirdness beneath the title bar, maximize the front panel before setting it back to standard. Toolbar.vi Quote Link to comment
Ryan Podsim Posted September 19, 2011 Report Share Posted September 19, 2011 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. Quote Link to comment
Ravi Beniwal Posted September 19, 2011 Report Share Posted September 19, 2011 It gets better: If you turn off "allow user to resize window" (which you most likely would to make it a toolbar) and host your toolbar VI as a child window in your main UI window, you'll get really thin borders. Check this out! Quote Link to comment
asbo Posted September 20, 2011 Report Share Posted September 20, 2011 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. Quote Link to comment
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.