hey Leith!
i just checked source, click events are sent in UI::SendClickEvent()
void UI::SendClickEvent(StringHash eventType, UIElement* beginElement, UIElement* endElement, const IntVector2& pos, MouseButton button,
MouseButtonFlags buttons, QualifierFlags qualifiers)
{
VariantMap& eventData = GetEventDataMap();
eventData[UIMouseClick::P_ELEMENT] = endElement;
eventData[UIMouseClick::P_X] = pos.x_;
eventData[UIMouseClick::P_Y] = pos.y_;
eventData[UIMouseClick::P_BUTTON] = button;
eventData[UIMouseClick::P_BUTTONS] = (unsigned)buttons;
eventData[UIMouseClick::P_QUALIFIERS] = (unsigned)qualifiers;
// For click end events, send also the element the click began on
if (eventType == E_UIMOUSECLICKEND)
eventData[UIMouseClickEnd::P_BEGINELEMENT] = beginElement;
if (endElement)
{
// Send also element version of the event
if (eventType == E_UIMOUSECLICK)
endElement->SendEvent(E_CLICK, eventData);
else if (eventType == E_UIMOUSECLICKEND)
endElement->SendEvent(E_CLICKEND, eventData);
}
// Send the global event from the UI subsystem last
SendEvent(eventType, eventData);
}
in the caller functions the endElement
argument is obtained through UI::GetElementAt()
so if we want click event from BorderImage, we just need to make them to be considered “input-enabled”, which i suppose its determined the “Is Enabled” attribute.
i finally gotcha?