Form-Designer generates wrong code for String Gadgets?

You need some new stunning features ? Tell us here.
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 »

Today i was really near to kick the whole PB GUI stuff into the bin and make it with PowerBasic.
And possibly make the Printing with a DLL that i do with Purebasic.

Here is my Opinion in an Video:
WHY i do NOT like the PureBasic VD


Have to say that i have several Form Designers:
- Visual Studio
- Phoenix 3 (you don't want to see that one, even the Design alone kill the PB thing :-)
- EZGUI (most primitve one - but never generates buggy code)
and Firefly (the one in the video)

none of them will ever produce buggy code. Maybe Phoenix if you try hard with most useless settings.
But Phoenix has 100x times more Options then the PB Designer (Of course it was a commercial Program that time).
In Phoenix you can visually design even TAB-Control. Directly on the Screen and generate Code that runs immediately.
It was ten years ahead of the market.
I don't know if its still available. The site ist still ab. If somebody wants to try it for free ... here is a link:
VD of the future (partly unready)
--Theo Gottwald
-----------------------------------------
http://www.it-berater.org * http://www.fa2.de * http://www.smart-package.com
User avatar
TI-994A
Addict
Addict
Posts: 2512
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:...none of them will ever produce buggy code.
First rule of computing: GIGO. You're blaming the form designer when it's possibly your fault. :lol:

After seeing your video, I tried unsuccessfully to reproduce the error that you were getting with the window's variable/caption setting. If the "Caption is a variable" option is checked, the form designer would not allow any invalid characters to be input in the "Caption" field. Attempting to do so would result in an error, and either the removal of the offending string, or the deselection of the "Caption is a variable" option.

Your dilemma was caused by a violation of the first rule of form-designer: never attempt to manually edit the code.

If you were to manually amend the code and change the window title parameter to an invalid string (eg. one containing spaces), the form designer would be unaware of the change. Thereafter, the "Caption is a variable" option would be caught in an erroneous toggle state.

To rectify this problem, simply delete the "Caption" field altogether, and deselect the "Caption is a variable" option. Then, enter your desired options, but only through the properties window; leave the code alone.

Hope it works out for you. :wink:

PS: you don't need to compile the form code to see the resulting output; simply press F5, or select Compiler -> Run from the menu.

PPS: instead of selecting Form - > Switch Code/Design View, there are options in the preferences settings to add a shortcut icon to the toolbar for that.
Last edited by TI-994A on Mon Feb 15, 2016 7:52 pm, edited 1 time in total.
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
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 »

I am still undecided which way to go, because its going to be more complicated with multiple forms.
Note that the actual PureBasic Forms Designer "is better then nothing" but its far from being "user-friendly".
Its just a free "add on".
If somebody need to quickly get "from A to B" he will have to think if this is the way to go.
Therefore i would recommend to have somebody make this thing a bit more userfriendly and intuitive.
And under no whatsoever circumstances it should generate buggy code.
If you ever produce a code-generator - and a VD is some sort of "Code Generator",
then the first an basic rule is:
1. You MUST NOT produce code - if your code would be buggy
In case you can not produce code, tell the user WHY and WHAT to do.
2. But if you produce code. It must at least be free of Syntax errors.

Of course a window may have useless styles or may be invisible ... thats the fault of the user.
But if the tool produces Syntax errors, its just a hobbyist work. As i see it.
--Theo Gottwald
-----------------------------------------
http://www.it-berater.org * http://www.fa2.de * http://www.smart-package.com
Fred
Administrator
Administrator
Posts: 16686
Joined: Fri May 17, 2002 4:39 pm
Location: France
Contact:

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

Post by Fred »

The video starts from an messed up state. It would be better to show what you did to reach this state, so we could fix it. The form Designer is only there to create form, not to manage your events or anything like VB. There is no seperate file format, so you can include it directly in the source and you don't have to 'generate' the forms. For example, there is no 'toggle' state stored somewhere, it's deduced from the code (if it finds a "string" enclosed with "" it's a literal, else it's a variable). 'variable' support is here to allow to create multi-langue form easily.

I used it in a lot of small projects, and when you know what it means to do (and just not try to replicate another program behaviour), it works and it's handy.
User avatar
TI-994A
Addict
Addict
Posts: 2512
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:...if the tool produces Syntax errors, its just a hobbyist work.
Every tool has its usage-rules. Follow them and you should be fine.
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
User avatar
TI-994A
Addict
Addict
Posts: 2512
Joined: Sat Feb 19, 2011 3:47 am
Location: Singapore
Contact:

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

Post by TI-994A »

Fred wrote:...show what you did to reach this state, so we could fix it.
It's possible that he manually inserted an invalid variable name into the code itself (not through the properties window). Doing so would not raise any errors, and the "Caption is a variable" option would be automatically selected. And it cannot be deselected unless the caption field is completely deleted first.
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
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 »

As i see it, Fred understood exactly where the problem arises from.
Its because the VD does not "store the form elsewhere". It tries to reconstruct the form from the code.
Nobody designs a program like this. No form designer out there works like this.
Just because - of course - the user may change the code - and this may lead to unforeseable side effects.

This is what needs to be changed.

If you "fix at other places" you don't catch the root of the evil.

Its not about me, i have my licence, you will not easily get rid of me :-)
But there are possibly other people out the who don't tell you long time what they think, but just go else where.

