#!/usr/bin/gtkbasic002

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

//-- load  file and show the window
gins_glade("project.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


//-- 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

