Form Designer 5.10

You need some new stunning features ? Tell us here.
Polo
Addict
Addict
Posts: 2422
Joined: Tue May 06, 2003 5:07 pm
Location: UK

Re: Form Designer 5.00 beta 2.3

Post by Polo »

Warmonger wrote:One more major flaw is the code the designer generates. The two functions for events and re-size don't even work, let alone we prefer to code our own event loops. Something simple like a GUI with a listicongadget results in long messy code like so.
Variable declaration depends on if you use PB_Any, you've got the choice ;)
The functions for events and resize obviously work, you've got to call them... They're here for automatic resizing which you do not use in this example.
User avatar
Bisonte
Addict
Addict
Posts: 1305
Joined: Tue Oct 09, 2007 2:15 am

Re: Form Designer 5.00 beta 2.3

Post by Bisonte »

Warmonger wrote:When it should only be this simple. Utilize Enumeration, and there isn't really a need to set variables for every single gadget.

Code: Select all

Enumeration
  #Window_0
  #ListIcon_0
EndEnumeration
And exact this is wrong. Windows and gadgets not use the same object pool in pb. I can have a window with pb-id 0 and I can have a gadget with pb-id 0...
PureBasic 6.21 (Windows x64) | Windows 11 Pro | AsRock B850 Steel Legend Wifi | R7 9800x3D | 64GB RAM | RTX 5080 | ThermaltakeView 270 TG ARGB | build by vannicom​​
English is not my native language... (I often use DeepL.)
Warmonger
Enthusiast
Enthusiast
Posts: 156
Joined: Wed Apr 20, 2011 4:24 pm

Re: Form Designer 5.00 beta 2.3

Post by Warmonger »

Polo wrote:
Warmonger wrote:One more major flaw is the code the designer generates. The two functions for events and re-size don't even work, let alone we prefer to code our own event loops. Something simple like a GUI with a listicongadget results in long messy code like so.
Variable declaration depends on if you use PB_Any, you've got the choice ;)
The functions for events and resize obviously work, you've got to call them... They're here for automatic resizing which you do not use in this example.
It still shouldn't be generating all this messy code by default in my opinion. There should be options in the preferences to possibly enable the generation of these procedures into your code. That way they are entirely optional, as several people wont be using them. Also the re-size does not work, look over the code and notice if you call it every time on a window event the ResizeGadget() is still set to a fixed number. So essentially it doesn't work (yet), as progress bars can be actively re-sized.
Bisonte wrote:
Warmonger wrote:When it should only be this simple. Utilize Enumeration, and there isn't really a need to set variables for every single gadget.

Code: Select all

Enumeration
  #Window_0
  #ListIcon_0
EndEnumeration
And exact this is wrong. Windows and gadgets not use the same object pool in pb. I can have a window with pb-id 0 and I can have a gadget with pb-id 0...
No, split off your gadgets from your other controls and windows.

Code: Select all

Enumeration
  #Window_0
EndEnumeration

Enumeration
  #ListIcon_0
EndEnumeration
  
Procedure InitWindow_0()
  OpenWindow(#Window_0, 0, 0, 600, 400, "", #PB_Window_SystemMenu)
  ListIconGadget(#ListIcon_0, 40, 60, 480, 220, "Column 1", 100, #PB_ListIcon_GridLines)
EndProcedure
Its Not A Bug, Its An Undocumented Feature!
Relax Its All Just Ones And Zeros
There Is No Place Like 127.0.0.1 Except ::1
I do things TO my computer, not WITH my computer... I am a nerd.
Polo
Addict
Addict
Posts: 2422
Joined: Tue May 06, 2003 5:07 pm
Location: UK

Re: Form Designer 5.00 beta 2.3

Post by Polo »

Resizing do work, you've just not been using it - only if you lock a gadget left and right it will resize to the width of its parent, for instance.
I do agree though that event procedure generation should be made optional in the preferences. ;)
Warmonger
Enthusiast
Enthusiast
Posts: 156
Joined: Wed Apr 20, 2011 4:24 pm

Re: Form Designer 5.00 beta 2.3

Post by Warmonger »

Polo wrote:Resizing do work, you've just not been using it - only if you lock a gadget left and right it will resize to the width of its parent, for instance.
I do agree though that event procedure generation should be made optional in the preferences. ;)
Both should be optional in the preferences, and disabled by default.

