Преглед изворни кода

default boundary initialization in ImagePanel.SetImage()

git-svn-id: https://svn.inf.ethz.ch/svn/lecturers/a2/trunk@7426 8c9fc860-2736-0410-a75d-ab315db34111
eth.hunzikerp пре 7 година
родитељ
комит
55a8ecca0e
1 измењених фајлова са 2 додато и 1 уклоњено
  1. 2 1
      source/WMStandardComponents.Mod

+ 2 - 1
source/WMStandardComponents.Mod

@@ -2925,12 +2925,13 @@ TYPE
 			Invalidate
 		END ScrollbarsChanged;
 
-		(** Iff data IS WMGraphics.Image, it is set as background. Else the background is set to white *)
+		(** Iff data IS WMGraphics.Image, it is set as background. Else the background is set to white. bounds may need to be adapted by caller.  *)
 		(* Note: Only use for anonymous Images without a specific Name *)
 		PROCEDURE SetImage*(sender, data : ANY); (*? PH is Invalidate always handled in PropertyChanged here, or does this exporte procedure occur in other contexts ?*)
 		BEGIN
 			IF (data # NIL) & (data IS WMGraphics.Image) THEN
 				img := data(WMGraphics.Image);
+				IF bounds.GetWidth() * bounds.GetHeight() = 0 THEN bounds.SetExtents(img.width, img.height) END;
 				IF img.width > bounds.GetWidth() THEN
 					dx := img.width - bounds.GetWidth();
 					hScrollbar.visible.Set(TRUE)