I try to use CEGUI, but i found a generic error about event's fire-occasion.
my english is poor,
in your code: (eg)
Code: Select all
void Listbox::onMouseButtonDown(MouseEventArgs& e)
{
// base class processing
Window::onMouseButtonDown(e);
if (e.button == LeftButton)
{
// ignore
}
}
in "Window::onMouseButtonDown(e)", will fire "MouseButtonDown" event. what is event? event means something had happened! in the proccess of above, "Window::onMouseButtonDown(e)" had fired event, but "Listbox::onMouseButtonDown" does not begin handle itself code, so i think that you should move the code "Window::onMouseButtonDown(e)" to end of the function.
see the error raises some question:
-- lua code
Code: Select all
function onMouseDownHandler(args)
local mouseArgs = CEGUI.toMouseEventArgs(args)
local listbox = CEGUI.toListbox(mouseArgs.window)
local selectedItem = listbox:getFirstSelectedItem() -- there, selectedItem equal to nil, for listbox does not begin to handle itself code
local index = listbox:getItemIndex(selectedItem)
if mouseArgs.button == 0 then -- left button
-- something
elseif mouseArgs.button == 1 then -- right button
-- something
end
end
in cegui library, has a great lot of the same code.
is my idea wrong or ...?
