11-19-2018 07:56 AM
Good morning
Have a problem with a button in my VI. The button needs to be always in the center between the splitters.
But something in the code isn't working. This is what I've done to vertically center the button:
This code is inside a Event Structure "Panel Resize". However every time the panel resizes the button goes to top, near disappearing from screen.
Tried to get the splitters position instead of the Height of the Pane 4, but didn't worked.
Can you help me solve this problem?
My code is attached to this message.
Solved! Go to Solution.
11-19-2018 08:39 AM
Origin moves because your settings is "stick to bottom"
Change it to "top"
11-19-2018 08:49 AM
Use the Content Area Rect property to get the pane top and bottom and center the button in the middle of that area.
11-19-2018 09:24 AM
Sorry, didn't worked.
Measuring with a probe the result of the (Bottom - Top) from "ContentRect" property was the same of "Area Height"
11-19-2018 09:25 AM - edited 11-19-2018 09:29 AM
edit: again:
You don't just need to know the difference between the bottom and the top, you need to position relative to the top position
11-19-2018 09:31 AM
Yes it does give you the same value as Area Height when you subtract them but Content Rect gives you coordinates, not dimensions. You'll need to deal with all of the coercion dots.
11-19-2018 10:01 AM - edited 11-19-2018 10:05 AM
If you intend to do a lot of resizing and re-positioning, I would suggest that you find a toolkit on VIPM that will do these things for you. LAVA UI Tools would be a good one. I'm sure there are others. This code gets a rectangle for a GObject and snaps/centers it to the left of the pane rectangle. Very simple and clean.
11-27-2018 10:46 AM
Thank you all for helping me.
@Artem.SPb didn't see your post. Your tip solved my problem.
@aputman thanks for the suggestion. I really gonna try this LAVA UI Tools