Share Tips, Code Samples, etc. with the Visual Prolog community.
Steve Lympany
VIP Member
Posts: 56
Joined: 31 Mar 2001 23:01

SplitTwoControl Modification

Unread post 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
Attachments
splitTwoControl.zip
Callback added to SplitTwoControl for Vip6 and Vip7 (up to build 7002)
(4.77 KiB) Downloaded 1237 times
Steve Lympany
VIP Member
Posts: 56
Joined: 31 Mar 2001 23:01

Unread post 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
User avatar
Thomas Linder Puls
VIP Member
Posts: 1398
Joined: 28 Feb 2000 0:01

Unread post by Thomas Linder Puls »

Thank you, we will look at it.
Regards Thomas Linder Puls
PDC
User avatar
Thomas Linder Puls
VIP Member
Posts: 1398
Joined: 28 Feb 2000 0:01

Unread post 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.
Regards Thomas Linder Puls
PDC
Post Reply