Page 31 of 45

Re: Form Designer 5.00 beta 2.3

Posted: Fri Sep 14, 2012 9:38 am
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.

Re: Form Designer 5.00 beta 2.3

Posted: Fri Sep 14, 2012 10:03 am
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...

Re: Form Designer 5.00 beta 2.3

Posted: Fri Sep 14, 2012 11:44 pm
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

Re: Form Designer 5.00 beta 2.3

Posted: Sat Sep 15, 2012 12:17 am
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. ;)

Re: Form Designer 5.00 beta 2.3

Posted: Sat Sep 15, 2012 6:33 am
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.

Re: Form Designer 5.00 beta 2.3

Posted: Sat Sep 15, 2012 8:32 am
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


Re: Form Designer 5.00 beta 2.3

Posted: Sat Sep 15, 2012 6:47 pm
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).

Re: Form Designer 5.00 beta 2.3

Posted: Sun Sep 16, 2012 2:10 am
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

Re: Form Designer 5.00 beta 2.3

Posted: Sun Sep 16, 2012 8:50 am
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!! ;)

Re: Form Designer 5.00 beta 2.3

Posted: Mon Sep 17, 2012 11:04 am
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.

Re: Form Designer 5.00 beta 2.3

Posted: Mon Sep 17, 2012 4:10 pm
by Polo
I noticed that as well, I'll fix that, thanks! :)

Re: Form Designer 5.00 beta 2.3

Posted: Mon Sep 17, 2012 7:55 pm
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!?)

Re: Form Designer 5.00 beta 2.3

Posted: Mon Sep 17, 2012 8:43 pm
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:

Re: Form Designer 5.00 beta 3

Posted: Tue Sep 18, 2012 6:38 pm
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 :)

Re: Form Designer 5.00 beta 3

Posted: Tue Sep 18, 2012 11:34 pm
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.