Page 1 of 1

Form editor?

Posted: Sun Jul 12, 2020 6:47 am
by Amon
I set this up in the form editor. Code below for it. I copied the code, made a new pb file and pasted the code. When I run it it shows nothing. What do I need to do to make what I design in the form be runnable?

Code: Select all

;
; This code is automatically generated by the FormDesigner.
; Manual modification is possible to adjust existing commands, but anything else will be dropped when the code is compiled.
; Event procedures needs to be put in another source file.
;

Global Window_0

Global Button_0


Procedure OpenWindow_0(x = 0, y = 0, width = 120, height = 50)
  Window_0 = OpenWindow(#PB_Any, x, y, width, height, "", #PB_Window_SystemMenu)
  Button_0 = ButtonGadget(#PB_Any, 10, 10, 100, 25, "ClickME")
EndProcedure

Procedure Window_0_Events(event)
  Select event
    Case #PB_Event_CloseWindow
      ProcedureReturn #False

    Case #PB_Event_Menu
      Select EventMenu()
      EndSelect

    Case #PB_Event_Gadget
      Select EventGadget()
      EndSelect
  EndSelect
  ProcedureReturn #True
EndProcedure

Re: Form editor?

Posted: Sun Jul 12, 2020 7:09 am
by Little John
I never use PureBasic's Form Designer. However, it seems that you have to write the main code for event handling yourself.
Add the following lines at the bottom of your code:

Code: Select all

Define.i event, result

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

Re: SOLVED - Form editor?

Posted: Sun Jul 12, 2020 7:09 am
by Amon
I solved my query by RTFM. :)