RE: [Java-gnome-developer] FileSelection Dialog
Brought to you by:
afcowie
From: Jeffrey M. <Jef...@Br...> - 2003-12-08 12:28:54
|
Take a look at the testgtk example in src/examples/gtk. It demonstrates this widget and how to determine which button was pressed. > According to the gtk documentation the "filename" > property contains "The currently selected filename". > The behavior you are seeing is the behavior of the > underlying widget. You will need to check if the > user presses the OK or Cancel button. > > -Jeff > > > > > -----BEGIN PGP SIGNED MESSAGE----- > > Hash: SHA1 > > > > Hoping someone can help me with what should be quite > straight forward! > > > > I have a the following code: > > > > final FileSelection dialog = new FileSelection("Select File"); > > > > dialog.setModal(true); > > dialog.addListener(new DialogListener() { > > public boolean dialogEvent(DialogEvent event) { > > if (event.isOfType(DialogEvent.Type.RESPONSE)) { > > String filename = dialog.getFilename(); > > } > > > > ((Dialog) event.getSource()).destroy(); > > return true; > > } > > }); > > dialog.show(); > > > > > > So what happens is the file selection dialog opens. I select my file > > (say /home/work/build.xml) and click oK, the filename > > variable correctly > > contains the selected file. > > Now the problem is, if I select this file, but click cancel. > > I still end up with text in my filename variable, when I want it to > > contain nothing, because I didn't really choose a file. > > > > Anyone clear this up for me? > > > > Thanks, > > - -- > > [A n d r e w] > > - ------|------ > > -----BEGIN PGP SIGNATURE----- > > Version: GnuPG v1.2.3 (GNU/Linux) > > Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org > > > > iD8DBQE/0SCb2AKtqeH2FeQRArcwAJ9yD/Jr73aHHbb7D7FYKtRckH7FYgCaAm0P > > rdDC16FIrRVEt/6+H/V9aX0= > > =e/et > > -----END PGP SIGNATURE----- > > > > > > > > ------------------------------------------------------- > > This SF.net email is sponsored by: IBM Linux Tutorials. > > Become an expert in LINUX or just sharpen your skills. Sign > > up for IBM's > > Free Linux Tutorials. Learn everything from the bash shell > > to sys admin. > > Click now! http://ads.osdn.com/?ad_id=1278&alloc_id=3371&op=click > > _______________________________________________ > > java-gnome-developer mailing list > > jav...@li... > > https://lists.sourceforge.net/lists/listinfo/java-gnome-developer > > > > > ------------------------------------------------------- > This SF.net email is sponsored by: IBM Linux Tutorials. > Become an expert in LINUX or just sharpen your skills. Sign > up for IBM's > Free Linux Tutorials. Learn everything from the bash shell > to sys admin. > Click now! http://ads.osdn.com/?ad_id=1278&alloc_id=3371&op=click > _______________________________________________ > java-gnome-developer mailing list > jav...@li... > https://lists.sourceforge.net/lists/listinfo/java-gnome-developer > |