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 3

Post by Polo »

And as I replied on the french forum, if you check "Caption is a variable" it'll be treated as a variable...
Again, if you want to use enumeration, just uncheck #PB_Any (gadget per gadget or in preferences)
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 »

To make sure everyone is using the latest version I've quickly compiled a new one:

http://www.gdpcomputing.co.uk/formdesigner.html
User avatar
ts-soft
Always Here
Always Here
Posts: 5756
Joined: Thu Jun 24, 2004 2:44 pm
Location: Berlin - Germany

Re: Form Designer 5.00 beta 3

Post by ts-soft »

Polo wrote:To make sure everyone is using the latest version I've quickly compiled a new one:
But you should always use the same name :wink:
Windows: FormDesigner.exe, Form Designer.exe and Visuell Designer.exe :?:
PureBasic 5.73 | SpiderBasic 2.30 | Windows 10 Pro (x64) | Linux Mint 20.1 (x64)
Old bugs good, new bugs bad! Updates are evil: might fix old bugs and introduce no new ones.
Image
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 »

Oops. :oops:
Golfy
User
User
Posts: 97
Joined: Wed Mar 21, 2012 6:10 pm

Re: Form Designer 5.00 beta 3

Post by Golfy »

Polo wrote:And as I replied on the french forum, if you check "Caption is a variable" it'll be treated as a variable...
Again, if you want to use enumeration, just uncheck #PB_Any (gadget per gadget or in preferences)
:oops:
I'm really a dumb : 3 options could sink me :lol:
Sorry about annoyance :|

By the way, how to use the EventProcedure field (the list is empty) ? I would to add some action like below...

Code: Select all

Procedure Window_0_Events(event)
  Select event
    Case #PB_Event_Gadget
      Select EventGadget()
      EndSelect
    Case #PB_Event_SizeWindow
    	ResizeGadgetsWindow_0()
  EndSelect
EndProcedure

InitWindow_0()
Repeat
	event = WaitWindowEvent(20)
	Window_0_Events(event)
Until event = #PB_Event_CloseWindow
luciano
Enthusiast
Enthusiast
Posts: 151
Joined: Wed Mar 09, 2011 8:25 pm

Re: Form Designer 5.00 beta 3

Post by luciano »

I downloaded the latest version. I believe there is a problem with gadget positions when there is the toolbar (at least in windows):

Code: Select all

Global Window_1

Global Panel_0

Global Img_0, Img_1

Enumeration #PB_Compiler_EnumerationValue
  #Toolbar_0
  #Toolbar_1
EndEnumeration

UsePNGImageDecoder()

