[Gambas-user] Changing the value of a variable or object outside the class

Mayost Sharon sharon at 455.co.il
Mon Apr 17 07:26:54 CEST 2023


---------- Original Message -----------
From: T Lee Davidson <t.lee.davidson at gmail.com>
To: user at lists.gambas-basic.org
Sent: Sun, 16 Apr 2023 21:06:44 -0400
Subject: Re: [Gambas-user] Changing the value of a variable or object outside the class

> On 4/16/23 10:47, Mayost Sharon wrote:
> > Hello, I hope the title is correct
> > 
> > Further to the discussion:
> > https://lists.gambas-basic.org/pipermail/user/2023-April/079118.html
> > which ended successfully
> > 
> > I have a new question related to classes
> > 
> > I am trying to change a property of an object that is in class1 but I am inside class2
> > 
> > Attached is the code I am trying and it does not allow access from class2 to class1
> > 
> > Class 1 has an h_timer object
> > I want in class 2 to change the value of h_timer.Delay
> > 
> > Thanks
> 
> You could make the declaration of your Timer STATIC PUBLIC, but you may not 
> want the Class1 timer delay to be shared among all the Class2 objects.
> 
> It is quite difficult to ascertain what it is you are trying to accomplish 
> with the project as a whole. You may need to give each class2.key object its 
> own timer.
> 
> -- 
> Lee
> 
> ----[ http://gambaswiki.org/wiki/doc/netiquette ]----
------- End of Original Message -------

Thank you

It works well with a STATIC statement
As you said the problem now is that it is public to everyone

I am trying to learn the work with classes
The timer is just an example for understanding


More information about the User mailing list