[Gambas-user] Which container to use for Draw Image?
tobias
tobiasboe1 at ...20...
Wed Jan 18 15:58:44 CET 2012
Алексей Беспалов schrieb:
> Hi!
> Please help me.
>
>
> Which container to use for Draw Image?
> So you can determine which of Image Clicked.
>
> I used to DrawArea at HPanel. But I do not know how to identify the object in
> the event DrawArea Click ().
>
> This is part my code:
>
> --------------------------------------------------
> Public Sub DrawImages(mhImage As Image[], Parent As Container, SizeArea As
> Integer)
> Dim hImage As Image
> Dim hArea As DrawingArea
>
> MVars.mAreas.Clear()
> Parent.Children.Clear()
>
> For Each hImage In mhImage
> hArea = New DrawingArea(Parent)
> Object.Attach(hArea, FMain, "hArea")
> MVars.mAreas.Add(hArea)
>
> hArea.Cached = True
> hArea.Border = 2
>
> DrawImage(hImage, hArea, SizeArea) 'Draw Image on hArea
> Next
> End
> ----------------------------------------------------
>
> In FMain code:
>
> ----------------------------------------------------
> Public Sub hArea_DblClick()
> Message.Info("!!!")
> End
> ----------------------------------------------------
> It is work. But can i determine which of Image i Clicked??
>
since you create multiple DrawingAreas with the same event name, so all
objects individually will raise the hArea_DblClick event.
but there is one trick: the object that raised a particular event can be
referred to from within the event handler by using the Last object.
consequently Last will be a reference to the particular DrawingArea
dblclicked.
More information about the User
mailing list