Re: More WEE requests

new topic     » goto parent     » topic index » view thread      » older message » newer message

Replying on the forum, rather than e-mail, as perhaps someone else can benefit from these code snippets

  
 -- set up dialog to open one or more files; 
  
global function ui_get_open_file_name()  
  atom dialog 
  object filenames 
   
  dialog = create(GtkFileChooserDialog,{ 
    {"title","Open..."}, 
    {"action",GTK_FILE_CHOOSER_ACTION_OPEN}, 
    {"select multiple", TRUE}, 
    {"add button", "gtk-cancel", GTK_RESPONSE_CLOSE}, 
    {"add button", "gtk-ok", GTK_RESPONSE_OK}, 
    {"position", GTK_WIN_POS_MOUSE}, 
    {"current folder", pathname(canonical_path(file_name))}}) 
   
  add(dialog, {filter1, filter2, filter3}) 
   
  if gtk:get(dialog, "run") = GTK_RESPONSE_OK then 
    filenames = gtk:get(dialog, "filenames") 
     
		-- if one file chosen, looks like this: 
		--{ 
		--	"/home/irv/WEE-master/parser.e" 
		--} 
    if length(filenames) = 1 then 
		filenames = filenames[1] -- just return the one name; 
		 
	else 
		-- multiple files selected: 
		--{  
		--  "/home/irv/WEE-master/parser.e", 
		--  "/home/irv/WEE-master/scintilla.e", 
		--  "/home/irv/WEE-master/ui_win.e" 
		--} 
		-- you'll have to modify your open_file function to  
		-- loop thru this sequence of filenames;	 
	end if 
   
  else 
     
    filenames = "" -- nothing selected; 
     
  end if 
   
  set(dialog, "hide") 
 
  return filenames 
   
end function 
 
new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu