#!/usr/bin/gtkbasic002



//-- 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_RELEASE" then
'    if event = "GDK_BUTTON_PRESS" then
      if widget = "button1" then

        b = gtk( "gtk_label_set_selectable" , "label1" , "1" , 0 ,0,0,0)

        a = gtk( "gtk_label_get_selectable" , "label1" , 0 , 0 ,0,0,0)

// does not work with FileChooserBUTTON
        b = gtk("gtk_file_chooser_set_select_multiple" , "filechooserbutton1" , "1" , 0 ,0,0,0)

        a = gtk("gtk_file_chooser_get_select_multiple" , "filechooserbutton1" , 0 , 0 ,0,0,0)
print "multiselect: " & a

        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" , a  & " " &  selectedfolder & " " & selectedfile , "<str>")
      end if
    end if

  end if

  xwin_usleep(10000)

wend