Code: Select all

Generate re-size procedure
Generate gadget event procedure
@Bisonte: Here is what the designer generates.

Code: Select all

Global Window_0

Global ProgressBar_0

Declare ResizeGadgetsWindow_0()

Procedure InitWindow_0()
  Protected WindowWidth, WindowHeight
  Window_0 = OpenWindow(#PB_Any, 0, 0, 600, 400, "", #PB_Window_SystemMenu | #PB_Window_SizeGadget)
  WindowWidth = WindowWidth(Window_0)
  WindowHeight = WindowHeight(Window_0)
  ProgressBar_0 = ProgressBarGadget(#PB_Any, 10, 20, WindowWidth - 20, 50, 0, 0)
EndProcedure

Procedure ResizeGadgetsWindow_0()
  Protected WindowWidth, WindowHeight
  WindowWidth = WindowWidth(Window_0)
  WindowHeight = WindowHeight(Window_0)
  ResizeGadget(ProgressBar_0, 10, 20, WindowWidth - 20, 50)
EndProcedure

InitWindow_0()

Repeat
  EventID = WaitWindowEvent()
  
  Select EventID
      
    Case #PB_Event_SizeWindow
      ResizeGadgetsWindow_0()
      
  EndSelect
  
Until EventID = #PB_Event_CloseWindow
And here is what it should generate.

Code: Select all

Enumeration
  #Window_0
EndEnumeration

Enumeration
  #ProgressBar_0
EndEnumeration

Declare ResizeGadgetsWindow_0()

Procedure InitWindow_0()
  Protected WindowWidth, WindowHeight
  OpenWindow(#Window_0, 0, 0, 600, 400, "", #PB_Window_SystemMenu | #PB_Window_SizeGadget)
  WindowWidth = WindowWidth(Window_0)
  WindowHeight = WindowHeight(Window_0)
  ProgressBarGadget(#ProgressBar_0, 10, 20, WindowWidth - 20, 50, 0, 0)
EndProcedure

Procedure ResizeGadgetsWindow_0()
  Protected WindowWidth, WindowHeight
  WindowWidth = WindowWidth(Window_0)
  WindowHeight = WindowHeight(Window_0)
  ResizeGadget(#ProgressBar_0, 10, 20, WindowWidth - 20, 50)
EndProcedure

InitWindow_0()

Repeat
  EventID = WaitWindowEvent()
  
  Select EventID
      
    Case #PB_Event_SizeWindow
      ResizeGadgetsWindow_0()
      
  EndSelect
  
Until EventID = #PB_Event_CloseWindow
Which will work exactly the same and retain the 0 - 0 like your implying. Plus its not as messy and better structured. Put the window in its own Enumeration, then put all the gadgets in a second Enumeration. These shouldn't be variables, they should be constants since they should never be changeable. Besides it also makes structuring your applications cleaner since the constants stand out better then variables. Both ways work the same, but there is a technical right way.
Its Not A Bug, Its An Undocumented Feature!
Relax Its All Just Ones And Zeros
There Is No Place Like 127.0.0.1 Except ::1
I do things TO my computer, not WITH my computer... I am a nerd.
luciano
Enthusiast
Enthusiast
Posts: 151
Joined: Wed Mar 09, 2011 8:25 pm

Re: Form Designer 5.00 beta 2.3

Post by luciano »

@Warmonger,
You can get constants, instead of variables, if you uncheck "New gadgets use #pb_any by default" in File -> Preferences, or you uncheck #pb_any in each object.

This first method is easier.
Here is the code you get for a window with a button inside:

Code: Select all

Enumeration #PB_Compiler_EnumerationValue
  #Window_0
EndEnumeration

Enumeration #PB_Compiler_EnumerationValue
  #Button_0
EndEnumeration

Declare ResizeGadgetsWindow_0()

Procedure InitWindow_0()
  Protected WindowWidth, WindowHeight
  OpenWindow(#Window_0, 0, 0, 600, 400, "", #PB_Window_SystemMenu)
  WindowWidth = WindowWidth(#Window_0)
  WindowHeight = WindowHeight(#Window_0)
  ButtonGadget(#Button_0, 80, 70, 90, 40, "")
EndProcedure

Procedure ResizeGadgetsWindow_0()
  Protected WindowWidth, WindowHeight
  WindowWidth = WindowWidth(#Window_0)
  WindowHeight = WindowHeight(#Window_0)
  ResizeGadget(#Button_0, 80, 70, 90, 40)
EndProcedure

Procedure Window_0_Events(event)
  Select event
    Case #PB_Event_Gadget
      Select EventGadget()
      EndSelect
  EndSelect

Polo
Addict
Addict
Posts: 2422
Joined: Tue May 06, 2003 5:07 pm
Location: UK

Re: Form Designer 5.00 beta 2.3

Post by Polo »

Added three preferences: generate resize procedure, generate event procedure, and a new stuff, generate event loop (mostly for testing the pbf file directly in Purebasic).
Warmonger
Enthusiast
Enthusiast
Posts: 156
Joined: Wed Apr 20, 2011 4:24 pm

Re: Form Designer 5.00 beta 2.3

Post by Warmonger »

Polo wrote:Added three preferences: generate resize procedure, generate event procedure, and a new stuff, generate event loop (mostly for testing the pbf file directly in Purebasic).
You could always add a quick check to the form, and see if the #PB_Window_SizeGadget or the #PB_Window_MaximizeGadget flag is used. If it is then check if any gadgets have a "Lock Right/Top/Bottom" option set. If so generate the re-size function automatically, if not then don't generate the re-size function. This will speed up having to go in and out of the preferences to make different style forms. I would still leave the option in the preferences just change it to something like "Generate resize procedure where applicable?".

- TrackBar Windows 8 skin missing.
- Preference box on side menu takes up most of sidebar on startup. Toolbox & Preferences should be a 50/50 split.
- Design view scrollbars are bugged (resize design window beyong design veiw).
- Code view scrollbars not disabled by default (same issue reported earlier with design view).
- WindowWidth() and WindowHeight() should be eradicated from the main InitWindow_0() procedure. As they seem to be only used inside the ResizeGadget procedure, in which they are already called.
- All plain white box gadgets should display what they are in text on the gadget. Like the Calendar/Canvas/Explorer Tree gadgets already do (ListView, Tree).
- Calendar Gadget missing black border. Maneuvering it around in design view across other controls is tough on the eyes.

Image
Its Not A Bug, Its An Undocumented Feature!
Relax Its All Just Ones And Zeros
There Is No Place Like 127.0.0.1 Except ::1
I do things TO my computer, not WITH my computer... I am a nerd.
Polo
Addict
Addict
Posts: 2422
Joined: Tue May 06, 2003 5:07 pm
Location: UK

Re: Form Designer 5.00 beta 2.3

Post by Polo »

Warmonger wrote:You could always add a quick check to the form, and see if the #PB_Window_SizeGadget or the #PB_Window_MaximizeGadget flag is used. If it is then check if any gadgets have a "Lock Right/Top/Bottom" option set. If so generate the re-size function automatically, if not then don't generate the re-size function. This will speed up having to go in and out of the preferences to make different style forms. I would still leave the option in the preferences just change it to something like "Generate resize procedure where applicable?".
It's a good idea, now the resize function is generated when needed, and the Init function doesn't have the resize parameters anymore (this means, however, that old project containing locked gadget won't load properly - sorry!). I removed the preference has it doesn't make sense to use locked gadget and not generate a resize procedure (plus any locked states would be lost when saved if the resize procedure wasn't generated). It's much better this way and the generated code is indeed cleaner (and faster).
Warmonger wrote:- TrackBar Windows 8 skin missing.
It seems the tracker resizes according to the height on Windows 8, well maybe on previous versions as well actually. That was why I didn't do it, will do it later! :)
Warmonger wrote:- Preference box on side menu takes up most of sidebar on startup. Toolbox & Preferences should be a 50/50 split.
Fixed (splitter positions are now correctly recorded/retrieved).
Warmonger wrote:- Design view scrollbars are bugged (resize design window beyong design veiw).
I think it works now.
Warmonger wrote:- Code view scrollbars not disabled by default (same issue reported earlier with design view).
No improvement on the code view anymore I'm afraid, I'm focusing on the core drawing and code generation - code view is likely to go in the end if this project is merged with the IDE.
Warmonger wrote:- WindowWidth() and WindowHeight() should be eradicated from the main InitWindow_0() procedure. As they seem to be only used inside the ResizeGadget procedure, in which they are already called.
Done, see first answer.
Warmonger wrote:- All plain white box gadgets should display what they are in text on the gadget. Like the Calendar/Canvas/Explorer Tree gadgets already do (ListView, Tree).
- Calendar Gadget missing black border. Maneuvering it around in design view across other controls is tough on the eyes.
Done unless I forgot something! :)

Many thanks for this thorough testing!! ;)
User avatar
captain_skank
Enthusiast
Enthusiast
Posts: 639
Joined: Fri Oct 06, 2006 3:57 pm
Location: England

Re: Form Designer 5.00 beta 2.3

Post by captain_skank »

Hi Polo,

Minor bug/feature.

If u have a gadget selected and switch to code view and back to form view, the gadget is still selected on the form but the properties have switched to those of the window.

I think i've explained that right

cheers.
Polo
Addict
Addict
Posts: 2422
Joined: Tue May 06, 2003 5:07 pm
Location: UK

Re: Form Designer 5.00 beta 2.3

Post by Polo »

I noticed that as well, I'll fix that, thanks! :)
User avatar
Andre
PureBasic Team
PureBasic Team
Posts: 2137
Joined: Fri Apr 25, 2003 6:14 pm
Location: Germany (Saxony, Deutscheinsiedel)
Contact:

Re: Form Designer 5.00 beta 2.3

Post by Andre »

Hi Gaetan,

after some breaking I tested today the latest "Form Designer.app" straight out of the zip file.

I get this error message immediately after starting:
A program error was detected:

Error Message: Segmentation violation
Error Code: 11
Code Address: 896245
Sourcecode line: 4219
Sourcecode file: /Users/gaetandupont-panon/Documents/gdpcomputing/Purebasic/FormDesigner/mainevents.pb
So it seems the MacOS 10.5.8 specific bug is still present...
(don't know if I'm the only one left with this MacOS version here!?)
Bye,
...André
(PureBasicTeam::Docs & Support - PureArea.net | Order:: PureBasic | PureVisionXP)
Polo
Addict
Addict
Posts: 2422
Joined: Tue May 06, 2003 5:07 pm
Location: UK

Re: Form Designer 5.00 beta 2.3

Post by Polo »

It is indeed still here, I think there's something in the 2d drawing functions that are not working on this OSX version, though I do not believe it's from my code as it's working on any other platforms unfortunately :oops:
Polo
Addict
Addict
Posts: 2422
Joined: Tue May 06, 2003 5:07 pm
Location: UK

Re: Form Designer 5.00 beta 3

Post by Polo »

I rebranded the topic beta 3 as the one shipped with PB beta 3 wasn't updated, however this is not an update, sorry for the confusion!

Don't hesitate to continue testing on the latest version (which is beta 2.3) so that we can have a nice release when PB 5.00 final is released :)
IdeasVacuum
Always Here
Always Here
Posts: 6426
Joined: Fri Oct 23, 2009 2:33 am
Location: Wales, UK
Contact:

Re: Form Designer 5.00 beta 3

Post by IdeasVacuum »

On the font selection form there is a large un-used space under the fonts list - why not make the list height bigger and thus make it easier to select a font.
IdeasVacuum
If it sounds simple, you have not grasped the complexity.
Post Reply