Page 1 of 1

[slvd]are there any way to monitor the cursor state changing

Posted: Tue Nov 17, 2009 06:40
by Cloudage
i hope there will be some events notices me what the cursor exactly is(arrow,sizing,textinputing,busy,etc) when it changed,whatever i use or not use the cegui cursor.

i`m currently working on my level editor,and for some reason i`d better let user use system cursor,so i need to change the system cursor to 'textinput' when user sopt on a editbox,or change it to 'sizing' when user spot on a sizeable FrameWindow`s border.

is there a simple and directly solution?
thanks for any help.

Re: are there any way to monitor the cursor state changing?

Posted: Tue Nov 17, 2009 09:35
by scriptkid
Hi,

The mousecursor has an 'EventImageChanged' event, which is fired when the cursor changes. So you could intercept it to handle your own cursor appearance. You will receive a 'MouseCursorEventArgs' argument type containing the cursor and its current image (CEGUI::Image). This makes me think that it does not actually have a state. So you should interpret the different images yourself.

I don't have all code at hands, but your should probably listen to it with this code:

Code: Select all

MouseCursor::getSingleton().subscribeEvent(MouseCursor::EventImageChanged, Event::Subscriber(&YourApp::YourHandler, this));


Note that in order for this to work, your Cegui windows need to be 'alive'. Meaning that you should pass mouse events (which you receive in your editor application) into Cegui aswell.

Also, the internal behaviour changes the cursor image, so you might end up with two cursors. I think that you can overwrite this by resetting the cursor image to Null from your event handler. But i am not sure about this behaviour.

Anyway, good luck :)

Re: are there any way to monitor the cursor state changing?

Posted: Tue Nov 17, 2009 10:04
by Cloudage
thank you scriptkid, i got it.