[Gambas-user] IDE properties and auto-inheritance

BB adamnt42 at gmail.com
Sat Mar 25 17:09:20 CET 2023


On 26/3/23 2:29 am, Bruce Steers wrote:
> Is there a reason i cannot set properties in the IDE with 
> auto-inherited TextLabel?
>
> Consider the following code named TextLabel.class..
> |
> |
> |' Gambas class file|
> |
> |Export|
> |Public| |Const| |_Properties ||As| |String| |= ||"*,IsHeader"|
> |Property| |IsHeader ||As| |Boolean|
> |Private| |$IsHeader ||As| |Boolean|
> |Private| |Function| |IsHeader_Read() ||As| |Boolean|
> |||Return| |$IsHeader|
> |End|
> |Private| |Sub| |IsHeader_Write(Value ||As| |Boolean||)|
> |||$IsHeader = Value|
> |End|
> |
> |
> after "compile all" i can see the IsHeader value in the IDE properties 
> and I have the option to set it true or false but if i change it it 
> just remains False.
>
> If I rename the class to TextLabel2.class and use "Inherits TextLabel" 
> then it looks the same in the IDE and i can change the property okay.
>
> Is it a bug or is it wrong to expect the IDE to use properties from 
> auto-inherited classes?
>
> Cheers
> BruceS
> |
>

You know, I have never thought of trying it that way. I think it's 
because you are not really inheriting but actually overriding the 
TextLabel class and imagine that the form designer is only saving the 
properties of the native class?

Have a look at the .form file. Is the new property there? As there is no 
default value for the property it should be, no matter what you set it 
to in the form designer. ... Then again, maybe if you did give it a 
default value the goblins might behave differently.

b

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.gambas-basic.org/pipermail/user/attachments/20230326/bfedd06d/attachment-0001.htm>


More information about the User mailing list