Dialog.OpenFile()
Posted
#1
(In Topic #536)
Enthusiast

Posted
Enthusiast

maybe its less typing to use If instead of If Not or IF Else …
Posted
Guru

So if true an error has occurred.
Posted
Regular

BruceSteers said
It's based on the return is an error value I think.
So if true an error has occurred.
I think I see where you are coming from Bruce, but I don't think True indicates an error in this case.
I tried some test code yesterday. Here is my code showing breakpoints and object viewers, in case anyone is interested.
Clearly Dialog.OpenFile() needs to return an indication for the programmer that either the open or cancel button was pressed.
Also note that there is no attempt (internally in the Dialog class) to clear the Dialog.Path or Dialog.Paths array when cancel is pressed.
There is no class property to indicate that Open or Save dialog has been requested, and no Events are raised.
There is no attempt to return error codes via the Return value (as might be the case if the return type was an integer).
The return type is a Boolean which indicates either Open or Cancel (or Save/cancel in the case of the Save method).
So my conclusion is that the logic appears to be reversed from what I would expect. {although I suspect the author had his reasons}
BTW;
I tested using gb.Form.Dialog (the enhanced dialog).
But when I tried to run my code with the standard dialog I started getting this strange error.
There's probably something nasty in my code, but I can't immediately see what it is.
Posted
Guru

Posted
Enthusiast

Posted
Regular

Posted
Enthusiast

when a one-liner does it all ?
Posted
Regular

grayghost4 said
I may be missing something …
That's a good question.
Take a look at all the Methods, Properties & Events available with the FileChooser compared to a relatively simple dialog box,
If you don't need any of these, then use a Dialog. But maybe your app needs Bookmarks or you need some of the Events on offer.
There are quite a few directory/file related controls available in Gambas…possibly too many.
Posted
Regular

Posted
Regular

cage said
While the Dialog Openfile works quite well, I have not found that the Dialog Path can be set even though the documentation says it can…
It looks like I can set the Dialog.Path property, but it doesn't behave the way I would expect it to.
If I set it like this:-
…or like this:-
Code (gambas)
…the dialog opens in the /home directory but expands the /home/steve directory like this:-
But if I do this:-
Code (gambas)
…it opens correctly in the /home/steve directory (i.e. shows the files for /home/steve in right-hand pane).
In the Help for Dialog.Open() it shows an example with: Dialog.Path = User.Home
It says that the dialog will show the users home directory (which is does) so I'm not sure if this is a bug or 'by design'.
Posted
Regular

1 guest and 0 members have just viewed this.







