Page 1 of 1

SplitTwoControl Modification

Posted: 9 Sep 2006 11:54
by Steve Lympany
Here is a small modification (addition) to splitTwoControl (which should work for Vip6.3 to Vip7 Build 7002) - maybe PDC will add it in the future if it's the correct way to do it (but it works).

I have added a very simple callback - just a notification - so that the application knows when the split size has been changed. I had to do because of the following:

I have control (fred) with a vertical scrollbar (using sb_vert, not sb_ctl).
The parent of this control is a groupbox.
The parent of the group box is the splitTwocontrol

When I moved the split in the splitTwoControl, the vertical scrollbar in fred remained in its old position. So I made the callback (with no arguments) to get the width of the groupbox, and set the width of my own control. The scrollbar is now moved to its correct position.

The changes are commented in the code - search for "SDL". But the new code is:

Code: Select all

predicates     onSplitSize : sizeListener. clauses     onSplitSize(_) :-         getClientSize(Width, Height),         splitLayout(orientation_fact, updateRatio_fact, Width, Height),         updateRatio_fact = false,         !,         updateRatio_fact := true,         resize_callback().%SDL - CALLBACK HERE<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<     onSplitSize(_). %--------------------------------------------NEW CALLBACK - SDL facts     db_CallBackOnResize:(split2CallBackOnResize) determ. clauses     set_callback(CB):-         retractall(db_CallBackOnResize(_)),         assert(db_CallBackOnResize(CB)).   predicates     resize_callback:() procedure (). clauses     resize_callback():-         db_CallBackOnResize(CB),!,         CB().     resize_callback(). %--------------------------------------------END NEW CALLBACK - SDL   and in splitTwoControl.i   domains     split2CallBackOnResize= ()procedure.  %SDL     %     % @short callback for when the 'split' is dragged and dropped to a new position     %     % @end predicates     set_callback:(split2CallBackOnResize) procedure (i). %SDL     %     % @short (optionally) tell this control which predicate to callback to in the calling class.     %     % @end  
Steve

Posted: 23 Sep 2007 16:14
by Steve Lympany
It appears (to me, so far...) that this modification is required in Vip7.1. Maybe I'm doing something wrong elsewhere, but when I make the above mod it behaves properly.
Steve

Posted: 24 Sep 2007 7:16
by Thomas Linder Puls
Thank you, we will look at it.

Posted: 27 Nov 2007 7:26
by Thomas Linder Puls
When the split is moved the group box is re-sized.

So I think you should attach a size listener to the group box instead.