Img_0 = LoadImage(#PB_Any,"C:\ZZZZ_Ardi_Go\Explorer\16x16-free-toolbar-icons\png\73.png")
Img_1 = LoadImage(#PB_Any,"C:\ZZZZ_Ardi_Go\Explorer\16x16-free-toolbar-icons\png\25.png")

Procedure InitWindow_1()
  Window_1 = OpenWindow(#PB_Any, 0, 0, 600, 400, "", #PB_Window_SystemMenu)
  CreateToolbar(0, WindowID(Window_1))
  ToolBarImageButton(#Toolbar_0,ImageID(Img_0))
  ToolBarImageButton(#Toolbar_1,ImageID(Img_1))
  Panel_0 = PanelGadget(#PB_Any, 10, 0, 580, 370)
  AddGadgetItem(Panel_0, -1, "Tab 1")
  CloseGadgetList()
EndProcedure

Procedure Window_1_Events(event)
  Select event
    Case #PB_Event_Gadget
      Select EventGadget()
      EndSelect
  EndSelect
EndProcedure

InitWindow_1()

Repeat
  event = WaitWindowEvent()
  Window_1_Events(event)
ForEver
[img]
http://s10.postimage.org/41m595qax/test.jpg
[/img]
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 »

Fixed, thanks.
Warmonger
Enthusiast
Enthusiast
Posts: 156
Joined: Wed Apr 20, 2011 4:24 pm

Re: Form Designer 5.00 beta 3

Post by Warmonger »

Probably would be beneficial to add the #PB_Event_CloseWindow event to your event loop. Plus the "generate event loop" option should remove this procedure when its not checked. As it is part of the event loop. This way if people only decide to design the form in the designer they don't end up with a piece of the event loop.

Code: Select all

Procedure Window_0_Events(event)
  Select event
    Case #PB_Event_Gadget
      Select EventGadget()
      EndSelect
    Case #PB_Event_CloseWindow
      End
  EndSelect
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.
wilbert
PureBasic Expert
PureBasic Expert
Posts: 3942
Joined: Sun Aug 08, 2004 5:21 am
Location: Netherlands

Re: Form Designer 5.00 beta 3

Post by wilbert »

Another option would be to let the event procedure return true / false.

Code: Select all

Procedure Window_0_Events(event)
  Select event
    Case #PB_Event_Gadget
      Select EventGadget()
      EndSelect
    Case #PB_Event_CloseWindow
      ProcedureReturn #True
  EndSelect
  ProcedureReturn #False
EndProcedure
That way you can repeat until Window_0_Events(event) = #True and still do some cleanup or closing of files afterwards.
Warmonger
Enthusiast
Enthusiast
Posts: 156
Joined: Wed Apr 20, 2011 4:24 pm

Re: Form Designer 5.00 beta 3

Post by Warmonger »

wilbert wrote:Another option would be to let the event procedure return true / false.

Code: Select all

Procedure Window_0_Events(event)
  Select event
    Case #PB_Event_Gadget
      Select EventGadget()
      EndSelect
    Case #PB_Event_CloseWindow
      ProcedureReturn #True
  EndSelect
  ProcedureReturn #False
EndProcedure
That way you can repeat until Window_0_Events(event) = #True and still do some cleanup or closing of files afterwards.
That would not work, as the #PB_Event_CloseWindow is to represent the close program event. It should be a simple End, what you are referring to is a custom event that only pertains to your use. Usually when everyone uses the #PB_Event_CloseWindow flag its usually followed by a End. Especially for GUI applications, the only way it would return a value is if Polo added in code prediction for applications that don't even exist yet, for example a application that I will code tomorrow, or maybe next week. He will need to know the exact structure of your code with all data types etc. Its impossible for him to know code that doesn't exist, let alone write this tool to predict future code its 100% impossible to do. So it would end up staying the way it is before it would ever return a value. Tho if he adds the proper End to it, all you would have to do is change it out with a procedurereturn. Instead of having to type the case flag, and then what to do. The idea is to structure the event loop properly, not structure it to one persons needs.
Last edited by Warmonger on Tue Sep 25, 2012 5:57 am, edited 1 time in total.
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.
User avatar
KJ67
Enthusiast
Enthusiast
Posts: 218
Joined: Fri Jun 26, 2009 3:51 pm
Location: Westernmost tip of Norway

Re: Form Designer 5.00 beta 3

Post by KJ67 »

Wilberts version works well indeed, that is a template that I've been using for years.
Just doing 'End' with no cleaning up, flushing data to disks from arrays and lists etc. could be bad.

In general: I would recommend a single shutdown code instead of having uncontrolled End's all over.
The best preparation for tomorrow is doing your best today.
Warmonger
Enthusiast
Enthusiast
Posts: 156
Joined: Wed Apr 20, 2011 4:24 pm

Re: Form Designer 5.00 beta 3

Post by Warmonger »

KJ67 wrote:Wilberts version works well indeed, that is a template that I've been using for years.
Just doing 'End' with no cleaning up, flushing data to disks from arrays and lists etc. could be bad.

In general: I would recommend a single shutdown code instead of having uncontrolled End's all over.
Like stated above it would be a up-most terrible idea to have it return a value not everyone is going to use. Take a look at this code and tell me how it would not work for you.

Code: Select all

Procedure Window_0_Events(event)
  Select event
    Case #PB_Event_Gadget
      Select EventGadget()
      EndSelect
    Case #PB_Event_CloseWindow
      CleanUp() ;Add Your Cleanup
      End
  EndSelect
EndProceduree
Keep in mind 90% of the people when debugging and using the generated code for the first time are going to want that control to do what its made for. And that purpose is exiting the program, having to go into the process manager every time just to debug a form would be just too much. Also remember that your cleanup function isn't going to look nothing like mine, let alone look anything like anybody else's. Tho one thing is for sure once you click the exit control, you intend for the program to eventually end.
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.
User avatar
KJ67
Enthusiast
Enthusiast
Posts: 218
Joined: Fri Jun 26, 2009 3:51 pm
Location: Westernmost tip of Norway

Re: Form Designer 5.00 beta 3

Post by KJ67 »

For me the loop before the GUI would look something like;

Code: Select all

InitCode()
InitWindow_0()
Repeat:Until Window_0_Events(WaitWindowEvent()) = #True
;CloseWindow(XYZ)
ShutDownGracefully()
The use of End would risk causing lost data. Any application that handles more complicated data will have to consider the use of a shutdown & save function - not just pull the plug.
The best preparation for tomorrow is doing your best today.
wilbert
PureBasic Expert
PureBasic Expert
Posts: 3942
Joined: Sun Aug 08, 2004 5:21 am
Location: Netherlands

Re: Form Designer 5.00 beta 3

Post by wilbert »

Warmonger wrote:Tho one thing is for sure once you click the exit control, you intend for the program to eventually end.
True, but almost never immediately.
Both the PureBasic IDE and the Form Designer are coded using PureBasic itself. Assume you did a lot of hard work on the project you are working on, forget to save the changes and hit the close button. Most people would be very unhappy if it just exists without asking if the modified files need to be saved.
As for your other comment, what's wrong with returning a value if not everybody is using it. A procedure like ButtonGadget returns a value but most users just ignore it.
Warmonger
Enthusiast
Enthusiast
Posts: 156
Joined: Wed Apr 20, 2011 4:24 pm

Re: Form Designer 5.00 beta 3

Post by Warmonger »

wilbert wrote:
Warmonger wrote:Tho one thing is for sure once you click the exit control, you intend for the program to eventually end.
True, but almost never immediately.
Both the PureBasic IDE and the Form Designer are coded using PureBasic itself. Assume you did a lot of hard work on the project you are working on, forget to save the changes and hit the close button. Most people would be very unhappy if it just exists without asking if the modified files need to be saved.
As for your other comment, what's wrong with returning a value if not everybody is using it. A procedure like ButtonGadget returns a value but most users just ignore it.
So your suggesting he code in support for everyone's own cleanup functions? You do understand they are different with every single program that was ever written. Like posted before you just call your cleanup before the end. The end is universal among every single application, as it will look exactly the same in every program any of you will write. An example how is this...

Code: Select all

Procedure CleanUp()
  ;Do Some Stuff
  End
EndProcedure

Procedure Window_0_Events(event)
  Select event
    Case #PB_Event_Gadget
      Select EventGadget()
      EndSelect
    Case #PB_Event_CloseWindow
      CleanUp() ;Add Your Cleanup
  EndSelect
EndProcedure
...different from this.

Code: Select all

Procedure CleanUp()
  ;Do Some Stuff
EndProcedure

Procedure Window_0_Events(event)
  Select event
    Case #PB_Event_Gadget
      Select EventGadget()
      EndSelect
    Case #PB_Event_CloseWindow
      CleanUp() ;Add Your Cleanup
      End
  EndSelect
EndProcedure
Why is this exactly hard for you guys to understand. :shock:
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.
Post Reply