iswindow

Just starting out? Need help? Post your questions and find answers here.
t57042
Enthusiast
Enthusiast
Posts: 203
Joined: Fri Feb 22, 2008 12:28 pm
Location: Belgium

iswindow

Post 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   
User avatar
TI-994A
Addict
Addict
Posts: 2754
Joined: Sat Feb 19, 2011 3:47 am
Location: Singapore
Contact:

Re: iswindow

Post 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...
Texas Instruments TI-99/4A Home Computer: the first home computer with a 16bit processor, crammed into an 8bit architecture. Great hardware - Poor design - Wonderful BASIC engine. And it could talk too! Please visit my YouTube Channel :D
NEW NicknameFJ
New User
New User
Posts: 6
Joined: Fri Sep 04, 2015 8:32 pm

Re: iswindow

Post 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
User avatar
Demivec
Addict
Addict
Posts: 4282
Joined: Mon Jul 25, 2005 3:51 pm
Location: Utah, USA

Re: iswindow

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