#!/usr/bin/gtkbasic002

HERE = xwin_getdir(command(2))
HERE &= "/resource" 
xwin_cd(HERE)

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


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


//-- get information about a widget
a = gins_get("button1" , "label" , "<str>")
print a


gtk_createobject("GtkLabel" , "label77", "testlabel" , 0)
gtk("gtk_box_pack_start" , "vbox1" , ":label77" , "1","1","1",0)
gtk("gtk_widget_show" , ":label77" , 0 ,0,0,0,0)
//gtk_buildlists()

gtk_createobject("GtkBasicList" , "mylist1", ":window1" , ":vbox1")


//-- mainloop with eventhandling
while 1

  checkclose()
  widget , event , pdata = gins_event()

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

    if event = "GDK_DELETE" then
      gins_exit()
      end
    end if

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


          gins_set("button1" , "label" , time() , "<str>")
     
    end if


  end if

  xwin_usleep(2000)

wend

 //------------------------------------------------------------
// this function exits Basic, if the grafical interface crashed
sub checkclose()
	a=gins_get("window1" , "name" , "<str>")
	if a = Nothing then
		print "window was closed, exiting..."
		gins_exit()
		end
	end if
end sub

