[Gambas-user] Can not draw outside of draw enent handler
Demosthenes Koptsis
demosthenesk at ...626...
Tue Mar 29 10:29:43 CEST 2011
On Sun, 2011-03-27 at 17:00 +0200, Benoît Minisini wrote:
> >
> > i try to make a similar example from this page
> > http://gambasdoc.org/help/comp/gb.qt4/draw/line?v3
> >
> > in this page it says
> >
> > Draw.Begin(ME) where ME is a form.
> >
> > i get this error in my project for
> >
> > Draw.Begin(drawArea) where drawArea is the name of a DrawingArea object.
> >
> > Where is the bug? The name "drawArea" ?
> >
>
> Now, in Gambas 3, you just cannot draw outside of the Draw event handler
> anymore. That's all. Consequently, you cannot draw on a form too, as a form
> has no Draw event handler.
>
> Regards,
>
ok i found the bug in my app.
i had to set Cached property to TRUE.
after that i can write code as:
----------------------
Public Sub btnLine_Click()
iAct = 1
Draw.Begin(drawArea)
drawArea_Draw()
Draw.End
End
Public Sub btnPolygon_Click()
iAct = 2
Draw.Begin(drawArea)
drawArea_Draw()
Draw.End
End
Public Sub drawArea_Draw()
Select Case iAct
Case 1 'draw line
SetValues()
Draw.Line(55, 47, 289, 367)
Case 2
SetValues()
Draw.Polygon(aPolygon)
End Select
End
--------------------------
--
Regards,
Demosthenes Koptsis.
More information about the User
mailing list