Button Triiger area only in upper third

I’m creating buttons like this:

int  HarmGenEditor::createBut(String Name)
	int j = buts.size() + 1;
	static int prex = 80;
	buts.add(new DragAndDropObj());
	buts.getLast()->setBounds(prex, 10, 30, 30);
	int pw = buts.getLast()->getWidth();
	prex += pw + 10;
	return j;
buts.getLast()->onClick = [this, j] {
	DBG((screens[j]->showMe ? "true" : "false"));
	screens[j]->showMe = !screens[j]->showMe;


The trigger function is only called, when I click in the upper 3rd of the button (i.e. just above the text). Any idea, wha’ts going wrong?

not sure but you can simplify a lot of that:

auto* button = buts.add(new DragAndDropObj());
return buts.size();

Agreed. Hadn’t realize, that add return the pointer to the added item.
But that doesn’t change the problem.

Do you have another Component partially covering the buttons?

Add some DBG statements that print out the bounds of your buttons when they’re clicked. Make sure they’re what you expect. Also if you customized the button so it contains child components, did you turn off mouse interaction for them or add the button as a mouse listener for its children?

Indeed, the file landing zone was obscuring the button. I reduced the zone, and it’s now working as expected. But now, it’s difficult to drag’drop. Can’t the target zone be given a lower priority or something like that?

make your GUI bigger?

It’s already 1100x 1150. Which is obviously too big for a normal screen. And much more so as VST. Maybe I can mark the landing zone with some overlay.