04-22-2010 10:16 AM
I have a series of controls on a GUI and a GUI that I want to be able to resize according to the machine that is running the program.
Basically my logic is this. A GUI can fill most of the available display space, but not all, and must never be shown on a monitor that it is not designed for.
Currently my Laptop is having display issues and keeps chaning the resolution thus hiding parts of my GUI.
I want to resize (and position all visible controls and indicators - I know which ones they are) so that my GUI fits in a know space on certain default screen resolutions. (800x600, 1024x768 and 1280x1024)
I can get the position and bounds of a control, but I can't change the bounds of a control (generic) with the property node. This is frustrating. as one of my controls is a large Multicolumn listbox which takes up most of the display and definitely needs resizing according to screen resolution.
Any ideas?
James
Solved! Go to Solution.
04-22-2010 11:32 AM
Your immediate problem is that changing the size of a control is only available through specific (as opposed to generic) property nodes. Use the "to more specific" function from the App Control palette to cast the reference to the type you want. If the generic reference did not refer to that type of reference, it will return an error.
here's code that changes all of the MCLs on the FP to 100x200px
since you say you know which controls you want to change, you can do it from created references, too.
04-22-2010 11:48 AM
blawson wrote:Your immediate problem is that changing the size of a control is only available through specific (as opposed to generic) property nodes. Use the "to more specific" function from the App Control palette to cast the reference to the type you want. If the generic reference did not refer to that type of reference, it will return an error.
here's code that changes all of the MCLs on the FP to 100x200px
since you say you know which controls you want to change, you can do it from created references, too.
... so If like me you have a cluster of references from the front panel already this should not be an issue. Instead of turning the cluster into an array, I should just work on the cluster as it is and put it through a state machine unbundling and updating each element as I go.
Brilliant. Thanks blawson
James
04-22-2010 11:49 AM
Hi James,
I tagged this thread for "resizing" since it was the best approach I had seen previously.
Maybe that will help you out.
Ben
04-22-2010 12:07 PM
unbundling from your cluster would be simplest, yes.
I think in general though you could be better served by keeping it simple and letting the user deal with the front panel. Leave the scrollbars visible, let the user resize the panel. Look at the bounding box of the pane and initially resize the window to fit the contents rather than the other way around. I only like to lock down the window if it's to be a terminal type application (only thing running, I know the hardware at dev time, etc.)
There are some other ways to resize things, too. I'm sure you've seen the "scale with pane" and "fit to pane" options. I've always been unsatisfied with the former, but the latter is pretty nice when combined with splitters, especially if you camouflage the splitter and get the various splitter options right.
Check out the UI of VI Package Manager to see a nice MCL that resizes as you resize the window. I think JKI even have a how-to-video that might show it....found it: http://forums.jkisoft.com/index.php?showtopic=988
and for an extra tidbit, check out these properties:
the top one gives you the resolution of each monitor on the system (mine shows 1680x1050) the bottom one gives you the workspace rectangle of the main monitor (and mine shows (0,1680),(0,990) which shows that the last 60 pixels there at the bottom are taskbar)
These should be useful for checking what the available space is for dynamically sizing things.
04-26-2010 03:00 AM
Thanks blawson and Ben,
Thats pretty much summed up exactly what I have done. As one of my controls is a cluster and I can't access the size options for it, I've kept it the same size. Ive kept most things the same size apart from 1 large string container that has got horizontally squashed, but it is massive, so shouldn't be a problem, and moved all my buttons closer together on the smaller resolution screen. (I've got a very clean interface, so it doesn't notice that much.)
I'm using the Wkspace property to give me the size and as soon as I find I'm bigger or equal to the current resolution I'm checking for, I set the screen to that size.
I'm menu driven, and I don't want scroll bars as I think it looks untidy, but I think I have achieved my goal now.
I will fit on any monitor resolution from 1024x768 and leave room around the edge of a centred GUI for large Icons on the desktop on all sides. (Same sort of space on the 1280x1024). Widescreens should be handled by this too I have yet to try a widescreen monitor.
James