B4J Question Styling TabPane Tabs for Four States

cklester

Well-Known Member
Licensed User
I've got a TabPane, and each of its tabs will indicate by color the user's options for the data in that tab.

For example, users with Admin privilege will see a green tab for any tabs requiring Admin privilege. Normal users will see a red tab.

Both user types can click and view any tab, but can only make changes to the data on tabs they see as green.

Admins will probably have all green tabs, while normal users will have some green and some red.

I'm having trouble setting up the CSS styling for this particular UI. I'm not sure it can even be done.

From my research, it looks like I have to go the CSS styling route. Is that true? Are there other ways to style tabs?

Unfortunately, it seems I can't use

B4X:
if isAdminTab then
    TabPane1.StyleClasses.Add("admin")
else
    TabPane1.StyleClasses.Add("user")
end if

because both classes get added to the TabPane itself as I iterate over and add each new tab.

Any ideas as to the best way to accomplish this?

The four states are:

admin (lightgreen)
user (lightred)
selected admin (green)
selected user (red)
 

cklester

Well-Known Member
Licensed User
This will not work unless you find a way to set style classes to specific tab headers.

Yes, that's what I figured. I just wasn't able to figure it out.

Are the individual tab nodes available from the TabPane? There's a SelectedItem that deals with the child tab node, so maybe something can be exposed from there. I didn't find any styling options, but are they available?

I did find this thread that seems to allude to a solution, but I can't parse it.
 
Upvote 0
Top