Web2 WebListbox.Style is protected?

I can’t change the style of a weblistbox.

I keep getting “This method is protected. It can only be called from within its class”

WebListbox1.opening
  Var style As New WebStyle
  style.Bold = True
  Me.Style = style // This method is protected. It can only be called from within its class"

Subclass it
Put your code in the subclass opening event and add a new opening event ?
For bonus points your subclass can add it own computed getter / setter and shadow the super
Something like at least compiles (note you DONT cast to a web listbox)

Public Property Style as WebStyle
Get
  return webUIControl(self).Style
End Get

Set
  webUIControl(self).Style = value 
End Set

End Property

@Mike_D did this solution work for you?

I have the same issue.
have you solved it?
thanks

To be honest, I’ve kind of given up on Web 2 styles for the moment. There are just so many missing features, inconsistencies, etc that I got tired of fighting them.

Feels like Xojo has been putting their energy towards Apple Silicon lately, hoping they can find time soon to circle back and try to clean up some of the major issues in Web 2.0.

2 Likes

+1

There also seems to be a bit of a conceptual disagreement going on. For example, I think there should be a way to style a WebRadioButton, because the .style property on a WebRadioGroup has no effect. I suggested the problem is that WebRadioButton is an Object rather than a WebUIControl: <https://xojo.com/issue/61736> but comments suggest that’s not going to get done.

Also <https://xojo.com/issue/61544> was closed as “by design” even though to me clearly, if a WebUIControl has a .style property, it should work as expected.

Due to these and similar issues, I had to write a bunch of javascript hacks to edit the CSS styles.