Aristos Queue Posted April 7, 2020 Report Share Posted April 7, 2020 (edited) Does anyone have a picture showing how, given a VI, I can get ... ... the size of the monitor hosting that VI's panel... ... minus the taskbar size (if any) on that monitor... ... in a platform (OS) independent manner? I had a clean-but-annoying way to do this until I discovered that Windows10 has a mode that lets the task bar be replicated onto different monitors (and, worse, those taskbars aren't necessarily the same size). The only trick I can come up with is to maximize the panel momentarily and grab the panel size at that moment, but that creates flicker in the UI. Yes, I am aware of these two properties: They do not suffice. The first one gives all the monitor sizes without accounting for taskbar. The second one only reports taskbar on primary monitor. If I could be sure the taskbar was only ever on the primary monitor, I can figure it out from this info, but discovering taskbars on multiple monitors was an option throws a wrench in that plan. Edited April 7, 2020 by Aristos Queue Quote Link to comment
The Q Posted April 7, 2020 Report Share Posted April 7, 2020 I guess you could do your trick of maximizing momentarily with the transparency at 99% transparent. Open the VI Hidden, change the transparency, maximize, get VI panel size, change back to standard, set size and transparency. 1 Quote Link to comment
LogMAN Posted April 7, 2020 Report Share Posted April 7, 2020 I don't know of a way to do this OS independent. Here is a VI that gets the monitor and workspace area for any monitor, given a screen coordinate. Of course, this only works on Windows. Workspace.vi Quote Link to comment
Aristos Queue Posted April 12, 2020 Author Report Share Posted April 12, 2020 Have it working. @The Q : Darren had the same suggestion you did. Worked just fine. See attached VI, saved in LV 2014. Compute Maximum Desktop Bounds.vi 1 1 Quote Link to comment
hooovahh Posted April 14, 2020 Report Share Posted April 14, 2020 Very neat. So I wanted to update this to return all monitors, and all Windows, and Panel sizes. I also saw that this was using scripting which means it won't be available in the run-time engine. Attached is an updated version that I believe does this. (2018) I also added a feedback node to return the previously read data if it is called again, with an optional input for a full refresh. I did this since I believe changing monitor position and resolutions after and application has started is rare. Still if you do this often you can just wire a True to this. Another option would be to use the Elapse Time, and maybe do a full refresh once every couple of seconds. One thing I also removed was the passing in of a VI reference to get the application instance to use. I wasn't sure why this was being done since regardless of the application instance the monitors and panel bounds will be the same. I realize AQ and Darren often work in private instances, it's just in this case I didn't think it would matter. Please correct me if I'm wrong. I also left in the VI description stating it is thread safe, but am unsure if it still is. Compute Maximum Desktop Bounds Hooovahh Edit.vi 1 Quote Link to comment
hooovahh Posted April 14, 2020 Report Share Posted April 14, 2020 Oh also I found a .Net method of doing this. Using the Systems.Windows.Forms.Screen you can get All Screens, and in a loop get the Working Area of each. Still I prefer the non-OS dependent method posted earlier. Quote Link to comment
Aristos Queue Posted April 15, 2020 Author Report Share Posted April 15, 2020 (edited) 15 hours ago, hooovahh said: One thing I also removed was the passing in of a VI reference to get the application instance to use. That pretty much defeats the purpose of the VI. The whole point of the exercise was to figure out how big to size the VI relative to the monitor so the caller VI could maximally lay out its controls without taking up the whole screen... and if I don't know which monitor it is on, it doesn't work. 🙂 BUT... you made a great point about the run-time engine. You're right that I should have avoided the use of scripting, esp since there's a dead obvious existing VI to use -- the subVI itself! So I eliminated the app reference (HUGE performance savings closing that reference), and the creation of the new VI (no screwing with the Untitled VI count every time this VI runs), and got rid of the close ref of the new VI (another major savings). And now it'll work in a run-time engine, and it is now fast enough that I don't have to worry about caching. Thank you for the suggestion. Saved, as before, in LV 2014. Note: I worked in LV 2020, and I just picked 2014 as the version to save back to... it'll go back earlier if someone needs it, but, honestly, folks, I only get paid if you upgrade! 🙂 Compute Maximum Desktop Bounds.vi Edited April 15, 2020 by Aristos Queue Quote Link to comment
Antoine Chalons Posted April 15, 2020 Report Share Posted April 15, 2020 1 hour ago, Aristos Queue said: Note: I worked in LV 2020, and I just picked 2014 as the version to save back to... it'll go back earlier if someone needs it, but, honestly, folks, I only get paid if you upgrade! which begs for the question : will LV 2020 be released in august 2020 xor at next NIWeek? Quote Link to comment
crossrulz Posted April 15, 2020 Report Share Posted April 15, 2020 I have heard directly from NI that there are no plans to delay the releases that were planned for NI Week being in May. So I would expect the virtual event planned instead of NI Week in May will have all of the normal product announcements we would normally have in NI Week keynotes. Quote Link to comment
Antoine Chalons Posted April 15, 2020 Report Share Posted April 15, 2020 19 of may that is, it would be great! Quote Link to comment
Aristos Queue Posted April 15, 2020 Author Report Share Posted April 15, 2020 > I have heard directly from NI that there are no plans to delay the releases that were planned for NI Week being in May. A few are moving a bit earlier even. I'll be flagging LV 2020 on LAVA as soon as it is available (if the NI marketing folks don't beat me to it). I'm maybe perhaps just a little bit excited about this particular release. Quote Link to comment
Jordan Kuehn Posted April 15, 2020 Report Share Posted April 15, 2020 7 minutes ago, Aristos Queue said: I'm maybe perhaps just a little bit excited about this particular release. What in particular has you excited? If you can share today. I didn't do the beta this year so I'm out of the loop on the new stuff. Quote Link to comment
Aristos Queue Posted April 15, 2020 Author Report Share Posted April 15, 2020 You know how all LV objects are represented as cubes? What do you call just the surface of a cube? 🙂 Quote Link to comment
crossrulz Posted April 15, 2020 Report Share Posted April 15, 2020 39 minutes ago, Aristos Queue said: You know how all LV objects are represented as cubes? What do you call just the surface of a cube? 🙂 To be a little more obvious: LVOOP Interfaces Quote Link to comment
Aristos Queue Posted April 16, 2020 Author Report Share Posted April 16, 2020 Bah, Crossulz! You are definitely not invited to the next White Elephant gift exchange. You'd show up with a wrapped present and just announce, "It's socks. Just so you know." 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.