Page 1 of 1

adding GUIFileSaveDialog : how ?

Posted: Sat Nov 17, 2007 6:47 pm
by hey_i_am_real
Hi.

Again, little details make the difference.
When you need to quickly develop a prototype application, you don't want wasting your time coding some boring missing features ...

I know it's possible to create a GUIFileSaveDialog with GUIWindow and co, but this would be easier and faster if there was alaready a default GUIFileSaveDialog into the engine.

I'm going to make it and release the code with the hope this will be useful and added to the engine.


That's why I need some advices from experts and developers.

To me, there are two way to go :

1) adding a parameter to GUIFileOpenDialog to make the IGUIElement* FileNameText; optionnaly editable. (this would go with this patch here : http://irrlicht.sourceforge.net/phpBB2/ ... hp?t=24823 )

2) create a separate GUIFileSaveDialog gui element and add it to the engine


What do you think ?

Posted: Sat Nov 17, 2007 11:42 pm
by hybrid
I think bitplane already has one implementation available, but did not yet commit it, so first ask him. Should be the second alternative IIRC.

Posted: Sun Nov 18, 2007 3:10 pm
by hey_i_am_real
Thanks for this information. I'm going to send a PM to Bitplane.

Posted: Sun Nov 18, 2007 5:05 pm
by bitplane
I did start this a while back, but I lost the code in a hard drive crash :(
I just changed the file open dialog and added some extra methods and elements, I didn't finish it though, I wanted a nice combo box of filters, and to have the file name as an editable combo box (for autocomplete).
I was just going to rename the interface from IGUIFileOpenDialog to IGUIFileDialog, and add a couple of methods to tell the difference between a load and a save dialog.
Feel free to have a go at doing this, even if it's just the open dialog with an editable text box for now, it will give us a nice starting point.
imo the IFileSystem interface could also do with some changes, there's no concept of volumes or read-only folders- you can't cd into a zip file, or easily change drive in windows.. but that's another discussion entirely!

Posted: Sun Nov 18, 2007 11:36 pm
by hey_i_am_real
Ok. Thank you for this information Bitplane. :-)

I'll go on your path and will directly modify IGUIFileOpenDialog.

As I'm not planning to study the guts and bowels of Irrlicht, I will only make minor modifications.

Posted: Mon Nov 19, 2007 4:59 pm
by hey_i_am_real
Hi.

I've just posted the patch into the patch tracker on sourceforge.

Image

Here is a description of the patch :
This patch makes possible :
- to use the GUIFileOpenDialog to save a file.
- to see the end of a long directory name in the upper textbox.


This patch does :
- change the upper StaticText box into a disabled EditBox and rename it DirectoryText.
- add an EditBox at the bottom of the dialog, where the user can manualy specify and modify the filename, and name it FilenameText.
- add the method GUIFileOpenDialog::setFileName() to allow the user to set the content of the FilenameText box.


Files modified by this patch :
- CGUIFileOpenDialog.cpp
- CGUIFileOpenDialog.h
- IGUIFileOpenDialog.h


Detailed explanations :
- when the user select a file into the filelist, the path to this file is stored into the DirectoryText box, and the filename is stored into the FilenameText box.
- when the user clicks the OK button, the full file name is concatenated this way :

FileName = DirectoryText->getText();
FileName+= L"/";
FileName+= FilenameText->getText();


Notes :
- Tested on Linux only.
- It's not really required to rename GUIFileOpenDialog into GUIFileDialog as we could consider that we want to Open a Dialog to select a File ...


YG2F
BTW, I forgot to mention :
- the dialog size is not updated on font change

Posted: Mon Nov 19, 2007 9:20 pm
by bitplane
Cool thank you :)