Page 1 of 1

Form Designer Code -> Visual Update

Posted: Mon Aug 12, 2013 6:27 am
by Opcode
I honestly think the Form Designer needs to be able to update the current project when switching from the code view back to the design view. This way you can do "advanced" edits to the code and the designer will automatically inherit the updated code. All you should need to do is make it re-parse the code before going back to the design mode and update the visual layout (pretty much what happens when you load a saved project). This way we can add in our own code by hand without it constantly reverting back to the original generated code.

Re: Form Designer Code -> Visual Update

Posted: Tue Aug 13, 2013 4:56 pm
by Polo
Opcode wrote:All you should need to do is make it re-parse the code before going back to the design mode and update the visual layout (pretty much what happens when you load a saved project). This way we can add in our own code by hand without it constantly reverting back to the original generated code.
This is already the way it works. It actually reparse the code and update the form - only what the form designer understand is kept. If it doesnt work that way then there's a bug somewhere.

Re: Form Designer Code -> Visual Update

Posted: Wed Aug 14, 2013 4:20 am
by TI-994A
Opcode wrote:I honestly think the Form Designer needs to be able to update the current project when switching from the code view back to the design view. This way you can do "advanced" edits to the code and the designer will automatically inherit the updated code.
Hello Opcode. Polo's right; any changes to the form layout or events that have been generated by Form Designer can be modified programmatically, and such changes will be preserved and even visually updated in the form view. However, additions of gadgets or events via code are not recognised or honoured, although that would be nice too.

In any case, all other variables, constants, events, and code in general, should be processed and handled by the main program, with the .pbf code acting only as a "ready-made plugin" of the pre-designed form. This is similar to the model employed by VB6, which hides its form code from view altogether, allowing additions and modifications to the form only via the object view of its IDE.

Alternatively, you could simply use Form Designer to generate the initial template of your form, along with the event handlers if you wish, and then save it as a normal PureBasic .pb source file, which you can then directly code into. However, you'd lose the ability to visually edit the form further, or, if you attempted to revert it back to a Form Designer .pbf file, you'd lose all your added code.

Just some options, to be exercised with great care! :wink:

Re: Form Designer Code -> Visual Update

Posted: Wed Aug 14, 2013 9:02 am
by Fred
The form designer doesn't use an extra file to store information, all is parsed from the source. So you can add a gadget manually if you want but you have to respect the form designer syntax.

Re: Form Designer Code -> Visual Update

Posted: Wed Aug 14, 2013 1:47 pm
by TI-994A
Fred wrote:...you can add a gadget manually if you want but you have to respect the form designer syntax.
You're right Fred. I've been so used to Form Designer wiping out my additional code, that I've never actually noticed that it allows gadgets to be added manually. However, the parser still seems to wipe out code that has been manually added to the events loop. :wink:

Re: Form Designer Code -> Visual Update

Posted: Wed Aug 14, 2013 3:38 pm
by Polo
This feature has the main advantage of copy-pasting some code from old projects to modify it with the designer (with a few modifications if necessary).
TI-994A wrote:You're right Fred. I've been so used to Form Designer wiping out my additional code, that I've never actually noticed that it allows gadgets to be added manually. However, the parser still seems to wipe out code that has been manually added to the events loop. :wink:
It does, only the code in the OpenWindow() procedure should be modified manually.

Re: Form Designer Code -> Visual Update

Posted: Wed Aug 14, 2013 5:26 pm
by Olby
Polo wrote:It does, only the code in the OpenWindow() procedure should be modified manually.
And this should be in the manual so you can direct everyone to RTFM! :)