B4A Class [B4X] B4XSwitch changing colors in runtime

This is a modified version of the B4XSwitch class wich allows you to set the On,Off and Thumbcolors in code.
Just replace it inside your XUI Views.b4xlib. You can also rename the class to use it beside the official XUI Views
Maybe this can be added in future official updates


B4X:
    B4XSwitch1.OnColor=Theme.SelectionBackground
    B4XSwitch1.OffColor=Theme.Disabled
    B4XSwitch1.ThumbColor=Theme.AccentColor

colors.gif
 

Attachments

  • B4XSwitch.bas
    5.4 KB · Views: 217
Last edited:

Blueforcer

Well-Known Member
Licensed User
Longtime User
But if the official library were to change, you would have to replace the class every time; not really "funny" thing.

And thats why i mentioned the update thing wich was another broad hint to erel ;-)
Maybe this can be added in future official updates

You can also simply rename the class and import it into the project and use it besides the official xui views lib.

Not sure why we need to discuss such trifles here if everything is already said.
I needed it, so I have provided it for the community for those who are in the same situation as me. Others are certainly pleased about it.
 
Last edited:

Blueforcer

Well-Known Member
Licensed User
Longtime User
i added last sentence only to break future discussions :)
New members can find explanation in the forum or can ask. Writing everything from scratch to every post would be a bit too much.
Hope its ok now for you and we can quit here.
 

LucaMs

Expert
Licensed User
Longtime User
i added last sentence only to break future discussions :)
New members can find explanation in the forum or can ask. Writing everything from scratch to every post would be a bit too much.
Hope its ok now for you and we can quit here.
Sorry, I do not want to make controversy and much less underestimate your work and your class.

Replacing the original class is a bad idea, due to incompatibility with future versions of the B4XLib, so if that was your only indication it would have been worse.

I hope it is clear; I do not add anything else.
 
Top