Page 1 of 1

[Solved]slider in list box

Posted: Sat Jul 19, 2008 04:43
by K0h4n
few days ago i'm asking about the mouse enter a window in this thread:
http://www.cegui.org.uk/phpBB2/viewtopic.php?t=3412
i'm creating chat window using listbox and editbox
each window (main window, listbox and editbox) i subscribe the same event to achieve the transparent once the cursor leaves the window
the problem appear once the text reach bottom and the slider appear
if i put my cursor on the slider, the main window will be transparent again (same effect once the cursor leaves the window)

i try this code:

Code: Select all

Listbox* chatLog = static_cast<Listbox*> (wmgr->getWindow((utf8*)"InGame/ChatWindow/ChatLog"));
Window *bar = static_cast<Window*> (chatLog->getVertScrollbar());
chatLog->setShowHorzScrollbar(false);
chatLog->setShowVertScrollbar(true);


and subscribe this event:

Code: Select all

bar->subscribeEvent(Window::EventMouseEnters,
          Event::Subscriber(&MainFrameListener::handle_InGameRoomChat_Mouse_Enters, this));
bar->subscribeEvent(Window::EventMouseLeaves,
          Event::Subscriber(&MainFrameListener::handle_InGameRoomChat_Mouse_Leaves, this));


but its not solve the problem

is there any way to make the window as one group
and subscribe an event to the group and affect all the window?
or maybe there is a parent child system so when the cursor enter the parents area some event is triggered

any help is appreciated

Posted: Sat Jul 19, 2008 16:20
by CrazyEddie
I did not consider this in the other thread, and I'm not certain about a good clean solution either.

Unfortunately, I don't think there is a way to group windows in such a way that the events would be 'common' to the group.

You had the right kind of idea with subscribing to the same event on the scrollbar, the only solution I can think of at the moment is to subscribe the handler to the component parts of the scrollbar also; the increase button, the decrease button, and the thumb. Yes, that's a horrible solution, but at the moment, nothing else comes to mind.

I think this is a definite issue, and is something that should be addressed somehow.

CE.

Posted: Sat Jul 19, 2008 19:03
by K0h4n
wow
i'm glad i can solve it now

is it possible to program using function getXPosition, getYPosition, getWidth, getHeight in window class to solve this matter?
i think once the cursor inside or outside the the range of the main window, then the transparent event will be triggered
i cant figure it out how to do it
but i think it is possible

anyway thank you eddie

Posted: Sun Jul 20, 2008 09:32
by CrazyEddie
You could use the Window::isHit member to discover whether the mouse is within the main window; you pass in a CEGUI::Vector2 containing the mouse position in screen pixels and it will return true if the mouse falls within the window's area (the window must not be disabled for it to work).

HTH

CE.