Hey all,
This is my first post here, so hi for the first time.
I'm implementing a basic GUI to edit object values in my program and I intended to use IGUIElement::UserData to store information on which object each editor GUI element is tied to, but then I found that the UserData field doesn't exist in 1.7.2. Its removal is not mentioned in the changelog and I'm wondering why it was removed and what alternative was provided. Any explanations or workarounds?
I also notice that IGUIEmpty was removed. I worked around that by using an IGUITab independent of the IGUITabControl. This removal was also not mentioned in the changelog.
I'm using a CHM version of 1.7.1 since there's no CHM for 1.7.2 and I have been unable to produce a CHM of my own from the HTML docs provided. CHM allows me to quickly search the index for reference where as with HTML I have to select the first letter of what I'm searching for then scroll to the item I want, which is very tedious.
Thanks in advance all.
IGUIElement::setUserData() and the like not in 1.7.2
Re: IGUIElement::setUserData() and the like not in 1.7.2
Both never existed in Irrlicht...
Could it be you have been using a patched Irrlicht version? IGUIEmpty sounds familiar - I wrote such an element once for a racer of mine (and could be I re-used it when working for StarSonata) and also posted it in the forum. My version was just a custom element, not even an Irrlicht patch.
Could it be you have been using a patched Irrlicht version? IGUIEmpty sounds familiar - I wrote such an element once for a racer of mine (and could be I re-used it when working for StarSonata) and also posted it in the forum. My version was just a custom element, not even an Irrlicht patch.
IRC: #irrlicht on irc.libera.chat
Code snippet repository: https://github.com/mzeilfelder/irr-playground-micha
Free racer made with Irrlicht: http://www.irrgheist.com/hcraftsource.htm
Code snippet repository: https://github.com/mzeilfelder/irr-playground-micha
Free racer made with Irrlicht: http://www.irrgheist.com/hcraftsource.htm
Re: IGUIElement::setUserData() and the like not in 1.7.2
Could be that the CHM I saw it in was from a patched version of Irrlicht. I doubt it though, here's a copy from the CHM:
I'm figuring out a way around it by searching for the class that the given IGUIElement's ID is associated with (so I store a list of all the IDs of the IGUIElements that are owned by that class) and then letting the class handle the IGUIElement's event.
Thanks for your help.
Code: Select all
void* irr::gui::IGUIElement::UserData [protected]
Definition at line 776 of file IGUIElement.h.
Referenced by getUserData(), and setUserData().
Thanks for your help.
Re: IGUIElement::setUserData() and the like not in 1.7.2
Must have been a patched version.
IRC: #irrlicht on irc.libera.chat
Code snippet repository: https://github.com/mzeilfelder/irr-playground-micha
Free racer made with Irrlicht: http://www.irrgheist.com/hcraftsource.htm
Code snippet repository: https://github.com/mzeilfelder/irr-playground-micha
Free racer made with Irrlicht: http://www.irrgheist.com/hcraftsource.htm
-
- Posts: 288
- Joined: Wed Apr 16, 2008 1:45 am
- Contact:
Re: IGUIElement::setUserData() and the like not in 1.7.2
You could edit irrlicht source and add it in if you would like, not a very hard thing to create.
Re: IGUIElement::setUserData() and the like not in 1.7.2
Ok. Well I didn't want to modify the library, but if it comes down to that I will.
-
- Posts: 288
- Joined: Wed Apr 16, 2008 1:45 am
- Contact:
Re: IGUIElement::setUserData() and the like not in 1.7.2
It would be a minor change because its only two functions and one variable. Hmmm... I am not sure if you can accomplish this through inheritance but it could be possible. (either inherit each class you use and add the function yourself through that) I don't think you would be able to inherit the IGUIElement without changing internal code... So something like
Not tested just written here.
There would most likely be a few more things you must do but that is a general example.
Code: Select all
class myIGUIImage : IGUIImage
{
public:
void setUserData(void* dataIn){ data=dataIn;}
void* getUserData(){return data;}
protected:
void* data;
};
There would most likely be a few more things you must do but that is a general example.
Re: IGUIElement::setUserData() and the like not in 1.7.2
That's a great idea insomniac. I'll try it if push comes to shove.
Thanks.
-- Edit --
I've been trying the derivation thing with IGUIWindow since I want to make certain windows have a custom event receivers but I've run into a problem. IGUIEnvironment only has addWindow() and casting the pointer to my derived type afterwards lead to random bugs (like looping event, although that's probably because I called OnEvent() for the derived window from within my general event receiver).
Any tips on how to add my custom window to the gui environment? Also, do I need a destructor for my derived class?
-- Edit again --
I checked out the CHM doc I'm using and yes, it's based on a patched version. That version adds IGUIEmpty, IGUICompass, and IGUIProgressbar
It seems I have to create a IGUIElementFactory and then register my new element. Lots of work, but it'll pay off (and the experience is always useful).
Thanks.
-- Edit --
I've been trying the derivation thing with IGUIWindow since I want to make certain windows have a custom event receivers but I've run into a problem. IGUIEnvironment only has addWindow() and casting the pointer to my derived type afterwards lead to random bugs (like looping event, although that's probably because I called OnEvent() for the derived window from within my general event receiver).
Any tips on how to add my custom window to the gui environment? Also, do I need a destructor for my derived class?
-- Edit again --
I checked out the CHM doc I'm using and yes, it's based on a patched version. That version adds IGUIEmpty, IGUICompass, and IGUIProgressbar
It seems I have to create a IGUIElementFactory and then register my new element. Lots of work, but it'll pay off (and the experience is always useful).
-
- Posts: 288
- Joined: Wed Apr 16, 2008 1:45 am
- Contact:
Re: IGUIElement::setUserData() and the like not in 1.7.2
Yeah, you would need to add your element. casting from a base class to derived class is a very bad thing Only do that when you know the base class is from a derived class. Otherwise you corrupt memory by accessing something that isn't really there or used by something else. Doing that will help you in the future though yes, always does