But only briefly! It Should remain visible until the same button is clicked again, which reopens and displays the second window over and over again.
What is wrong?
Richard
Code: Select all
;test
Global Window_0,Window_1
Global Editor_0, Button_1, Button_3, ListIcon_0
;==============================================================================
Procedure otherwin(txt$)
   OpenWindow(1,20, 180, 1000, 420,  "SQLviewer", #PB_Window_MinimizeGadget)
    ListIconGadget(11, 10, 5, 980, 410, "", 120, #PB_ListIcon_GridLines | #PB_ListIcon_FullRowSelect)
    SetGadgetColor(11, #PB_Gadget_BackColor, $DEC4B0)
    SetGadgetFont(11, FontID(1))   
EndProcedure
    
;==============================================================================
Procedure InitWindow_0()
  LoadFont(0, "tohamo", 12)
  LoadFont(1, "tohamo", 10)
  Window_0 = OpenWindow(#PB_Any, 0, 0, 1040, 640,  "SQLviewer", #PB_Window_MinimizeGadget)
  Editor_0 = EditorGadget(#PB_Any, 10, 10, 860, 130)
  Button_1 = ButtonGadget(#PB_Any, 890, 10, 130, 50, "Execute (F5)")
  Button_3 = ButtonGadget(#PB_Any, 890, 90, 130, 50, "Clear")
  CreateStatusBar(0, WindowID(Window_0 ))
  AddStatusBarField(290)
  SetWindowColor(Window_0, $DCDCDC) 
  SetGadgetFont(Editor_0, FontID(0))
  AddKeyboardShortcut(Window_0,  #PB_Shortcut_F5, 50)  ; enter
  SetActiveGadget(Editor_0) ; set focus on editor
  
  ;EVENTS
  Repeat
    Event = WaitWindowEvent()
    
    Select event
      Case #PB_Event_CloseWindow 
        If EventWindow()=Window_0
          quit=1
          ProcedureReturn #False
        Else
          CloseWindow(Window_1)
        EndIf  
      Case #PB_Event_Gadget
        Select EventGadget()
          Case Button_1
            inh$ = GetGadgetText(Editor_0)                          
            otherwin(inh$)
            SetActiveGadget(Editor_0) ; set focus on editor
          Case Button_3
            ClearGadgetItems(Editor_0)
            SetActiveGadget(Editor_0) ; set focus on editor
        EndSelect
      Case #PB_Event_Menu 
        If EventMenu() = 50 
            inh$ = GetGadgetText(Editor_0)
            otherwin(inh$)
            SetActiveGadget(Editor_0) ; set focus on editor
        EndIf  
    EndSelect
   Until quit=1  
  ProcedureReturn #True
EndProcedure
;==============================================================================
;MAIN
 InitWindow_0()
End


