Page 1 of 1

Frame/Panel with scrollbar?

Posted: Sun Jul 25, 2010 8:49 pm
by AndrewHC
Is there any equivalent of a .NET Panel in JADE? I'd like to add devices to a frame/panel at run-time, but I'm not sure on the number of elements. Because the standard JADE frame doesn't have a scrollbar, if I add more items than it can show, the extra items are hidden.

A workaround I can think of is having the frame expand when it has more items than can be shown, which would use the form's scrollbar to scroll up/down. It would look weird having the bottom of the frame cut off though.

Is there a "proper" way to show a group of components within a larger component, and have the larger component scroll when there's too many items?

Re: Frame/Panel with scrollbar?

Posted: Mon Jul 26, 2010 1:12 am
by Dino
Try using a Picture control as the container. Picture controls support scroll bars. If you want to keep the beveled borders of the Frame control, then you could put a borderless Picture control inside the Frame. When you add your controls to the Picture, keep track of the bottom position (top + height) of the lowest control. If this is more than the client height of the Picture then add a vertical scroll bar, otherwise remove the vertical scroll bar. You could do this check immediately after adding controls to the Picture, as well as when the Form resizes. For example:

Code: Select all

resize() updating; begin if pic.clientHeight < self.lowestCtrlBottom then pic.scrollBars := ScrollBar_Vertical; else pic.scrollBars := ScrollBars_None; endif; end;
Hope this helps.

Dean.

Re: Frame/Panel with scrollbar?

Posted: Mon Jul 26, 2010 9:27 am
by AndrewHC
Brilliant idea! Pictures support a border style of 3D sunken, which works well. Thank-you Dino.