Skip to content

Saving a blank form in gui-builder results in a file that cannot be re-loaded #312

@jjuhl

Description

@jjuhl

Hi

If I start the gui-builder and create a new form (say /tmp/test.txt) and then go straight to the File menu and select Quit I get told that the form is modified and I can chose to save it. If I do so I'm left with a 0 byte file (which seems reasonable since the form was empty after all).
If I then re-launch gui-builder and try to open /tmp/test.txt I get the message "Failed to load '/tmp/test.txt', reason: Failed to open '/tmp/test.txt'.".

I see two things wrong here:

  1. The error message is, strictly speaking, not correct. There's no issue opening the file. The issue is that it has no valid content, not that it cannot be opened.

  2. The gui-builder should never save a file it cannot subsequently open (or that cannot be loaded by another TGUI using application).

The fix to 1 is probably just a better/more accurate error message.

As for issue 2 I can see three possible solutions:

1; Always save a minimum valid form that can be loaded back as an empty form even if the user has put nothing in the form they created.

2; Allow loading of a 0 byte form in both gui-builder and TGUI applications in general and have that result in a blank form with default values for any required attributes.

3; Refuse to save empty forms in gui-builder.

Or maybe you can come up with other options that I have not considered that would be even better.

If you let me know what solution you prefer then I can take a stab at implementing it if you'd like. If you'd rather just implement a solution yourself, then that's of course also fine :)

Kind regards
Jesper Juhl

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions