G4P GPanel behaviour

Hello,

Regarding behaviour of GPanel
I am trying to make the entire surface of a GPanel responsive to an
.isOver type event
It appears that normal behaviour is for only the tab area to respond to mouseEvents not the body.
I have found that increasing the tab size to cover the entire panel works
but it is clunky to do, as I have to play with font sizes and letter choices to get the areas to match.
Catch with this is that it that it does make the Panel accidentally draggable.
when doing things inside the Panel

Is there a more elegant way or possibly a completely different approach.

The purpose of this is to be able to summon a normally hidden helper panel
whenever required and then dismiss the Panel when done by mousePressing outsidethe GPanel
anywhere else on the screen.

the test I am using is

void mousePressed(){
if (panel1.isOver()==false){panel1.setVisible(false);
}

thanks
Harry

That’s correct. If otherwise there would be a conflict between the panel and any controls placed on the panel.

There is no easy way to do this but you could hide the panel when it is collapsed like this

// Panel event handler
public void panel1_Click1(GPanel source, GEvent event) { //_CODE_:panel1:248744:
  println("panel1 - GPanel >> GEvent." + event + " @ " + millis());
  if (event == GEvent.COLLAPSED)
    panel1.setVisible(false);
} //_CODE_:panel1:248744:
2 Likes

Thanks for that it works but I was trying to avoid cursor placement precision
and an unnecessary extra click.
In practice Im finding that the very large tab technique does work as the odd
frame drag occurs but doesn’t really cause much bother
FWIW this helper app is a rudimentary calculator much like the basic osx calc
to assist entering values into value input boxes in the main app.

As I think more on it maybe I should use a window as the container instead.
In which case can I transfer the focus to the main window by clicking a button on the auxiliary window ( I use clicking on the result display as the method to transfer that value back to the main panel)

Thanks
Harry