I am stumped on what should be simple. I call the dialog to save a file but I want a default file name to save as in the dialog in case the person doesn't feel like typing in a filename an automatically generated one is available if they just hit ok. It should work similar to the inputbox command where you can have a default already for the user.
Anybody know how to make this happen?
Dialog save file
Re: Dialog save file
If I am understanding you right, it is simple.
Have you tried setting "Dialog.Path" to the full file specification?
Yeah, "Path" in Gambas seems to refer to file/dir specifiers, not necessarily just directories.
Ced
Have you tried setting "Dialog.Path" to the full file specification?
Yeah, "Path" in Gambas seems to refer to file/dir specifiers, not necessarily just directories.
Ced
.... and carry a big stick!
- cogier
- Site Admin
- Posts: 1126
- Joined: Wednesday 21st September 2016 2:22pm
- Location: Guernsey, Channel Islands
Re: Dialog save file
I had a look at this but it seems that the Dialogue wont let you do this. However you can do it with a FileChooser. Have a look at the attached code.
Re: Dialog save file
I tested this before I replied.
Am I misunderstanding something?
Dialog.Path = User.Home &/ "Pictures/test.jpg"
This left "test.jpg" in the filename slot.Am I misunderstanding something?
.... and carry a big stick!
- cogier
- Site Admin
- Posts: 1126
- Joined: Wednesday 21st September 2016 2:22pm
- Location: Guernsey, Channel Islands
Re: Dialog save file
Further investigation discovered that the Dialog.Path works as required using gb.qt.gui but not if using gb.gui in a GTK desktop (Linux Mint 19.1 Cinnamon).
Now why is that?
Now why is that?
Re: Dialog save file
Nice sleuthing.
I don't know, maybe should be reported as a bug. I do know from the mailing list that qt is less "troublesome" for lack of a better word, perhaps more supported/preferred, than gtk. I do all my desktop projects as qt.
I don't know, maybe should be reported as a bug. I do know from the mailing list that qt is less "troublesome" for lack of a better word, perhaps more supported/preferred, than gtk. I do all my desktop projects as qt.
.... and carry a big stick!
Re: Dialog save file
nobody is missing anything. I did it with the dialog.path but it still does not work. I am using gtk which I have found to be the least troublesome.
The idea behind this is that I want to save a file from a program. I want to provide a default name for the user that includes date information in the file name, but still want the user to be able to name it as they wish and just leave a suggestion. I have discounted the idea of extra questions for default names. The user may not be all that smart and I prefer to keep it as simple as I can.
The idea behind this is that I want to save a file from a program. I want to provide a default name for the user that includes date information in the file name, but still want the user to be able to name it as they wish and just leave a suggestion. I have discounted the idea of extra questions for default names. The user may not be all that smart and I prefer to keep it as simple as I can.
- cogier
- Site Admin
- Posts: 1126
- Joined: Wednesday 21st September 2016 2:22pm
- Location: Guernsey, Channel Islands
Re: Dialog save file
As you want to use 'gtk' the only way I could find to do what you want is to use a FileChooser. Have a look at the attached code which is similar to the code I posted above. I hope it helps.