[Gambas-user] Why is this code running twice?

Fernando Cabral fernandojosecabral at ...626...
Wed Aug 2 03:38:33 CEST 2017


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.



More information about the User mailing list