Page 1 of 1

iswindow

Posted: Sat Oct 17, 2015 5:37 pm
by t57042
Why does iswindow return "not initialized?

Richard

Code: Select all

a=OpenWindow(0, 100, 200, 195, 260, "PureBasic Window", #PB_Window_SystemMenu | #PB_Window_MinimizeGadget | #PB_Window_MaximizeGadget)

 If IsWindow(a)
       Debug "ok"    
 Else
       Debug "not initialised"
 EndIf  
  
  Repeat
    Event = WaitWindowEvent()

    If Event = #PB_Event_CloseWindow  ; If the user has pressed on the close button
      Quit = 1
    EndIf

  Until Quit = 1


End   

Re: iswindow

Posted: Sat Oct 17, 2015 5:40 pm
by TI-994A
t57042 wrote:Why does iswindow return "not initialized?
You'd need to use #PB_Any to assign the window number to a:

Code: Select all

a = OpenWindow(#PB_Any, 100, 200, 195, 260...

Re: iswindow

Posted: Sat Oct 17, 2015 5:41 pm
by NEW NicknameFJ
Do it this way:

Code: Select all

 a=OpenWindow(0, 100, 200, 195, 260, "PureBasic Window", #PB_Window_SystemMenu | #PB_Window_MinimizeGadget | #PB_Window_MaximizeGadget)

 If IsWindow(0)
       Debug "ok"   
 Else
       Debug "not initialised"
 EndIf 
 
  Repeat
    Event = WaitWindowEvent()

    If Event = #PB_Event_CloseWindow  ; If the user has pressed on the close button
      Quit = 1
    EndIf

  Until Quit = 1


End  
or this way

Code: Select all

 a=OpenWindow(#pb_any, 100, 200, 195, 260, "PureBasic Window", #PB_Window_SystemMenu | #PB_Window_MinimizeGadget | #PB_Window_MaximizeGadget)

 If IsWindow(a)
       Debug "ok"   
 Else
       Debug "not initialised"
 EndIf 
 
  Repeat
    Event = WaitWindowEvent()

    If Event = #PB_Event_CloseWindow  ; If the user has pressed on the close button
      Quit = 1
    EndIf

  Until Quit = 1


End  

EDIT: to late

Re: iswindow

Posted: Sat Oct 17, 2015 11:27 pm
by Demivec
Or test it this third way:

Code: Select all

 a=OpenWindow(0, 100, 200, 195, 260, "PureBasic Window", #PB_Window_SystemMenu | #PB_Window_MinimizeGadget | #PB_Window_MaximizeGadget)

 If a
       Debug "ok"   
 Else
       Debug "not initialised"
 EndIf 
 
  Repeat
    Event = WaitWindowEvent()

    If Event = #PB_Event_CloseWindow  ; If the user has pressed on the close button
      Quit = 1
    EndIf

  Until Quit = 1


End