Is this a Bug in subclassing?

Xojo 2019 r1.1 and Windows

I have some clients complaining about my app not being compliant with a hight contrast setting, and I want it to be, but is not an easy task with the lack of functionality from xojo

For example, for the BevelButton, if I put in the Open event:

Me.TextColor = TextColor

It works, now the text color is the System’s text color (Not just black) and it can work with themes like the hight contrast, so, for an “easier” transition, I make a decided to make a Subclass, aded a new class, set its super to BevelButton and in the open event put the same code.

Drag the new subclas to a window, run the program and Surprise! Didnt work, the text is just Black

platform and xojo version?

What if in the open even you put:
me.TextColor = &cFB002000

Do you see red text?

[quote=446134:@Karen Atkocius]platform and xojo version?

What if in the open even you put:
me.TextColor = &cFB002000

Do you see red text?[/quote]

Ups, forgot that part. I did the test with me.TextColor = Color.Red and Yes, it works, also with me.TextColor = &cFB002000, But Me.TextColor = TextColor does not work in the subclased open.

Im using Xojo 2019 r1.1 and Windows

Probably because you’re retrieving the TextColor property of the button. Try

Me.TextColor = RealBasic.TextColor

[quote=446139:@Anthony Cyphers]Probably because you’re retrieving the TextColor property of the button. Try

Me.TextColor = RealBasic.TextColor

Well, that is really odd. TextColor works well alone in all other cases except from the subclass. But RealBasic.TextColor did works also in there.

Thanks

In a subclass, the scope changes. So when you just use = TextColor, that’s equivalent to = Super.TextColor rather than = RealBasic.TextColor.