Form-Designer generates wrong code for String Gadgets?

You need some new stunning features ? Tell us here.
Marc56us
Addict
Addict
Posts: 1600
Joined: Sat Feb 08, 2014 3:26 pm

Re: Form-Designer generates wrong code for String Gadgets?

Post by Marc56us »

I will miss a little the event loop which has been removed, I copied and pasted the generated loop code in the application and that saved me some work.
Only the Event Loop generator have been removed, so it's easy to remplace it with a Template and call it from main .pb (then add other events manually)

Code: Select all

OpenWindow_0()

Repeat
  event = WaitWindowEvent()
Until Window_0_Events(event) = #False

End
Choice to remove main loop from .pbf is good, because we can add directly the events that the FD don't manage (ie: Timers) in a lonely loop.
and we can't make error when using more that one .pbf

PS. The Event procedure generator still here and work fine :)
Gadget
User
User
Posts: 39
Joined: Tue Mar 11, 2014 8:11 pm
Location: UK

Re: Form-Designer generates wrong code for String Gadgets?

Post by Gadget »

Hi Polo,

I always use your Form Designer for building screens in PB - it's brilliant and easy to use for playing around with screen designs to figure out how I want things to look and work. This, along with TI-994A's tutorials on event handling have really got me going in using PB.

Sure, there's the odd quirk and limitation here and there but it's really just a case of recognising them and figuring how best to work around them. Bug and suggestions can always be politely submitted to the forum

So, from me, many thanks for all the work you've put in to it, it's much appreciated!

Best wishes,

Gadget
Marc56us
Addict
Addict
Posts: 1600
Joined: Sat Feb 08, 2014 3:26 pm

Re: Form-Designer generates wrong code for String Gadgets?

Post by Marc56us »

For those that might be interested, here is how I easily and quickly works with the FD

First I put a shortcut icon on my toolbar and a shortcut (F12) for the command "Switch Code / Design" :wink:

Then I created my form

I prefix all my items with part of the name of the window to which they belong

For each object, I set the procedure name in VD (Event Procedure)

The procedures are also prefixed with a portion of the window name

When all is done, I switch to code view

I copy the entire block of declaration lines procedures "Declare ..."

I paste it in the main code

I change all mentions "Declare" by "Procedure"

(Sometime, I put a debug line like (Debug "Procedure Cla_Quit start) for debug)

I put "EndProcedure" after each line

Then all procedures are ready

If I used images, I return to the FD and I go to "Form> Image Manager" and I check "Catch Image" and I click on "Relative path"
The VD write all lines CatchImage / IncludeBinary etc

Tips: I prefix all procedures and variables with a portion of the name of the relevant window (a bit like OOP). Thus the process manager display all follow.
Moreover, in the loop of events I do not have to test the source window in most cases.

Polo, your FD is a very good tool.
:)

PS: If you have a little time, please have a look at options of the DateGadget() who write option, but does not store/read when switching code/view (Partially corrected in the beta 2)
http://www.purebasic.fr/english/viewtop ... =4&t=64696
luciano
Enthusiast
Enthusiast
Posts: 151
Joined: Wed Mar 09, 2011 8:25 pm

Re: Form-Designer generates wrong code for String Gadgets?

Post by luciano »

Marc56us wrote: Only the Event Loop generator have been removed, so it's easy to remplace it with a Template and call it from main .pb (then add other events manually)

Code: Select all

OpenWindow_0()

Repeat
  event = WaitWindowEvent()
Until Window_0_Events(event) = #False

End
Choice to remove main loop from .pbf is good, because we can add directly the events that the FD don't manage (ie: Timers) in a lonely loop.
and we can't make error when using more that one .pbf

PS. The Event procedure generator still here and work fine :)
I supposed (before actually testing beta 3) that the management of events was gone too. You are right it is better this way.
User avatar
newtheogott
Enthusiast
Enthusiast
Posts: 120
Joined: Sat Apr 26, 2003 2:52 pm
Location: Germany, Karlsruhe
Contact:

Re: Form-Designer generates wrong code for String Gadgets?

Post by newtheogott »

Think a moment - when doing an application there is normally
1. Main-Form
2. several child-forms that open and close

I have now changed the Event loop to this structure, which i got from a video on youtube. It looks fine to me.
Also it works with one form, as well it is expandable for as many forms as the user "designs".

If this structure could be automatically generated, people could save a lot of typing - and thats what a form designer is also good for.

See here my suggestion:
http://www.jose.it-berater.org/smfforum ... pic=5096.0

Just looking here in the Forum you will see that the handling of multiple forms is a problem for new users.
An intelligent designed Forms-Designer could remove a lot from these problems.

