View Issue Details
|ID||Project||Category||View Status||Date Submitted||Last Update|
|0001933||SkyChart||1-Software||public||18-04-11 13:05||18-05-27 17:06|
|Reporter||Sasa||Assigned To||Patrick Chevalley|
|Platform||Linux 64-bit||OS||Lubuntu||OS Version||17.04|
|Product Version||4.1 SVN|
|Target Version||4.2||Fixed in Version||4.1 SVN|
|Summary||0001933: Save chart image - extension issues|
|Description||On attempt to save image, application will form full name (including path) to the user directory, however with extension Chart_1.cdc3 instead Chart_1.PNG which will be the name to save with on pressing enter (without changing extension manually).|
This is a bit confusing if user before image actually save chart in Chart_1.cdc3. when after that try to save image - Info window that Chart_1.cdc3 stil exists will be displayed and after "Replace" button click, the chart image will be saved correctly, in Chart_1.PNG.
|Tags||No tags attached.|
Furthermore, if within saving dialog is changed format to JPG or BMP, image will be saved with PNG extension and the PNG format, regardless the choice.
Another issue is that if the chart is not saved (with .cdc3 extension), the full name will be blank on attempt to save chart image.
Yes both use the same SaveDialog but the file name was not set for the image.
This is fixed by:
The file is saved with the type corresponding to the extension typed in the file name line at the top of the dialog.
From my understanding the save dialog filter is only to filter the existing files list, it not change the file extension.
There is a OnTypeChange event raised when you change the filter but changing SaveDialog.Filename at this time as no effect to the open dialog.
Do you know a way to do that?
Sure I can save as jpg if jpg is selected in the filter without taking account for what the user type in the top line but this is also not very good.
Changing filename inside system dialog in Windows would be possible, however I do not know it would work in Linux (dialog handle, save dialog wrapper and proper SendMessage). Writing an extend dialog (as in GIMP, for instance) can also be quite big problem...
As there is no point not to use filter to set proper extension (and as we do not have all supported graphic formats in the first field of the filter, as usually used), avoiding all that complexity, the simplest approach would be following:
1. Ensure filename without extension and set properly DefaultExt property
2. Proper handling in OnTypeChange event
3. If there is unhandled extension wrote by user inside dialog filename field, show an appropriate error in OnCanClose
I have attached simple example.
SaveDialog_OnTypeChange.zip (128,562 bytes)
Thank you Sasa, your method work fine.
This is in:
|18-04-11 13:05||Sasa||New Issue|
|18-04-11 13:33||Sasa||Note Added: 0004683|
|18-04-11 16:33||Patrick Chevalley||Note Added: 0004688|
|18-04-11 21:29||Sasa||File Added: SaveDialog_OnTypeChange.zip|
|18-04-11 21:29||Sasa||Note Added: 0004695|
|18-05-27 17:06||Patrick Chevalley||Assigned To||=> Patrick Chevalley|
|18-05-27 17:06||Patrick Chevalley||Status||new => resolved|
|18-05-27 17:06||Patrick Chevalley||Resolution||open => fixed|
|18-05-27 17:06||Patrick Chevalley||Fixed in Version||=> 4.1 SVN|
|18-05-27 17:06||Patrick Chevalley||Target Version||=> 4.2|
|18-05-27 17:06||Patrick Chevalley||Note Added: 0004770|