LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

disallowing panel resize below minimum?

Solved!
Go to solution

Is there a way to forbid active resizing of a panel below minimums?  I've read this post and looked up example projects, but they mostly deal with the EVENT_PANEL_SIZE event (after the resize is done).  

 

I'd like to utilize the EVENT_PANEL_SIZING event which is while the resizing is happening.  The idea is this:

 

As you click and drag the size of a panel, I would like the panel to stop resizing with your mouse cursor once the minimum height and width dimensions are reached.  This seams like it should be easy.  But I can't quite crack it.

0 Kudos
Message 1 of 4
(4,332 Views)

Yes, there's a trick to EVENT_PANEL_SIZING to constrain sizes (I think it's in the list of examples, otherwise search for it).

 

But personally I find it easier to use EVENT_PANEL_SIZE and GetPanelAttribute(...ATTR_WIDTH) and "if (Width<Limit) Width=Limit" before doing the disposition of my controls. This way you avoid errors (negative size or position controls) while still allowing the user to give the panel a tiny size to get it 'out of the way'. There's no real drawback to this. I think.

Message 2 of 4
(4,329 Views)

Thanks,

 

Yeah, I have that method working now.  It's funcational, but I don't love it.  The reason is that I feel it gives a "jumpy" effect to the user.  When they attempt a size that is below the minimums, then the callback will force it back to the minimums, which is kind of jolting to my eye.

 

 

0 Kudos
Message 3 of 4
(4,320 Views)
Solution
Accepted by topic author ElectroLund

Eureka!  Good suggestion on the search.  The CVI example projects app didn't find much for this, so I did a search in MS Explorer for "EVENT_PANEL_SIZING".  There's a really great project in there called 'events.cws'. 

 

There's an option to restrict panel sizing dynamically.  A very nice implementation.

 

The "magic" you mentioned looks to be usage of GetPanelEventRect & SetPanelEventRect.  Not very intuitive a solution, but magical.

0 Kudos
Message 4 of 4
(4,319 Views)