ControlP5 : How to add callbacklistener on a tab

edited January 2018 in Library Questions

Hello,

I made a complex IU where tabs may cover some controller. I want the priority to be given to the table button. But even if the tab is drawn above, i click on the button in the background.

I tried a function like myTab.onEnter(toFront);

With the callback listener toFront is simply

CallbackListener toFront = new CallbackListener() {
      public void controlEvent(CallbackEvent theEvent) {
        theEvent.getController().bringToFront();
      }
    };

but this option works only with controller object...

Any tips ?

Answers

  • Please post an MCVE. However, if you are trying to click a controller that is cover by another controller, I am going to go ahead and say that is a not proper designed UI. Post a demo and you will get more responses.

    Kf

  • Definitely share an MCVE.

    One simplest conceptual approach: if the tab is open, then don't enable / render / call the button. It sounds like you are trying to draw the button, render its click zone, etc. etc. anyway, but then avoid activating it through precedence. The easier approach is "when the tab is open, there is no button" (or the button exists, but is not on the screen).

    I'm not very familiar with ControlP5, but even if showing/hiding or activating/deactivating was hard or impossible to do (and I don't think it is!) then you could still just say "when the tab is open, set the button coordinates to -100, -100 -- when the tab is closed, restore the normal components."

Sign In or Register to comment.