L LDeeJay Member Nov 27, 2022 #1 Hi All, I have been searching the forum and the tutorials but couldn't find an answer yet. Is it possible to set the selected row color of a tableview (not B4XView) at runtime? The default is a blue one but I'd like to change it to red based on the content of one of the cell it's looking at. I know I can change the color with either the ExtraCSS field in the designer or by using a CSS file but they are both not accessible at runtime. Any suggestions? Cheers, Leon
Hi All, I have been searching the forum and the tutorials but couldn't find an answer yet. Is it possible to set the selected row color of a tableview (not B4XView) at runtime? The default is a blue one but I'd like to change it to red based on the content of one of the cell it's looking at. I know I can change the color with either the ExtraCSS field in the designer or by using a CSS file but they are both not accessible at runtime. Any suggestions? Cheers, Leon
Erel B4X founder Staff member Licensed User Longtime User Nov 28, 2022 #2 LDeeJay said: I know I can change the color with either the ExtraCSS field in the designer Click to expand... If this works then you can also do it at runtime: Code: CSSUtils.SetStyleProperty(TableView1, ...) 'add a reference to CSSUtils Upvote 0
LDeeJay said: I know I can change the color with either the ExtraCSS field in the designer Click to expand... If this works then you can also do it at runtime: Code: CSSUtils.SetStyleProperty(TableView1, ...) 'add a reference to CSSUtils
L LDeeJay Member Nov 28, 2022 #3 You're right and the issue is solved because: B4X: tableview.Style = "-fx-selection-bar: red" does work from code but ... not when there's also a value in the CSSExtra in the designer. So the designer takes precedent over the code. I had to clear the value in the designer in order to make the code work. Upvote 0
You're right and the issue is solved because: B4X: tableview.Style = "-fx-selection-bar: red" does work from code but ... not when there's also a value in the CSSExtra in the designer. So the designer takes precedent over the code. I had to clear the value in the designer in order to make the code work.
L LDeeJay Member Nov 28, 2022 #4 No LDeeJay said: So the designer takes precedent over the code. Click to expand... No it doesn't. I tried it again and now it works, even with a default value in the ExtraCSS field. No clue what has happened before but it works as expected ..... (of course ;-) ) Upvote 0
No LDeeJay said: So the designer takes precedent over the code. Click to expand... No it doesn't. I tried it again and now it works, even with a default value in the ExtraCSS field. No clue what has happened before but it works as expected ..... (of course ;-) )