Of course the tool is usable - once you trained it long time.
Which is true for nearly any tool. As you know there are people in china which can kill you with a nail.
Because they trained it enough often :-).

Its very simple what people expect today:
1. Drag and Drop a Form
2. Run it test it immediately without having to code anything
3. It must never produce buggy code with Syntax errors, rather ask the user for required informations or switch to Default values.
4. Of course it must handle TAB-Controls and multiple Forms.
These are not advanced Features. If you want to know advanced features take a look here at the screenshots:
http://www.phnxthunder.com/shots.html

There are even Freeware tools who can demonstrate the principle. They will never produce buggy code.
Form Designer Code
QTAB-VIsual Designer
Source Code

Maybe it could be changed to PureBasic?
It can even visually design "TAB-Controls".

And this is all several years old.
--Theo Gottwald
-----------------------------------------
http://www.it-berater.org * http://www.fa2.de * http://www.smart-package.com
Fred
Administrator
Administrator
Posts: 16686
Joined: Fri May 17, 2002 4:39 pm
Location: France
Contact:

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

Post by Fred »

You're wrong, a lot of professional designer works that way, in .Net and JAVA for example. WYSIWYG HTML form designer are pretty common as well, because it's more handy to manipulate a final file, than an obscure private format. The designer doesn't have to "try" to read the code, as it has created it. If you find something fishy, just create a bug report with the step to reproduce and we will be happy to fix it.

Again, if it's not suitable for you, there is other code designer available for PB: PureVision, PureForm to name a few.
IdeasVacuum
Always Here
Always Here
Posts: 6425
Joined: Fri Oct 23, 2009 2:33 am
Location: Wales, UK
Contact:

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

Post by IdeasVacuum »

...You can define Tab Controls with the PB VD. It's just not called a Tab Control, in PB it's a PanelGadget(). Of course it is used as a container for any amount of other gadgets and the PB VD does this well. In the VD, select "Panel" from the toolbox and drag the size/location required on your Window Form. To add/edit/delete tabs, right-mouse-click on the Panel.
IdeasVacuum
If it sounds simple, you have not grasped the complexity.
User avatar
TI-994A
Addict
Addict
Posts: 2512
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:Its very simple what people expect today:
1. Drag and Drop a Form
2. Run it test it immediately without having to code anything
3. It must never produce buggy code with Syntax errors, rather ask the user for required informations or switch to Default values.
4. Of course it must handle TAB-Controls and multiple Forms.
PureBasic's Form Designer:
1. does that
2. does that
3. does that, and does that
4. does that, and all tools handle only one window per form file

One thing you're right about; you need more training on PureBasic, as would anyone uninitiated with anything. :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
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 »

Sorry newtheogott, but when you work with purebasic since your registration in the forum in 2003, then the VD should be a breeze for you.

In your video, you ride about on a fault, without even realizing that you cause and raise the error all the time. Allowedly the VD could support the user more and solve the problem, but for a professional the problem should be solvable immediately.

I use the VD even in big projects, just for designing the forms, and it works like expected without any faults or syntax errors. As I have already said, the VD is not the best, but better than his reputation.

If you want, you can create a thread in the german forum, then we help you there with the operation of the VD. I think that would be easier in the native tongue.

Additional:
newtheogott wrote:

Code: Select all

Global FRM_Main.l

Enumeration FormFont
  #Font_FRM_Main.l_0
EndEnumeration
The VD never sets the .l at the end of the variable name. That's what you entered in the field for the variable name of the form. Let it off, as it should be and all is well.

You should also know, that it's better to use Integer instead of Longs...
Polo
Addict
Addict
Posts: 2422
Joined: Tue May 06, 2003 5:07 pm
Location: UK

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

Post by Polo »

Wow.

With the hundreds of hours I have spent working on the Form Designer and providing it to the Purebasic community for free, I obviously feel a bit hurt with all the criticisms my product is getting at the moment.
I know it is far from perfect, I know there are quite a few things that could and should be improved, but I had not idea my form designer was that bad...

Getting the form designer to use a Purebasic code file to store everything was something I strongly believed in and I think that's what Visual Studio NET is doing (could be wrong on that). Alongside with Fred we made it clear from the beginning that the generated code should not be amended by hand (unless you are aware of the limitations).

For those who are wondering, I haven't stopped working on the Form Designer. I have just been quite busy with work lately - it does not mean I won't spend some time when I have some to fix what needs to be fixed! In the meantime, Fred did a great job working on the major problems that users encountered.
IdeasVacuum
Always Here
Always Here
Posts: 6425
Joined: Fri Oct 23, 2009 2:33 am
Location: Wales, UK
Contact:

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

Post by IdeasVacuum »

It's a really good Visual Designer Polo. 8)
IdeasVacuum
If it sounds simple, you have not grasped the complexity.
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 »

Polo, FD has been and still is very useful to me; it is very useful even to preview how the application will look like and show it to clients.
thanks
Luciano

p.s.
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.
Marc56us
Addict
Addict
Posts: 1479
Joined: Sat Feb 08, 2014 3:26 pm

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

Post by Marc56us »

I like the Form Designer, I use it all the days since many months even for small projetcs :!:

My last project has 10 forms, all are done with your tool. :)
Some screenshots
I do the code window for the schedule in a hour, including the integration code for images and the automatic resizing.
I can not imagine how long it would take to do so manually :?

I like the fact that VD also does Menu code and made the code for manage integrated images.

Good work. Continue.
:wink:
Locked