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