Page 1 of 1

VD Problem

Posted: Wed Jan 16, 2013 1:38 pm
by Orreven
I am running the 64 Bit Purebasic package, v 4.61. Whenever I use the Visual designer, everything works fine until I press Project, Generate source. Then, whenever I run the file, It doesn't bring up the window, and simply says "The Program Execution has Finished." Also, this is assuming I already removed the creategadgetlist() problem. The generated code is:

Code: Select all

;
; PureBasic Visual Designer v3.95 build 1485 (PB4Code)


;- Window Constants
;
Enumeration
  #Window_0
EndEnumeration

;- Gadget Constants
;
Enumeration
  #Button_Exit
  #Button_Options
  #Button_Play
  #Frame3D_0
  #Text_0
  #Text_1
EndEnumeration

;- Fonts
Global FontID1
FontID1 = LoadFont(1, "Impact", 14)
Global FontID2
FontID2 = LoadFont(2, "Bookman Old Style", 14)
Global FontID3
FontID3 = LoadFont(3, "MS Reference Sans Serif", 18)

Procedure Open_Window_0()
  If OpenWindow(#Window_0, 291, 41, 600, 300, "Block Breaker",  #PB_Window_SystemMenu | #PB_Window_SizeGadget | #PB_Window_TitleBar )
      ButtonGadget(#Button_Exit, 160, 200, 250, 60, "Exit")
      SetGadgetFont(#Button_Exit, FontID1)
      ButtonGadget(#Button_Options, 160, 130, 250, 60, "Options")
      SetGadgetFont(#Button_Options, FontID1)
      ButtonGadget(#Button_Play, 160, 60, 250, 60, "Play")
      SetGadgetFont(#Button_Play, FontID1)
      Frame3DGadget(#Frame3D_0, 150, 50, 270, 220, "")
      TextGadget(#Text_0, 170, 0, 220, 20, "Block ", #PB_Text_Center)
      SetGadgetFont(#Text_0, FontID2)
      TextGadget(#Text_1, 160, 20, 230, 30, "BREAKER", #PB_Text_Center)
      SetGadgetFont(#Text_1, FontID3)
      
  EndIf
EndProcedure

Re: VD Problem

Posted: Wed Jan 16, 2013 4:14 pm
by gnozal
Your code is missing an event loop.

Iirc, you have to check 'Include event loop' in project options.

Re: VD Problem

Posted: Wed Jan 16, 2013 8:28 pm
by infratec
Hi,

as gnozal said, you need something like this:

Code: Select all

Open_Window_0()

Exit = #False
Repeat
  
  Event = WaitWindowEvent()
  Select Event
    Case #PB_Event_CloseWindow
      Exit = #True
  EndSelect
  
Until Exit
At the bottom of the code above.

Bernd

Re: VD Problem

Posted: Wed Jan 16, 2013 9:30 pm
by Orreven
Ah, thank you. This is the first programming language that I've learned that is sophisticated. Only other one was True Basic Bronze, which you can barely do anything in.