VD Problem

Just starting out? Need help? Post your questions and find answers here.
Orreven
User
User
Posts: 10
Joined: Fri Sep 21, 2012 12:47 am

VD Problem

Post 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
gnozal
PureBasic Expert
PureBasic Expert
Posts: 4229
Joined: Sat Apr 26, 2003 8:27 am
Location: Strasbourg / France
Contact:

Re: VD Problem

Post by gnozal »

Your code is missing an event loop.

Iirc, you have to check 'Include event loop' in project options.
For free libraries and tools, visit my web site (also home of jaPBe V3 and PureFORM).
infratec
Always Here
Always Here
Posts: 7662
Joined: Sun Sep 07, 2008 12:45 pm
Location: Germany

Re: VD Problem

Post 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
Orreven
User
User
Posts: 10
Joined: Fri Sep 21, 2012 12:47 am

Re: VD Problem

Post 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.
Post Reply