A common user interface requirement is to ensure proper layout for your controls when the window hosting the controls is resized. As a LabWindows/CVI developer, you might attack this problem in a couple different ways:
You can attach multiple controls to a splitter control, and define a behavior for each control individually when the splitter moves. You can leverage this behavior to move and size controls automatically when the panel sizes, enabling control over the layout of the controls on your panel. The trick to this is programmatically operating the splitter when the panel sizes with the OperateSplitter CVI library function call. This does require some implementation, but because the sizing and moving of controls is entirely handled by the splitter control, the most burdensome part of the first listed option is removed.
To make things even easier, I've written a very small library (SplitterSizing.c and SplitterSizing.h) that should further simplify the process. It is attached to this post, and exhibited with a simple example program. There are three public functions:
The example program does nothing but show the sizing in action. You can manually size the panel, maximize the panel, and move the panel around, but the controls on the panel maintain a very specific layout. Consider the following before and after screenshots:
Hi Nick, this is exactly the kind of problem I am trying to solve but I can nt get your sample code to compile. Probably something simple - I get: found identifier expecting ; on the following line typedef intptr_t SizingHandle; in SplitterSizing.h any ideas? Is it because I am running CVI 8.5 / 32bit perhaps?
Yes, the issue you're running into is because you're using CVI 8.5, which does not define intptr_t in cvidef.h. An easy way to resolve the error would be to replace the intptr_t int the typedef with void*. You might need to then perform a cast to void* in the return statement of InitializeSplitterSizingForPanel.