* fixed scrollcalback for scrollbox

git-svn-id: trunk@7788 -
This commit is contained in:
marc 2005-09-22 22:58:44 +00:00
parent be8123b7f1
commit ef06d18f54
3 changed files with 18 additions and 6 deletions

View File

@ -2620,7 +2620,7 @@ var
begin begin
Result := CallBackDefaultReturn; Result := CallBackDefaultReturn;
Assert(False, Format('Trace:[GTKHScrollCB] Value: %d', [RoundToInt(Adjustment^.Value)])); Assert(False, Format('Trace:[GTKHScrollCB] Value: %d', [RoundToInt(Adjustment^.Value)]));
Scroll := PgtkRange(gtk_object_get_data(PGTKObject(Adjustment), 'ScrollBar')); Scroll := PgtkRange(gtk_object_get_data(PGTKObject(Adjustment), odnScrollBar));
if Scroll<>nil then begin if Scroll<>nil then begin
Msg.Msg := LM_HSCROLL; Msg.Msg := LM_HSCROLL;
with Msg do begin with Msg do begin
@ -2645,7 +2645,7 @@ var
begin begin
Result := CallBackDefaultReturn; Result := CallBackDefaultReturn;
Assert(False, Format('Trace:[GTKVScrollCB] Value: %d', [RoundToInt(Adjustment^.Value)])); Assert(False, Format('Trace:[GTKVScrollCB] Value: %d', [RoundToInt(Adjustment^.Value)]));
Scroll := PgtkRange(gtk_object_get_data(PGTKObject(Adjustment), 'ScrollBar')); Scroll := PgtkRange(gtk_object_get_data(PGTKObject(Adjustment), odnScrollBar));
if Scroll<>nil then begin if Scroll<>nil then begin
Msg.Msg := LM_VSCROLL; Msg.Msg := LM_VSCROLL;
with Msg do begin with Msg do begin

View File

@ -419,6 +419,8 @@ var
const const
odnScrollArea = 'scroll_area'; // the gtk_scrolled_window of a widget odnScrollArea = 'scroll_area'; // the gtk_scrolled_window of a widget
// used by TCustomForm and TScrollbox // used by TCustomForm and TScrollbox
odnScrollBar = 'ScrollBar'; // Gives the scrollbar the tgtkrange is belonging to
// Used by TScrollbar, TScrollbox and TWinApiWidget
const const
CallBackDefaultReturn = {$IFDEF GTK2}false{$ELSE}true{$ENDIF}; CallBackDefaultReturn = {$IFDEF GTK2}false{$ELSE}true{$ENDIF};

View File

@ -4747,7 +4747,7 @@ begin
if Adjustment <> nil if Adjustment <> nil
then with Adjustment^ do then with Adjustment^ do
begin begin
gtk_object_set_data(PGTKObject(Adjustment), 'ScrollBar', gtk_object_set_data(PGTKObject(Adjustment), odnScrollBar,
PGTKScrolledWindow(Result)^.VScrollBar); PGTKScrolledWindow(Result)^.VScrollBar);
Step_Increment := 1; Step_Increment := 1;
end; end;
@ -4757,7 +4757,7 @@ begin
if Adjustment <> nil if Adjustment <> nil
then with Adjustment^ do then with Adjustment^ do
begin begin
gtk_object_set_data(PGTKObject(Adjustment), 'ScrollBar', gtk_object_set_data(PGTKObject(Adjustment), odnScrollBar,
PGTKScrolledWindow(Result)^.HScrollBar); PGTKScrolledWindow(Result)^.HScrollBar);
Step_Increment := 1; Step_Increment := 1;
end; end;
@ -5402,7 +5402,7 @@ begin
P := gtk_hscrollbar_new(Adjustment) P := gtk_hscrollbar_new(Adjustment)
else else
P := gtk_vscrollbar_new(Adjustment); P := gtk_vscrollbar_new(Adjustment);
gtk_object_set_data(PGTKObject(Adjustment), 'ScrollBar', P); gtk_object_set_data(PGTKObject(Adjustment), odnScrollBar, P);
end; end;
csScrolledWindow : csScrolledWindow :
@ -5469,6 +5469,16 @@ begin
gtk_object_set_data(P,odnScrollArea, TempWidget); gtk_object_set_data(P,odnScrollArea, TempWidget);
Adjustment := gtk_scrolled_window_get_vadjustment(PGTKScrolledWindow(TempWidget));
if Adjustment <> nil
then gtk_object_set_data(PGTKObject(Adjustment), odnScrollBar,
PGTKScrolledWindow(TempWidget)^.vscrollbar);
Adjustment := gtk_scrolled_window_get_hadjustment(PGTKScrolledWindow(TempWidget));
if Adjustment <> nil
then gtk_object_set_data(PGTKObject(Adjustment), odnScrollBar,
PGTKScrolledWindow(TempWidget)^.hscrollbar);
TempWidget2 := gtk_layout_new(nil, nil); TempWidget2 := gtk_layout_new(nil, nil);
gtk_container_add(PGTKContainer(TempWidget), TempWidget2); gtk_container_add(PGTKContainer(TempWidget), TempWidget2);
gtk_widget_show(TempWidget2); gtk_widget_show(TempWidget2);