CEGUICommonFileDialog bug & fix

For help with anything that CEGUI doesn't offer straight out-of-the-box, e.g.:
- Implementation of new features, such as new Core classes, widgets, WindowRenderers, etc. ...
- Modification of any existing features for specific purposes
- Integration of CEGUI in new engines or frameworks and writing of new plugins (Renderer, Parser, ...) or modules

Moderators: CEGUI MVP, CEGUI Team

electromaggot
Just popping in
Just popping in
Posts: 4
Joined: Wed Mar 01, 2006 07:35

CEGUICommonFileDialog bug & fix

Postby electromaggot » Wed Mar 01, 2006 17:07

Hi y'all,

1st of all, I'm new here and to all of this, so congratulations on a really cool system. I look forward to contributing where I can.

I looked at a bunch of GUI toolkits; CEGUI is the slickest... and that it's not tied to the OS is excellent. Moreover, I needed (and right away) something along the lines of Windows' CFileDialog. I found that in CEGUICommonFileDialog on http://www.ogre3d.org/wiki/index.php/CEGUICommonFileDialog... but it's been a hassle.

Could this feature ever be "more officially" included into CEGUI? I understand that this is a GUI toolkit with which you can construct such dialogs -- and that it is OS-dependent -- but a File Open/Save Dialog is a very ubiquitously-used thing, so it strikes me as being just as important as other "composite" (but perhaps more low-level) GUI controls. Anyway, that's just a suggestion. Maybe a file-access layer could be abstracted out like the renderer is, so that it can be OS independent. I dunno. Probably too much work. :(

Okay, onto the bug. I'm using CEGUI Mk-2 Release 0.4.1 for VC7.1. I tried using CEGUICommonFileDialog by itself and even as it's included in martignasse's TestaSkin tool (awesome, by the way!); in both I see the same problem.

CEGUICommonFileDialog.h contains this code:

Code: Select all

         // ------------------ Inner class that represents drive, path and filename ------------------
         class _Path : public ListboxTextItem
         {
            private:
            protected:
            public:
               _Path(const String& szRelativePath) :
                  szAbsolutePath(szAbsolutePath),
                  szRelativePath(""),
                  ListboxTextItem(szAbsolutePath) {};
               virtual ~_Path(void){};
               String szAbsolutePath;
               String szRelativePath;
         };

which I don't understand. In the constructor, he passes in a string to initialize with, but instead initializes a member and the base class constructor using an uninitialized member.

I don't know how this was working for anyone else. On my machine, the uninitialized szAbsolutePath must have "referred" to a huge string, which sent ListboxTextItem into outer space. Windows' pagefile would shoot up over 1.3 GB and the demo would hang.

I changed the constructor to this:

Code: Select all

               _Path(const String& szRelativePath) :
                  szAbsolutePath(""),
                  szRelativePath(szRelativePath),
                  ListboxTextItem(szRelativePath) {};

Don't know if that's what he originally intended, but it fixes the problem.

Also, and maybe this is just me, but I find passing in arguments to a constructor/function having the exact same names as members/locals of that function to be strange, and possibly confusing.

Anyway, I'd appreciate any thoughts... Thanks!

User avatar
lindquist
CEGUI Team (Retired)
Posts: 770
Joined: Mon Jan 24, 2005 21:20
Location: Copenhagen, Denmark

Postby lindquist » Wed Mar 01, 2006 20:29

Hi.

It's unlikely that CEGUI will provide this functionality in the base library.
But.. There has been some talk about creating a "official" add-on library which would contain this kind of extras.

When or if this will happen is still unknown, but it's in (at least my) mental todo list...

As to the bug fix you propose the common file dialog is by no means official on not supported by us.
It's not written in portable code and thus not in the true CEGUI spirit.
I suggest you send a patch to the author.

HTH


Return to “Modifications / Integrations / Customisations”

Who is online

Users browsing this forum: No registered users and 4 guests