A generic error?!

For help with anything that CEGUI doesn't offer straight out-of-the-box, e.g.:
- Implementation of new features, such as new Core classes, widgets, WindowRenderers, etc. ...
- Modification of any existing features for specific purposes
- Integration of CEGUI in new engines or frameworks and writing of new plugins (Renderer, Parser, ...) or modules

Moderators: CEGUI MVP, CEGUI Team

PeakGao
Just popping in
Just popping in
Posts: 9
Joined: Fri Apr 21, 2006 07:04

A generic error?!

Postby PeakGao » Fri Apr 21, 2006 07:40

Hi,
I try to use CEGUI, but i found a generic error about event's fire-occasion.

my english is poor, :) so please see example.

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 ...?

User avatar
lindquist
CEGUI Team (Retired)
Posts: 770
Joined: Mon Jan 24, 2005 21:20
Location: Copenhagen, Denmark

Postby lindquist » Tue Apr 25, 2006 16:27

You can work around this by subscribing to the SelectionChanged event instead.

This event is fired in your //ignore block of Listbox::onMouseButtonDown.

But I agree to some extent that the base class handling should be moved to the bottom.

I'm adding a ticket to our tracker so I can discuss it with the team. The "issue" is that applying the "fix" will change the order events are fired.

PeakGao
Just popping in
Just popping in
Posts: 9
Joined: Fri Apr 21, 2006 07:04

Postby PeakGao » Thu Apr 27, 2006 03:16

lindquist wrote:You can work around this by subscribing to the SelectionChanged event instead.

This event is fired in your //ignore block of Listbox::onMouseButtonDown.

But I agree to some extent that the base class handling should be moved to the bottom.

I'm adding a ticket to our tracker so I can discuss it with the team. The "issue" is that applying the "fix" will change the order events are fired.



for my handler depend on mouse actions, so i use MouseButtnDown event instead of SelectionChanged event. in the CEGUI, SelectionChanged event do not only depend on mouse actions, e.g. Listbox::setItemSelectState(...)


Return to “Modifications / Integrations / Customisations”

Who is online

Users browsing this forum: No registered users and 13 guests