Form Designer Code -> Visual Update

Got an idea for enhancing PureBasic? New command(s) you'd like to see?
Opcode
Enthusiast
Enthusiast
Posts: 138
Joined: Thu Jul 18, 2013 4:58 am

Form Designer Code -> Visual Update

Post 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.
Polo
Addict
Addict
Posts: 2422
Joined: Tue May 06, 2003 5:07 pm
Location: UK

Re: Form Designer Code -> Visual Update

Post 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.
User avatar
TI-994A
Addict
Addict
Posts: 2705
Joined: Sat Feb 19, 2011 3:47 am
Location: Singapore
Contact:

Re: Form Designer Code -> Visual Update

Post 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:
Texas Instruments TI-99/4A Home Computer: the first home computer with a 16bit processor, crammed into an 8bit architecture. Great hardware - Poor design - Wonderful BASIC engine. And it could talk too! Please visit my YouTube Channel :D
Fred
Administrator
Administrator
Posts: 18162
Joined: Fri May 17, 2002 4:39 pm
Location: France
Contact:

Re: Form Designer Code -> Visual Update

Post 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.
User avatar
TI-994A
Addict
Addict
Posts: 2705
Joined: Sat Feb 19, 2011 3:47 am
Location: Singapore
Contact:

Re: Form Designer Code -> Visual Update

Post 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:
Texas Instruments TI-99/4A Home Computer: the first home computer with a 16bit processor, crammed into an 8bit architecture. Great hardware - Poor design - Wonderful BASIC engine. And it could talk too! Please visit my YouTube Channel :D
Polo
Addict
Addict
Posts: 2422
Joined: Tue May 06, 2003 5:07 pm
Location: UK

Re: Form Designer Code -> Visual Update

Post 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.
Olby
Enthusiast
Enthusiast
Posts: 461
Joined: Mon Jan 12, 2009 10:33 am
Contact:

Re: Form Designer Code -> Visual Update

Post 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! :)
Intel Core i7 Quad 2.3 Ghz, 8GB RAM, GeForce GT 630M 2GB, Windows 10 (x64)
Post Reply