Random Ramblings on LabVIEW Design

Community Browser
Labels
cancel
Showing results for 
Search instead for 
Did you mean: 

Re: On the subject of screen size.. article 1 of 2

swatts
Active Participant

Howdy Pardners,

Hope your wiring is going well!

LabVIEW can be quite cumbersome when dealing with screen sizes, our stock way of dealing with this is to restrict the screen size of our applications. This hasn't been too much of an issue until now. My current project needs to be able to run on different resolutions and it also needs to undock graphs, these also need to be resizeable. I thought it may be useful to list out the techniques and challenges.

First lets think about what we want to happen when a screen size is changed.

  • We want some controls to change in proportion to the screen size, graphs for example.
  • We want some controls to stay the same size but be anchored to a position on the screen, buttons and drop down controls.
  • We want some controls to stay in proportion to one axis, so a list box to adjust vertically, a status string to adjust horizontally.
  • Some controls can be removed (tip: the easiest to manage control is one you don't need to manage!).
  • Some controls can be restricted.

First let's deal with undocking.....

undock button.jpg

The first challenge here is to make a button that keeps its proportions, and is locked to a position on the graph. I want it to always be in the top right hand corner of the graph. Aesthetically I want it to be unobtrusive (i.e. use transparency to make sure it doesn't get in the way of the graph). I made a line drawing in LibreOffice Present and cut and paste this into a vertical button (from the UI Control Suite:System Controls Palette). The easiest way to restrict its size is to set it as a Strict Type Def. Finally we need to lock it into the top-right hand corner of the graph, sadly the only way to do this is writing code!

Lock Button.jpg

x1Undock is the button, so we take the width and move it relative to the Right of the Plot Bounds of the graph.

This is code worth noting as you'll be using it a fair bit, due to the fact that LabVIEW is natively a little random when left to its own devices!

Pressing this button will instantiate a graphscreen.vi instance, pre-loaded with the settings from the docked graph.

UndockGraph.jpg

The code to instantiate the graph is as followsInstantiate.png

Keeping control of all the dynamic references in this manner has worked out nice, it allows us easy housekeeping and access to control and indicator values.

Here's a link to Sam Sharps  article on a similar subject

The next article will discuss the undocked graph and give some more design pointers.

Lots of Love

Steve

Steve


Opportunity to learn from experienced developers / entrepeneurs (Fab,Joerg and Brian amongst them):
DSH Pragmatic Software Development Workshop


Random Ramblings Index
My Profile

Comments
Thoric
Trusted Enthusiast

Ooo, UI stuff. I love reading UI stuff.

Thoric (CLA, CLED, CTD and LabVIEW Champion)


swatts
Active Participant

Me too. There just isn't much of it!

I should have part 2 ready this week.

Steve


Opportunity to learn from experienced developers / entrepeneurs (Fab,Joerg and Brian amongst them):
DSH Pragmatic Software Development Workshop


Random Ramblings Index
My Profile

samsharp99
Member

In one of my recent projects I got to have a lot of fun with the UI aspect - when you get a UI together that can resize nicely and "just works" for the user it's a really nice feeling. I posted about some of the features of it over on the UI Interest Group, it has many of the same features as yours (resizeable graphs, docking/undocking UI panels).

For the developer though, getting the combination of splitters & pane settings right and all the events/property nodes behind it so it works properly can be a time consuming process.

swatts
Active Participant

Very nice work Sam and I agree with you, I've thoroughly enjoyed this project (although it has been very hard, or maybe because of that)

I've added a link to your article in the main text, I'll be stealing that!

Steve


Opportunity to learn from experienced developers / entrepeneurs (Fab,Joerg and Brian amongst them):
DSH Pragmatic Software Development Workshop


Random Ramblings Index
My Profile

JeffreyH
Member

Nice!

I like fiddling with UI stuff too..

I usually try to stay away from ordinary tabs when in need of hifi re-size abilities.

When you set your graph to size with the pane, here's a nice trick to lock a control or indicator to a specific part of the graph without the need for coding: customize the control by putting a transparent decoration in the back of the z-order in such a way the transparent part extents beyond the 're-size' lines you see when in edit-mode.

swatts
Active Participant

That is brilliant and peculiar in equal measure!

Let me try and undrstand this action by putting it into words....

So the problem I had with buttons is that they seemed to move about randomly in relation to the graph (hence the coding). This supposed random movement is actually limited to some bounds set by the grid lines. By increasing the size of the control (by adding a transparent background) you exceed these bounds and it locks to position correctly!

Thanks for sharing Jeff, really appreciate it!

Steve


Opportunity to learn from experienced developers / entrepeneurs (Fab,Joerg and Brian amongst them):
DSH Pragmatic Software Development Workshop


Random Ramblings Index
My Profile