Exchange click event between buttons
Exchange click event between buttons
Hello ^^ I have one little question. Is there a non masochistic way of exchanging a click event between buttons? I mean to make it so that one button is aware that other has been pressed or clicked or whatever. Is this possible within the engine?? Because I want to modify buttons a bit ;p
Teh Uber-Pwner xD
First off, why? Just so we know what your plans are and may be able to suggest alternatives.
Maybe you have a few buttons in a row and want only one selected at any time?
All GUI elements have an OnEvent function which you could pass an event to i suppose so maybe you could pass an event, which you've created yourself, which tells it that it should un-press itself (if you're trying to do what i said above) but i think that would make it fire off an event to say it had been pressed which would no doubt cause you problems... But i'm sure you could get round that by making your own Button class and changing a few things from the standard implementation to prevent these things from happening.
Maybe you have a few buttons in a row and want only one selected at any time?
All GUI elements have an OnEvent function which you could pass an event to i suppose so maybe you could pass an event, which you've created yourself, which tells it that it should un-press itself (if you're trying to do what i said above) but i think that would make it fire off an event to say it had been pressed which would no doubt cause you problems... But i'm sure you could get round that by making your own Button class and changing a few things from the standard implementation to prevent these things from happening.
Well I'm currently making some modifications to the gui to make it more windows-like. I've started with buttons. I've made them change color on hover which is simple part. Also when you press lmousebutton on a button and change cursor position to be out of the button without releasing the lmouse then it's appearance is changing so it doesn't look pressed ^^ and if you will hover it again then it will again change appearance to pressed ;p just like in windows. My problem hovewer is that if I press one button and do the thing described above but with hovering other buttons then those buttons change their appearance to hovered... This should not happen when a button is pressed.. That's why I want to exchange click or press event between them... I'll release the beta version when I'll get this part to wokr ;p;p;p
Teh Uber-Pwner xD
Yeah but how to transfer this variable to other buttons? :p so they can be aware that it is true? I don't want to use global variables because I want it to be made the "Irrlich way" as I would like this functionality to be added to the future Irrlicht versions ;p (I mean hovering and windows like behaviour and stuff ;p)
Teh Uber-Pwner xD
Don't know if this helps but, IGUIElements store a pointer to the manager interface, so with a few changes you should be able to store a variable in the manager and any element could get it through that interface.RhavoX wrote:Yeah but how to transfer this variable to other buttons? :p so they can be aware that it is true? I don't want to use global variables because I want it to be made the "Irrlich way" as I would like this functionality to be added to the future Irrlicht versions ;p (I mean hovering and windows like behaviour and stuff ;p)