Clicking through labels or images on a DirectButton object??

I create a button and place some labels and some images on the button frame. But when I try to click on the button I can only execute the button command by clicking on the black background of the button.

Is it possible to click through the images and the labes so the button command is still executed when I click on those objects?

Screenshot of my button:

Here is the code for my button:

w = 1.0
h = 0.4

frame = DirectButton(scale=1, frameColor = (0,0,0,1), frameSize = (-w/2, w/2, -h/2, h/2), pos = (0,0,0), command = test)

item_name = DirectLabel(parent = frame, text="ItemName1 or Family1", text_align = TextNode.ALeft, scale=0.05, text_bg = (0,0,0,1), text_fg = (1,1,1,1), pos = (-w/2 + 0.05, 0, h/2 - 0.08))

label1 = DirectLabel(parent = frame, text="Medium blabla bla", text_align = TextNode.ALeft, scale=0.05, text_bg = (0,0,0,1), text_fg = (1,1,1,1), pos = (-w/2 + 0.2, 0, h/2 - 0.2))
label2 = DirectLabel(parent = frame, text="High blabla bla", text_align = TextNode.ALeft, scale=0.05, text_bg = (0,0,0,1), text_fg = (1,1,1,1), pos = (-w/2 + 0.2, 0, h/2 - 0.3))

icon1 = DirectFrame(parent = frame, image = "img/fl27.png", scale = 0.04, pos = (-w/2 + 0.1, 0, h/2 - 0.2))
icon2 = DirectFrame(parent = frame, image = "img/fl27.png", scale = 0.04, pos = (-w/2 + 0.1, 0, h/2 - 0.3))

I guess I could make the text and the images as buttons to the same command function but there must be a simpler way :slight_smile:

Use suppressMouse=0 on the labels and frames.

I believe setting state = DGG.DISABLED on these should also do it, since it will not make them clickable. Though you will also need to be running without direct-gui-edit mode in this case.

David

Thanks a lot, it works as intended :slight_smile: