Re[2]: [gtkmm] fileselection dialog



Wednesday, May 5, 2004, 3:22:38 AM, you wrote:

VG> Denis,
VG> have you tried smthing like this?
VG> Gtk::FileSelection f ("Choose a deck");
VG> f.complete ("*.xml");
VG> It will not filter the files in the dialog until
VG> user hits the TAB key. I haven't tried to simulate
VG> TAB key emission from application level (and would 
VG> like to know how to do it).
Yes, I've tried it. Also I've tried to simulate TAB emission.
I wrote some code for this purpose, where manual_event is
  GdkEvent*  manual_event
object with
(GdkEventKey*)manual_event->keyval =65289 // the TAB keysum
-------------------------------------------------
class FileDialog: public Gtk::FileSelection {
      bool event_handler(GdkEvent* event) {
       if(event->type==GDK_2BUTTON_PRESS) {
         bool handled = get_selection_entry()->event(manual_event);
       } else  if(event->type==GDK_KEY_PRESS && ((GdkEventKey*)event)->keyval==65293/*enter keysum*/) {
                bool handled = get_selection_entry()->event(manual_event);
               }
       return false;
     }
public:
      FileDialog(std::string s): Gtk::FileSelection(s) {
       get_dir_list()->signal_event().connect(SigC::slot(*this,&FileDialog::event_handler));
       complete("*.cpp");
      }
};
-------------------------------------------------
But I did something wrong and this peace of code
    get_selection_entry()->event(manual_event);
leads to some run-time errors.
VG> Another problem with FileSelection dialog is that 
VG> every time user changes the directory, the completion
VG> window looses its focus and hitting TAB messes thing up.
I've also tried grab_focus() for selection_entry when
signal_focus_out occured and then emit TAB-hit signal. But it is not
right solution because user then can't use keybord, selecting files or
dirs.
I still don't know how to simply filter files in
Gtk::FileSelection dialog.
I have one idea. There is
Gtk::TreeView* Gtk::FileSelection::get_file_list() method.
I'd like to get list of strings containing file names and then filter
it. But I don't know how to get list of strings from this TreeView*.

Best regards,
 Denis                          




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]