01-03-2019 01:50 AM - edited 01-03-2019 01:51 AM
This idea came to my mind some weeks ago and I implemented it successfully.
I don't know if this can have a more general usage and/or it's a good candidate for a product suggestion.
For sure the same effect can be obtained with different approaches, but I haven't been able to find a CVI built-in method to do this.
Before posting in the Idea Exchange I would like having feedback from some NI users.
The need is quite common: when a panel is resized, some controls should be resized too, some others should be moved.
I use splitters to resize portions of the same panel.
I thought that if controls could be attached to right and bottom borders of the panel (like to splitters), the panel resize would be handled automatically.
Unfortunately I haven't find a way to set a property "attach to border".
And so I created two hidden splitters, just near the right and the bottom border.
They are hidden because the user must not interact with these special splitters.
I added code inside EVENT_PANEL_SIZE callback to move the plitters near the new panel borders calling OperateSplitter().
All the other approaches I used in the past required a lot of code and I was not satisfied by them.
I attach a uir whre you can see in red the two special splitters.
You can switch the uit into "Operate mode" and resize the panel.
Then you must manually move the splitters near the new borders to see what I mean.
My doubt is:
is this a good approach to handle panel resizing?
If this is the case, would you approve a suggestion to NI so that right and bottom borders could work as splitters (with "attach to" behavior)?
In this case, no more code would be necessary inside EVENT_PANEL_SIZE callback.
Solved! Go to Solution.
01-03-2019 11:01 AM
Hidden splitters are the usual way I have been handling this situation for several years and yes: I would support a suggestion to add this functionality to panel borders
01-04-2019 09:17 AM
Hello vix, sometimes I have a bit of time to spend digging into NI website and today I came across this contribution from nickb that exactly addresses this scenario:
LabWindows/CVI Tip: Use Splitter Controls to Handle Panel Sizing
It seems to me it's a valuable sample code to add to CVI developer's toolbox
01-07-2019 01:07 AM
I've searched in the community but not in the user groups
At least this means my idea was not so bad
01-08-2019 05:29 AM
I've just added a new product suggestion here.
01-28-2019 05:02 PM
There's also the userint\docking.prj shipping example, which does more or less the same thing.