[Gambas-user] Why is this code running twice?
Cam Era
cybercamera at ...626...
Wed Aug 2 06:57:25 CEST 2017
Fernando,
is this the code?
*Private Const W As Integer = 2048
Private Const H As Integer = 2048
Public Sub DwgArea_Draw()
Dim angle As Float
Dim eScale As Float
Dim i As Integer
Print "Executing" & Now
dwgArea.width = 800 ' does nothing
dwgArea.Height = 1000 ' does nothing
Print dwgArea.width; dwgArea.Height
Paint.Translate(dwgArea.W / 2, dwgArea.H / 2)
Paint.Brush = Paint.Color(Color.SetAlpha(Color.Red, 128))
Paint.LineWidth = 1
For i = -15 To 195 Step 15
angle = Rad(CFloat(i))
Paint.MoveTo(0, 0)
Paint.LineTo(Cos(angle) * W / 2, Sin(angle) * H / 2)
Paint.Stroke
Paint.Fill
Next
End*
Does the whole DwgArea_Draw() routine get called twice?
Can you set some breakpoints (F9) and check the calling stack to see what's
going on?
On Wed, Aug 2, 2017 at 11:38 AM, Fernando Cabral <
fernandojosecabral at ...626...> wrote:
> I am trying to create a sundial faceplate. I took the analogic clock,
> discarded what I did not need and thought I was ready to work on the
> calculations and drawing of the hour angles.
>
> Nevertheless, I am mystified by two things I can't understand:
> a) The code produces a loop I can't see why (I am not referring to the FOR
> loop)
> b) I can't modify the drawing area dimensions ( dwgArea.width = 800 does
> not work)
>
> Besides, I have a question: when a drawing area is created, it (0,0)
> supposed to be the central point?
>
> The code follows:
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
> *Private Const W As Integer = 2048Private Const H As Integer = 2048Public
> Sub DwgArea_Draw() Dim angle As Float Dim eScale As Float Dim i As
> Integer Print "Executing" & Now dwgArea.width = 800 ' does nothing
> dwgArea.Height = 1000 ' does nothing Print dwgArea.width; dwgArea.Height
> Paint.Translate(dwgArea.W / 2, dwgArea.H / 2) Paint.Brush =
> Paint.Color(Color.SetAlpha(Color.Red, 128)) Paint.LineWidth = 1 For i
> = -15 To 195 Step 15 angle = Rad(CFloat(i)) Paint.MoveTo(0, 0)
> Paint.LineTo(Cos(angle) * W / 2, Sin(angle) * H / 2) Paint.Stroke
> Paint.Fill NextEnd*
>
>
>
> --
> Fernando Cabral
> Blogue: http://fernandocabral.org
> Twitter: http://twitter.com/fjcabral
> e-mail: fernandojosecabral at ...626...
> Facebook: f at ...3654...
> Telegram: +55 (37) 99988-8868
> Wickr ID: fernandocabral
> WhatsApp: +55 (37) 99988-8868
> Skype: fernandojosecabral
> Telefone fixo: +55 (37) 3521-2183
> Telefone celular: +55 (37) 99988-8868
>
> Enquanto houver no mundo uma só pessoa sem casa ou sem alimentos,
> nenhum político ou cientista poderá se gabar de nada.
> ------------------------------------------------------------
> ------------------
> Check out the vibrant tech community on one of the world's most
> engaging tech sites, Slashdot.org! http://sdm.link/slashdot
> _______________________________________________
> Gambas-user mailing list
> Gambas-user at lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/gambas-user
>
More information about the User
mailing list