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

T Lee Davidson t.lee.davidson at gmail.com
Mon Apr 17 03:06:44 CEST 2023


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



More information about the User mailing list