#!/usr/bin/ginsbasic001


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

  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_PRESS" then
'    if event = "GDK_BUTTON_RELEASE" then
      if widget = "button1" then
        selectedfolder = gtk("gtk_file_chooser_get_current_folder" ,"filechooserbutton1" ,  0 , 0, 0,0,0)
        selectedfile = gtk( "gtk_file_chooser_get_filename" , "filechooserbutton1" ,0 , 0, 0,0,0)
        gins_set("label1" , "label" ,  selectedfolder & " " & selectedfile , "<str>")
      end if
    end if

  end if

  xwin_usleep(10000)

wend
