[Gambas-user] User Digest, Vol 63, Issue 50 (should be: Re: Class behavior: _free method)
gian
bagoneo at libero.it
Sat Dec 17 15:33:32 CET 2022
Il 17/12/22 15:13, CD ha scritto:
> Thanks for the tip, I opened and unpacked the project.
> ok but it is a Create Static class...
> no matter :
> in the declarations of FMain.class you write:
> clsF As clsFoo
> after you make a line break...
> here, it becomes: clsF As ClsFoo
> and you?
>
> Cordially
Hi,
I created the static class because I did not need to instantiate it.
I can't figure out what code you are referring to, below are the codes I
wrote.
FMain.class :
Public Sub Button1_Click()
clsFoo.bTimer = True
clsFoo.RunTimer
Print "Start"
End
Public Sub Button2_Click()
clsFoo.StopTimer
Print "Stop"
End
Public Sub Form_Close()
Print "Close Form"
Button2_Click
End
clsFoo.class :
Create Static
Property bTimer As Boolean Use $bTimer
Private $hTimer As Timer
Private $iCount As Integer
Public Sub RunTimer()
If $bTimer Then
With $hTimer = New Timer As "Timer1"
.Delay = 1000
.Start
End With
Endif
End
Public Sub StopTimer()
$iCount = 0
If $bTimer And If $hTimer Then $hTimer.Stop
End
Public Sub Timer1_Timer()
Inc $iCount
Print "Work from " & $iCount & " second/s"
End
' Public Sub _free()
'
' Print "FREE"
'
' End
Try creating a new project and see if you can paste the code and if it
works.
Regards
Gianluigi
More information about the User
mailing list