Also 2 more things:
1. The event procedures for the controls should also be created (Just the procedures without content)
They could even be in a separate file, but then the user can copy and paste them as needed.
2. Any form normally needs to be initialized with default values. Such a procedure (empty or better with sample values? by default)
could also be automatically generated. This would help new users.

3. To store the form data, use a separate file, or use comment-lines at the end of the file.
Example:

Code: Select all

; Form-Designer (do not touch these comments)
; ControlXY 34,456,343
This way you have the Form Data away from the user. Therefore if the user makes changes in the code, you can always regenerate the form. Do not store Form-Data in the code, where the user can ruin it in multiple ways.

PS: If the only tool you have is a hammer, everything looks like a nail.
--Theo Gottwald
-----------------------------------------
http://www.it-berater.org * http://www.fa2.de * http://www.smart-package.com
Marc56us
Addict
Addict
Posts: 1600
Joined: Sat Feb 08, 2014 3:26 pm

Re: Form-Designer generates wrong code for String Gadgets?

Post by Marc56us »

If this structure could be automatically generated, people could save a lot of typing
We all do it (and more) for a long time with the internal Template Manager (Menu: Tools > Templates)
Fill it with your template(s), and double-click. This save a lot of typing.
(Put 'Code Template' in panel to be more efficient)

:wink:
User avatar
newtheogott
Enthusiast
Enthusiast
Posts: 120
Joined: Sat Apr 26, 2003 2:52 pm
Location: Germany, Karlsruhe
Contact:

Re: Form-Designer generates wrong code for String Gadgets?

Post by newtheogott »

If you do so, and if this is the recommended way to go, then it should be included in an PureBasic Update next time,
so anybody can also use these tamplates.
Possibly this is a way to go, but when i installed PureBasic 5.41 LTS, it was not in there.
--Theo Gottwald
-----------------------------------------
http://www.it-berater.org * http://www.fa2.de * http://www.smart-package.com
User avatar
mhs
Enthusiast
Enthusiast
Posts: 101
Joined: Thu Jul 02, 2015 4:53 pm
Location: Germany
Contact:

Re: Form-Designer generates wrong code for String Gadgets?

Post by mhs »

The problem is, that the event loop must be very versatile under some circumstances. Your event loop for example would my requirements never meet.

The templates are a user-specific area that each user filles with his own codes.
User avatar
newtheogott
Enthusiast
Enthusiast
Posts: 120
Joined: Sat Apr 26, 2003 2:52 pm
Location: Germany, Karlsruhe
Contact:

Re: Form-Designer generates wrong code for String Gadgets?

Post by newtheogott »

Of course there may be special cases. As i see it, most cases would be ok, with a general "multi form" Event loop.
Also something like that should be in the help file.

If you have a better more versatile suggestion, that will be of course an alternative.

Its not about "My code". I already said that i took it from an YouTube Video.
Its about such a Template that should be automatically be created if possible.

What i can say is, that it works in commercial VD's from the PowerBasic corner, wether its EZGUI or Phoenix 3. Also i have heared (from his forum) that Chris can imagine an EZGUI for PureBasic, which would be good news for me.
--Theo Gottwald
-----------------------------------------
http://www.it-berater.org * http://www.fa2.de * http://www.smart-package.com
User avatar
TI-994A
Addict
Addict
Posts: 2698
Joined: Sat Feb 19, 2011 3:47 am
Location: Singapore
Contact:

Re: Form-Designer generates wrong code for String Gadgets?

Post by TI-994A »

newtheogott wrote:...EZGUI or Phoenix 3. Also i have heared (from his forum) that Chris can imagine an EZGUI for PureBasic, which would be good news for me.
EZGUI requires a 1MB runtime DLL to be distributed along with all final executables, and charges you more than a hundred dollars for that privilege. :wink:

Phoenix is a full-blown replacement IDE for PowerBasic, costing almost as much as the PowerBasic compiler itself. :lol:

Moreover, they only work with an almost defunct 32-bit-Windows-only development tool.

On the other hand, the PureBasic form designer is fully integrated within the IDE, generating native PureBasic code that could be easily and portably implemented on any of the three desktop platforms that it supports, for both 32-bit and 64-bit compilations. Despite such depth, the generated form-code runs flawlessly on all platforms, without modification, without any additional dependencies or overheads, and consistently without fail.

It is an architecturally-ingenious approach that maintains simplicity, code-integrity, and platform-compatibility, without compromising speed or power in any way.

