#!/usr/bin/gtkbasic002


//-- load  file and show the window
gins_glade("ide01.glade")

//-- is ignored :-(
gtk( "gtk_widget_hide_on_delete", "newdialogwindow" , 0 , 0 , 0 , 0 , 0 )

gins_main()


//-- manipulate a widget, e.g. move the window
gins_set("window1" , "10" , "30" , "<uposition>")

// grouping radiobuttons crashes glade and gins... so handle them further down with events
//gins_set("radiobutton2" , "group" , "radiobutton1" , "<str>")

//-- mainloop with eventhandling
while 1

  widget , event , pdata = gins_event()

  if widget != Nothing then
    print widget, event
  '  print pdata

    if event = "GDK_DELETE" then

      if widget="window1" then
        print "....bye...."
        gins_exit()
        end
      end if
      if widget="newdialogwindow" then
        gtk("gtk_widget_hide" , "newdialogwindow",0,0,0,0,0)
        print "newdialog was closed"
      end if
    end if


// if event = "GDK_BUTTON_RELEASE"  then
if event = "GDK_BUTTON_PRESS"  then
   ' print widget
   ' print event
   ' print pdata

    if widget = "newdialogbuttoncancel" then
      newdialogbuttoncancel()
    end if
    if widget="buttonnew" then
      buttonnew()
    end if
    if widget="buttonglade" then
      xwin_system("glade &")
    end if
    if widget="buttoneditor" then
      xwin_system("leafpad &")
    end if
    if widget="buttongtkdoc" then
      xwin_system("defaultbrowser http://gtk.org/api &")
    end if
    end if



  end if
  xwin_usleep(10000)
wend

function  newdialogbuttoncancel()

  gtk("gtk_widget_hide" , "newdialogwindow",0,0,0,0,0)

end function  




function buttonnew ()
//  print "new"
 // xwin_usleep(100000)//avoids sync-error
  gtk("gtk_widget_show" , "newdialogwindow",0,0,0,0,0)
//xwin_system("sleep 2")
//gtk( "gtk_widget_hide_on_delete", "newdialogwindow" , 0 , 0 , 0 , 0 , 0 )

end function

