program just ending when i use a window/console?

Just starting out? Need help? Post your questions and find answers here.
muab256
User
User
Posts: 43
Joined: Mon Apr 28, 2003 4:57 pm

program just ending when i use a window/console?

Post by muab256 »

hi there =)

strange thing...

i have a program that generates a html fil out of a list of jpegs in a directory...
works fine, but could take a while, so i wanted some output.

but as soon as i include a window or console (only opening... no output yet!) the program will just end up somewhere in the middle.
allways the same position where it ends... now...
when i move the window/console line from the top to below my variable/constants defenition part, or somewhere later in the code, the position where the program ends is different.

can this be? (im not drunk or such)

thx in advance
muaB
Berikco
Administrator
Administrator
Posts: 1326
Joined: Wed Apr 23, 2003 7:57 pm
Location: Belgium
Contact:

Post by Berikco »

Could you post a small example?
muab256
User
User
Posts: 43
Joined: Mon Apr 28, 2003 4:57 pm

Post by muab256 »

If OpenWindow ( 0, 512-200, 384-75, 400, 75, #PB_Window_ScreenCentered | #PB_Window_BorderLess, "TEST" )
CreateGadgetList ( WindowID() )
TextGadget ( 1, 0, 0, 400, 75, Chr ( 13 ) +version+Chr ( 13 ) +Chr ( 13 ), #PB_Text_Center | #PB_Text_Border )
EndIf ; openwindow

or

if openconsole() : else : end : endif

both does open a window...
but for some reason (really, the windows are used in no way, just opened) this is enough...
Berikco
Administrator
Administrator
Posts: 1326
Joined: Wed Apr 23, 2003 7:57 pm
Location: Belgium
Contact:

Post by Berikco »

do you have an Event Loop in your code?
like this...

Code: Select all

; PureBasic Visual Designer v3.63d Beta


;- Window Constants
;
#Window_0 = 0

;- Gadget Constants
;
#ButtonOK = 0


Procedure Open_Window_0()
  If OpenWindow(#Window_0, 216, 0, 600, 300,  #PB_Window_SystemMenu | #PB_Window_SizeGadget | #PB_Window_TitleBar , "New window ( 0 )")
    If CreateGadgetList(WindowID())
      ButtonGadget(#ButtonOK, 85, 225, 125, 40, "Ok")
      
    EndIf
  EndIf
EndProcedure


Open_Window_0()

Repeat
  Event = WaitWindowEvent()
Until Event = #PB_EventCloseWindow
End
muab256
User
User
Posts: 43
Joined: Mon Apr 28, 2003 4:57 pm

Post by muab256 »

no.

i have a loop, yes, but no event loop.

the window isnt accesed in any way by the code, the only thing so far is, that the window is opened...
Post Reply