Form editor?

Just starting out? Need help? Post your questions and find answers here.
User avatar
Amon
User
User
Posts: 16
Joined: Wed Feb 18, 2004 1:24 am
Location: Shropshire, United Kingdom
Contact:

Form editor?

Post 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
This is my sig. By reading this or moving your mouse or eyes in to this box to read what is written you will have automatically been haxored to oblivion by a ver dangerous virus I programmed when computers never existed.
Little John
Addict
Addict
Posts: 4779
Joined: Thu Jun 07, 2007 3:25 pm
Location: Berlin, Germany

Re: Form editor?

Post 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
Last edited by Little John on Sun Jul 12, 2020 7:09 am, edited 1 time in total.
User avatar
Amon
User
User
Posts: 16
Joined: Wed Feb 18, 2004 1:24 am
Location: Shropshire, United Kingdom
Contact:

Re: SOLVED - Form editor?

Post by Amon »

I solved my query by RTFM. :)
This is my sig. By reading this or moving your mouse or eyes in to this box to read what is written you will have automatically been haxored to oblivion by a ver dangerous virus I programmed when computers never existed.
Post Reply