Bravo PureBasic!
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
IdeasVacuum
Always Here
Always Here
Posts: 6426
Joined: Fri Oct 23, 2009 2:33 am
Location: Wales, UK
Contact:

Re: Form-Designer generates wrong code for String Gadgets?

Post by IdeasVacuum »

On the other hand, the PureBasic form designer is fully integrated within the IDE, generating native PureBasic code that could be easily and portably implemented on any of the three desktop platforms that it supports, for both 32-bit and 64-bit compilations. Despite such depth, the generated form-code runs flawlessly on all platforms, without modification, without any additional dependencies or overheads, and consistently without fail.

It is an architecturally-ingenious approach that maintains simplicity, code-integrity, and platform-compatibility, without compromising speed or power in any way.
Seconded 8)

...... I do understand how Newbies can find it difficult to grasp though, the form designer needs more coverage in the help.
IdeasVacuum
If it sounds simple, you have not grasped the complexity.
coder14
Enthusiast
Enthusiast
Posts: 327
Joined: Tue Jun 21, 2011 10:39 am

Re: Form-Designer generates wrong code for String Gadgets?

Post by coder14 »

TI-994A wrote:
newtheogott wrote:...EZGUI or Phoenix 3. Also i have heared (from his forum) that Chris can imagine an EZGUI for PureBasic, which would be good news for me.
EZGUI requires a 1MB runtime DLL to be distributed along with all final executables, and charges you more than a hundred dollars for that privilege. :wink:

Phoenix is a full-blown replacement IDE for PowerBasic, costing almost as much as the PowerBasic compiler itself. :lol:

Moreover, they only work with an almost defunct 32-bit-Windows-only development tool.

On the other hand, the PureBasic form designer is fully integrated within the IDE, generating native PureBasic code that could be easily and portably implemented on any of the three desktop platforms that it supports, for both 32-bit and 64-bit compilations. Despite such depth, the generated form-code runs flawlessly on all platforms, without modification, without any additional dependencies or overheads, and consistently without fail.

It is an architecturally-ingenious approach that maintains simplicity, code-integrity, and platform-compatibility, without compromising speed or power in any way.

Bravo PureBasic!
I agree too. :D
User avatar
newtheogott
Enthusiast
Enthusiast
Posts: 120
Joined: Sat Apr 26, 2003 2:52 pm
Location: Germany, Karlsruhe
Contact:

Re: Form-Designer generates wrong code for String Gadgets?

Post by newtheogott »

You all agree :-) ?

Then i have some news for you:
1. Power Basic seems not to be dead. At least there are believable rumors that there is still some live in it.
2. There are even rumors about a PB x64 - and when that would ever be available, at least for me - it would still beat PureBasic.
Not in all fields, but the core compiler (the PureBasic libraries are far ahead of most competition).

But until then i think that some points are right:
-> Phonix IS expensive. But it beats the (free!) "poor" (in this case PoorBasic) VD just deeply into the ground in any way you want.
If you don't believe try the demo. If it would be available for PureBasic i would buy it.

-> EZGUI uses a large Runtime, - what is "large"? WinDEV has a Runtime of between 4 MB and 12 MB and in these days who really cares?
We do not store on diskettes anymore.

While EZGUI is far from FireFly or Phoenix about the Visual Designer, it will still beat the Free-Add On from PureBasic.
Also it contains a huge library with easy to use Subprogramms. IF most of them are really useful with PureBasic (because many of this is already included in PureBasic) is another question.
Depending on the Project and for PowerBasic EZGUI is a possible way to go.
True, it costs money, but if i save 25 hours in development time - it was worth the money.

Anyway i believe IF we will see an EZGUI for PureBasic, it should be a completely reworked version, at least it should not duplicate libraries that are already available, but build on these and make them possibly even more intelligent to use.

Let me add that the field of Neuronal Networks (CNN's) looks like its completely untouched in PureBasic.
While the Boss from NVIDIA said some time ago that "Deep Learning CNN's are as important as the invention of the Internet".
So let me ask you ... there is something that is "as important as the invention of the internet" - did you even know about it?
In PowerBasic there are at least some MAT() statements that make such programs easy to build :-).
When will we see an AI-Library for PureBasic?
--Theo Gottwald
-----------------------------------------
http://www.it-berater.org * http://www.fa2.de * http://www.smart-package.com
Fred
Administrator
Administrator
Posts: 18152
Joined: Fri May 17, 2002 4:39 pm
Location: France
Contact:

Re: Form-Designer generates wrong code for String Gadgets?

Post by Fred »

We can accept a lot of things, but not insulting our product, like calling it PoorBasic. It's proper lack of respect. We will lock this thread and will take further action if you continue this road.
Locked