Selaa lähdekoodia

added a function to get the scrolling offset from an image panel.

git-svn-id: https://svn.inf.ethz.ch/svn/lecturers/a2/trunk@7233 8c9fc860-2736-0410-a75d-ab315db34111
skoster 8 vuotta sitten
vanhempi
commit
f1d2636cfc
1 muutettua tiedostoa jossa 9 lisäystä ja 4 poistoa
  1. 9 4
      source/WMStandardComponents.Mod

+ 9 - 4
source/WMStandardComponents.Mod

@@ -2875,7 +2875,13 @@ TYPE
 			SetNameAsString(StrImagePanel);
 			dx := 0;  dy := 0
 		END Init;
-
+		
+		PROCEDURE GetOffsets*(VAR x,y: LONGINT); (*returns offset caused by scrollbars*)
+		BEGIN
+			x :=-( dx * hScrollbar.pos.Get() DIV 100);
+			y :=-(dy * vScrollbar.pos.Get() DIV 100);
+		END GetOffsets;	
+		
 		PROCEDURE PropertyChanged*(sender, property : ANY);
 		BEGIN
 			IF property = imgName THEN
@@ -2928,9 +2934,8 @@ TYPE
 			IF show THEN
 				DrawBackground^(canvas);
 				IF img # NIL THEN
-					x := dx * hScrollbar.pos.Get() DIV 100;
-					y := dy * vScrollbar.pos.Get() DIV 100;
-					canvas.DrawImage(-x, -y, img, WMGraphics.ModeSrcOverDst)
+					GetOffsets(x,y);
+					canvas.DrawImage(x, y, img, WMGraphics.ModeSrcOverDst)
 				END
 			END;
 		END DrawBackground;