[Gambas-user] Can not draw outside of draw enent handler
Demosthenes Koptsis
demosthenesk at ...626...
Sun Mar 27 19:06:04 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,
>
1) The previous page has the next example:
' This example will draw a red line on the form. To try out this
example,
' start a new graphics project and place a Button on the Form.
PUBLIC SUB Button1_Click()
Draw.Begin(ME)
Draw.LineWidth = 20
Draw.ForeColor = Color.Red
Draw.Line(50, 100, 200, 150)
Draw.End
END
And as i understand does not work, so the page is outdated?
2) ok, i try to change the code.
Old method
-----------------------------
Public Sub btnLine_Click()
Draw.Begin(drawArea)
SetValues()
Draw.Line(55, 47, 289, 367)
Draw.End
End
-----------------------------
New method i try...
-----------------------------
Public iAct As Integer
Public Sub btnLine_Click()
iAct = 1
drawArea_Draw()
End
Public Sub drawArea_Draw()
Select Case iAct
Case 1 'draw line
Draw.Begin(drawArea)
SetValues()
Draw.Line(55, 47, 289, 367)
Draw.End
Case 2
End Select
End
-----------------------------
it continues to refuses.
"Cannot draw outside of draw event handler"
now it is in draw event.
What is happening?
i attach again the project
Thanks for any help!
--
Regards,
Demosthenes Koptsis.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Project99.tar.gz
Type: application/x-compressed-tar
Size: 9688 bytes
Desc: not available
URL: <http://lists.gambas-basic.org/pipermail/user/attachments/20110327/6fb605c5/attachment.bin>
More information about the User
mailing list