Page 1 of 1

Arrows on a image - widget

Posted: Mon Apr 20, 2009 01:03
by sjcomp
Hello,

I would like to display an image map with a few arrows on top. I want to move the ends of these arrows with the mouse. Basically I would like to be able to set position and direction of multiple arrows. I can display an image using StaticImage. I can track the mouse presses on the static image. Should I modify the texture of the static image to draw arrows and keep track of the selected tip? Maybe there is an easier way to do that?

Thank you.

Re: Arrows on a image - widget

Posted: Mon Apr 20, 2009 08:35
by CrazyEddie
Hi,

In the current releases I think updating the source texture is the way to go here, though obviously that can be complicated depending upon your point of view.

It's possible in future releases - from 0.7.0 onwards - that this could be done more easily with just CEGUI, by perhaps create a simple custom widget that would have a collection of the 'arrow' images each which had position and orientation.

So yeah, for now, I think manually updating the texture.

CE.

Re: Arrows on a image - widget

Posted: Mon Apr 20, 2009 23:57
by sjcomp
Thanks, CE. I thought I have seen a widget that allowed selection of the color by clicking on the color plane in the widget, similar to standard color selection dialogs. I can not find it again. Am I imagining things?

Thanks.

Re: Arrows on a image - widget

Posted: Tue Apr 21, 2009 08:37
by CrazyEddie
I also have a vague recollection of something similar posted here, although a quick search didn't show anything particularly directly useful. I did find posts from people that mentioned their colour selectors (Evak, daves), not sure if their code is available though.

CE.

Re: Arrows on a image - widget

Posted: Sun Apr 26, 2009 22:31
by sjcomp
Hello, a simple question. How do I trap mouse events over a static image? I would like to capture right and left mouse clicks. Ideally I would like to do it the same way as the subscription to button clicks:

Code: Select all

CEGUI::GlobalEventSet::getSingleton().subscribeEvent(
   CEGUI::StaticImage::EventNamespace + "/" + CEGUI::StaticImage::LeftMouseClick,
   CEGUI::Event::Subscriber(&SomethingTodo));


StaticImage is not a class. I see that it is based off the DefautlWindow type, which is GUISheet class, which is Window class. Theoretically I can use:

Code: Select all

CEGUI::GlobalEventSet::getSingleton().subscribeEvent(
   CEGUI::Window::EventNamespace + "/" + CEGUI::Window::EventMouseButtonDown,
   CEGUI::Event::Subscriber(&SomethingTodo));

But that would give me the subscription to all window events... How can I narrow it down to a specific window? Should I simply check the source of event in my subscriber?

Thanks.

Re: Arrows on a image - widget

Posted: Mon Apr 27, 2009 00:12
by sjcomp
When I use CEGUI::Window::EventNamespace then my events for button presses are masked (subscriber to CEGUI::PushButton::EventClicked is not called any more). How can I help that?

Re: Arrows on a image - widget

Posted: Mon Apr 27, 2009 09:20
by CrazyEddie
In answer to the part about only caring about one particular subclass, then yes, you should test the source class in your handler.

With regards to the issue about 'higher level' events being inhibited, I can't explain that, since there's nothing in the code that could cause that as far as I know.

CE.

Re: Arrows on a image - widget

Posted: Tue May 05, 2009 22:36
by sjcomp
Thanks CE.

I also noticed that when use global subscription to the ButtonDown events, mouse events stop being processed properly for the top windows. For example when I show a window I have to click on it before the buttons on this window show tooltips when mouse hovers over them. If I click on a button that shows a different gui window everything works fine, but if I click the button that hides current window, then when I show this window again, only the previously pressed button stays focused and clicks anywhere trigger that button. Obviously I'm the one who triggers the events, but the name of the triggered window is not set properly in the EventArgs. If I comment out the global event subscription to the ButtonDown everything works as required, but I do not know when mouse clicks the static image.

Can I somehow specifically subscribe to the button presses on static image?

Thanks.

Re: Arrows on a image - widget

Posted: Tue May 05, 2009 22:51
by sjcomp
I found out that if I subscribe to the events from a particular window then I do not have the issues described above.

Code: Select all

CEGUI::WindowManager::getSingleton().getWindow(MyStaticImageWindowName)->subscribeEvent(
   CEGUI::Window::EventMouseButtonDown,
   CEGUI::Event::Subscriber(&CCeguiGUI::WindowClicked, this));