3
$\begingroup$

How can we combine two UI elements with controls such that they all work? Overlay forces you to choose which layer receives the input. Can we do both at the same time, provided I am sure there is no overlap?

For example here, you can't push the button, and if you change the layer, you can't flip the tabs.

Framed@Pane[Overlay[{
    Item[Button["Button"], Alignment -> {Right, Top}],
    Item[TabView[{"Content 1" -> 
        Pane["Content 1", {285, 50}, Alignment -> Center], 
       "Content 2" -> 
        Pane["Content 2", {285, 30}, Alignment -> Center], 
       "Content 3" -> 
        Pane["Content 3", {285, 50}, Alignment -> Center]}, 
      Alignment -> Center], Alignment -> {Left, Center}]
    }, All, 2, ImageSize -> {300, 100}]]
$\endgroup$
  • 1
    $\begingroup$ Why is it important that the tab view overlay the button? If you are trying to build something that looks like a dialog window, it is more usual to put buttons like OK or Cancel below any element like a tab view. And much easier. $\endgroup$ – m_goldberg Jun 19 '17 at 3:12
  • $\begingroup$ @m_goldberg Trying to save some some space on the screen and also put relevant controls close to each other. I know that some of the corners of windows are never used (like in tab view), so I wanted to put come controls there that would do similar things, but tab specific, like export or import. $\endgroup$ – Stitch Jun 19 '17 at 11:57
  • 1
    $\begingroup$ I strongly recommend not putting controls in odd places just to save space. I spent the last 15 years of my career as an UI builder, and I can tell you that users get very upset with UI layouts that are too creative. People develop work habits based on the normal control layout used by their OS. They don't like it when those well-established habits suddenly don't work. $\endgroup$ – m_goldberg Jun 19 '17 at 17:01
  • $\begingroup$ @m_goldberg The button is doing the same thing, but tab-specific, so I thought putting it next to the tab selector is good. Should I not use Overlay then and put it next to the TabView? Are there best practices? $\endgroup$ – Stitch Jun 19 '17 at 23:42
  • $\begingroup$ I strongly suspect you should not use Overlay, but currently your question doesn't give enough info for me to suggest an alternative. It would be good if you were to edit your question and describe your problem in terms of UI use-cases -- how each tab and button pairing will function from the user's point of view. $\endgroup$ – m_goldberg Jun 20 '17 at 0:02

Your Answer

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

Browse other questions tagged or ask your own question.