4
$\begingroup$

At least in Windows the example below creates a TabView where the selected tab is basically indistinguishable. This problem has been there for years. Is this problem solvable in Windows? How?

    Panel[TabView[{"x" -> "Guess which tab is selected?", 
   "y" -> "Guess which tab is selected?"}, Background -> LightGray], 
 Background -> LightGray, FrameMargins -> 20]

enter image description here

$\endgroup$
  • $\begingroup$ I guess you know it can be solved by creating your own version with buttons and PaneSelector. Is that acceptable? Related: Can one affect the appearance of components of a control? $\endgroup$ – Kuba Nov 20 '18 at 18:45
  • $\begingroup$ @Kuba Yes, I know and I do have my own version which looks fine and I use it often. However, TabView renders slightly faster and that makes a significant difference in some cases where users need instantaneous app responsiveness. Mabye you know how to reproduce apparent caching effect that TabView uses such that myTabView function can compete with TabView in rendering time. $\endgroup$ – Ariel Sepulveda Nov 20 '18 at 19:31
  • $\begingroup$ I don't have a generic solution but if you could provide a problamatic case and describe the behavior you are after, then we can try to find a solution. $\endgroup$ – Kuba Nov 20 '18 at 19:35
  • $\begingroup$ The code I have for myTabView is maybe too lengthy and I'm not sure that going over all the details in this forum is exactly what I would like to do at this moment. I will later try to create a simple example where the problem is clearly presented such that we can work on it. Meanwhile I hope that WRI listens to this conversation and prioritizes a solution soon. Thanks! $\endgroup$ – Ariel Sepulveda Nov 20 '18 at 20:08
1
$\begingroup$

You could do something like this:

i = 1;
tab[text_, pos_Integer, sel_Integer] :=
 Pane[text, ImageMargins -> -3, FrameMargins -> 4, BaseStyle -> 
   If[pos === sel, 
    {Background -> LightGray, FontWeight -> Bold},
    {Background -> Gray, FontWeight -> Plain, FontColor -> White}]]

TabView[{Dynamic@tab["x", 1, i] -> "The x tab is selected", 
  Dynamic@tab["y", 2, i] -> "The y tab is selected"}, Dynamic@i, 
 Background -> LightGray]

enter image description here

I also wished TabView would be improved one day. As it is now and has been for years it is impossible to do professional looking interfaces.

$\endgroup$
  • $\begingroup$ I like how you created the tab background by the negative ImageMargins. Still, there's a thin white line below the y and the empty area at the right of the last tab should have another color. Additionally, I edited my original post to show that a white line also appears at the left of the TabView when it is contained inside another item with a non-white background. $\endgroup$ – Ariel Sepulveda Nov 21 '18 at 12:46
  • $\begingroup$ I know, TabView is just pretty bad. Please call Wolfram Support and complain ... I either live with its limitations, or I follow Kubas advice. $\endgroup$ – Rolf Mertig Nov 21 '18 at 16:55

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.