I have no experience with subclassing stuff in Xojo or any other language so I am groping here.
I want to subclass the CheckBox control and add a TextColor property for the label but I can not figure out how to do this. I would be most grateful if you just point me at the proper documentation on how to do this.
If you are macOS only and have access to the MBS plugins here is a rough example i’ve just knocked up that shows how it could be done.
NOTE. The property TextColor below should be enabled in the control’s Inspector Behaviour.
'update the initial appearance of the caption
'raise the open event again so that it can be hooked into
Private Sub UpdateCaption()
Dim attributedStringObj As NSAttributedStringMBS
Dim mutableAttributedStringObj As NSMutableAttributedStringMBS
If Self.NSButtonMBS <> Nil Then
attributedStringObj = NSAttributedStringMBS.attributedStringWithString(Self.Caption)
mutableAttributedStringObj = attributedStringObj.mutableCopy
mutableAttributedStringObj.addAttribute(NSAttributedStringMBS.NSForegroundColorAttributeName, New NSColorMBS(Self.mCaptionColour_), New NSRangeMBS(0, Len(Self.Caption)))
Pftt! Of course I’m a Chiefs fan. I watched every single one of the games when they were 2-14 (twice). I’ve been to training camp 8 years in a row. And stood out in sub-freezing temps to celebrate their Super Bowl victory.