* Documentation or examples wanted for the File_Chooser_Dialog @ 2009-05-08 16:01 ldries46 2009-05-08 16:25 ` Dmitry A. Kazakov 0 siblings, 1 reply; 7+ messages in thread From: ldries46 @ 2009-05-08 16:01 UTC (permalink / raw) I want to use the File_Chooser_Dialog of GtkADA in stead of the File_Selection routine. I understand that more fine tuning is possible in the File_Chooser. I have a problem finding good documentation of the routine in which is explained how to create a program that can use it. Even examples in which the File Chooser Dialog is used I cannot find. Can somebody tell me where on the net I can find such examples or documentation. I tried the trial and error method in which I reached the point that I got a window frame and a message that I cannot use a toplevel window as a parent in the GTK_New routine of the File Chooser Dialog. -- ========================= Familie Dries Torenpad 122 A 2771 EV Boskoop ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: Documentation or examples wanted for the File_Chooser_Dialog 2009-05-08 16:01 Documentation or examples wanted for the File_Chooser_Dialog ldries46 @ 2009-05-08 16:25 ` Dmitry A. Kazakov 2009-05-08 20:43 ` ldries46 0 siblings, 1 reply; 7+ messages in thread From: Dmitry A. Kazakov @ 2009-05-08 16:25 UTC (permalink / raw) On Fri, 8 May 2009 18:01:36 +0200, ldries46 wrote: > I want to use the File_Chooser_Dialog of GtkADA in stead of the > File_Selection routine. I understand that more fine tuning is possible in > the File_Chooser. I have a problem finding good documentation of the routine > in which is explained how to create a program that can use it. Even examples > in which the File Chooser Dialog is used I cannot find. > Can somebody tell me where on the net I can find such examples or > documentation. http://www.adacore.com/wp-content/files/auto_update/gtkada-docs/gtkada_rm/gtkada_rm/gtk-file_chooser_dialog.html > I tried the trial and error method in which I reached the point that I got a > window frame and a message that I cannot use a toplevel window as a parent > in the GTK_New routine of the File Chooser Dialog. It should work like any other widget (which it is a descendant of). (Though, I never used this dialog, because I prefer a columned file selection style like in Windows GUI.) -- Regards, Dmitry A. Kazakov http://www.dmitry-kazakov.de ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: Documentation or examples wanted for the File_Chooser_Dialog 2009-05-08 16:25 ` Dmitry A. Kazakov @ 2009-05-08 20:43 ` ldries46 2009-05-09 7:00 ` Dmitry A. Kazakov 0 siblings, 1 reply; 7+ messages in thread From: ldries46 @ 2009-05-08 20:43 UTC (permalink / raw) THis is just one of the sites I visited. I think it is Unix like documentation, Good when you know how to use the something but Fuzzy when you have to learn something. I hope that there is documentation or examples that are more clear for leople who do want to learn something. "Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de> schreef in bericht news:3il2h6knjn6e$.1d81alwet09tw$.dlg@40tude.net... > On Fri, 8 May 2009 18:01:36 +0200, ldries46 wrote: > >> I want to use the File_Chooser_Dialog of GtkADA in stead of the >> File_Selection routine. I understand that more fine tuning is possible in >> the File_Chooser. I have a problem finding good documentation of the >> routine >> in which is explained how to create a program that can use it. Even >> examples >> in which the File Chooser Dialog is used I cannot find. >> Can somebody tell me where on the net I can find such examples or >> documentation. > > http://www.adacore.com/wp-content/files/auto_update/gtkada-docs/gtkada_rm/gtkada_rm/gtk-file_chooser_dialog.html > >> I tried the trial and error method in which I reached the point that I >> got a >> window frame and a message that I cannot use a toplevel window as a >> parent >> in the GTK_New routine of the File Chooser Dialog. > > It should work like any other widget (which it is a descendant of). > > (Though, I never used this dialog, because I prefer a columned file > selection style like in Windows GUI.) > > -- > Regards, > Dmitry A. Kazakov > http://www.dmitry-kazakov.de ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: Documentation or examples wanted for the File_Chooser_Dialog 2009-05-08 20:43 ` ldries46 @ 2009-05-09 7:00 ` Dmitry A. Kazakov 2009-05-10 14:27 ` ldries46 0 siblings, 1 reply; 7+ messages in thread From: Dmitry A. Kazakov @ 2009-05-09 7:00 UTC (permalink / raw) On Fri, 8 May 2009 22:43:42 +0200, ldries46 wrote: > THis is just one of the sites I visited. I think it is Unix like > documentation, Good when you know how to use the something but Fuzzy when > you have to learn something. The documentation is actually not bad, IMO. (But learning GTK is always an act of masochism. (:-)) > I hope that there is documentation or examples > that are more clear for leople who do want to learn something. You could start Gtk_Dialog: http://www.adacore.com/wp-content/files/auto_update/gtkada-docs/gtkada_rm/gtkada_rm/gtk-dialog.html Gtk_Dialog_Record is the parent of Gtk_File_Chooser_Dialog_Record.. The testgtk application is contains an example for Gtk_Dialog_Record. You could try to replace Gtk_Dialog with Gtk_File_Chooser_Dialog_Record there. -- Regards, Dmitry A. Kazakov http://www.dmitry-kazakov.de ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: Documentation or examples wanted for the File_Chooser_Dialog 2009-05-09 7:00 ` Dmitry A. Kazakov @ 2009-05-10 14:27 ` ldries46 2009-05-11 10:50 ` Philipp Riegger 0 siblings, 1 reply; 7+ messages in thread From: ldries46 @ 2009-05-10 14:27 UTC (permalink / raw) First Thanks for the hint. I now have a working routine. I now want to present this as an example for anyone who wants to use the FilechooserDialog routine. In this routine I set a default directory and saves the directory where the file was eventually was found. procedure On_Open_C_Activate (Object : access Gtk_Image_Menu_Item_Record'Class) is Default_ext : Integer; Filename : Unbounded_String; Base_Dir : Unbounded_String := To_Unbounded_String("." & DS); Default_Dir : Unbounded_String; In_String : Unbounded_String; C_File : File_Type; soort : file_soort; ok : boolean := false; empty : boolean := false; File_Dialog : Gtk_File_Chooser_Dialog; All_Files : Gtk_File_Filter; Header : Gtk_File_Filter; C_Body : Gtk_File_Filter; CPP_Body : Gtk_File_Filter; Final_Filter : Gtk_File_Filter; Button_Open : Gtk.Widget.Gtk_Widget; Button_Cancel : Gtk.Widget.Gtk_Widget; begin Default_Dir := To_Unbounded_String(Get_Value(n_ini, "Directory", "Default_Open", To_String(Base_Dir))); Default_Ext := Get_Value(n_ini, "File", "Type", 1); Gtk_New(File_Dialog,"Open C, C++ or Header File", CtoADAWindow, Action_Open); if Base_Dir /= Default_Dir then empty := Set_Current_Folder(+File_Dialog, To_String(Default_Dir)); end if; Gtk_New(All_Files); Set_Name(All_Files, "All files"); Add_Pattern(All_Files, "*.*"); Add_Filter(+File_Dialog, All_Files); Gtk_New(Header); Set_Name(Header, "C/C++ header files"); Add_Pattern(Header, "*.h"); Add_Filter(+File_Dialog, Header); Gtk_New(C_Body); Set_Name(C_Body, "C body files"); Add_Pattern(C_Body, "*.c"); Add_Filter(+File_Dialog, C_Body); Gtk_New(CPP_Body); Set_Name(CPP_Body, "C++ body files"); Add_Pattern(CPP_Body, "*.cpp"); Add_Filter(+File_Dialog, CPP_Body); case Default_Ext is when 1 => Set_Filter(+File_Dialog, All_Files); when 2 => Set_Filter(+File_Dialog, Header); when 3 => Set_Filter(+File_Dialog, C_Body); when 4 => Set_Filter(+File_Dialog, CPP_Body); when others => Set_Filter(+File_Dialog, Header); end case; Button_Open := Add_Button(File_Dialog, "Open", gtk_response_accept); Button_Cancel := Add_Button(File_Dialog, "Cancel", gtk_response_cancel); Final_Filter := Get_Filter(+File_Dialog); if Run(File_Dialog) = gtk_response_accept then FileName := To_Unbounded_String(Get_FileName(+File_Dialog)); Default_Dir := To_Unbounded_String(Get_Current_Folder(+File_Dialog)); Set_Value(n_ini, "Directory", "Default_Open", To_String(Default_Dir)); Open(C_File, In_File, To_String(Filename)); while not End_Of_File(C_File) loop In_String := To_Unbounded_String(Get_Line(C_File)); Insert_at_Cursor (Get_Buffer (CtoADAWindow.C_View), To_String(In_String) & ASCII.CR & ASCII.LF); end loop; Close(C_File); Soort_File ( FileName ); soort := C2ADA(CtoADAWindow.C_View, CtoADAWindow.ADA_View); end if; Hide(File_Dialog); Destroy(File_Dialog); if Final_Filter = All_Files then Default_Ext := 1; elsif Final_Filter = Header then Default_Ext := 2; elsif Final_Filter = C_Body then Default_Ext := 3; elsif Final_Filter = CPP_Body then Default_Ext := 4; else Default_Ext := 1; end if; Set_Value(n_ini, "File", "Type", Default_Ext); end On_Open_C_Activate; > > The documentation is actually not bad, IMO. (But learning GTK is always an > act of masochism. (:-)) > >> I hope that there is documentation or examples >> that are more clear for leople who do want to learn something. > > You could start Gtk_Dialog: > > http://www.adacore.com/wp-content/files/auto_update/gtkada-docs/gtkada_rm/gtkada_rm/gtk-dialog.html > > Gtk_Dialog_Record is the parent of Gtk_File_Chooser_Dialog_Record.. The > testgtk application is contains an example for Gtk_Dialog_Record. You > could > try to replace Gtk_Dialog with Gtk_File_Chooser_Dialog_Record there. > > -- > Regards, > Dmitry A. Kazakov > http://www.dmitry-kazakov.de ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: Documentation or examples wanted for the File_Chooser_Dialog 2009-05-10 14:27 ` ldries46 @ 2009-05-11 10:50 ` Philipp Riegger 2009-05-14 7:34 ` ldries46 0 siblings, 1 reply; 7+ messages in thread From: Philipp Riegger @ 2009-05-11 10:50 UTC (permalink / raw) Hi Bertus, On Sun, 10 May 2009 16:27:41 +0200 "ldries46" <bertus.dries@planet.nl> wrote: > Set_Name(Header, "C/C++ header files"); > Add_Pattern(Header, "*.h"); You can write Header.Set_Name("C/C++ header files"); Header.Add_Pattern("*.h"); here, I think. I personally don't use the "use" statement, so the above modification makes my code much nicer. But that's a philosophical question. > Add_Filter(+File_Dialog, Header); What does the "+" do in this context? Philipp ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: Documentation or examples wanted for the File_Chooser_Dialog 2009-05-11 10:50 ` Philipp Riegger @ 2009-05-14 7:34 ` ldries46 0 siblings, 0 replies; 7+ messages in thread From: ldries46 @ 2009-05-14 7:34 UTC (permalink / raw) In +File_Dialog the + is a function in the File_Chooser_Dialog to get the associated File_Chooser with the File_Dialog of the type File_Chooser_Dialog. I just presented the example of what I did as I found little or no examples where I could see how to create a File_Chooser_Dialog. "Philipp Riegger" <news@anderedomain.de> schreef in bericht news:20090511125026.2d072bf9@troy.s.riegger.name... > Hi Bertus, > > On Sun, 10 May 2009 16:27:41 +0200 > "ldries46" <bertus.dries@planet.nl> wrote: > >> Set_Name(Header, "C/C++ header files"); >> Add_Pattern(Header, "*.h"); > > You can write > > Header.Set_Name("C/C++ header files"); > Header.Add_Pattern("*.h"); > > here, I think. I personally don't use the "use" statement, so the above > modification makes my code much nicer. But that's a philosophical > question. > >> Add_Filter(+File_Dialog, Header); > > What does the "+" do in this context? > > Philipp ^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2009-05-14 7:34 UTC | newest] Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2009-05-08 16:01 Documentation or examples wanted for the File_Chooser_Dialog ldries46 2009-05-08 16:25 ` Dmitry A. Kazakov 2009-05-08 20:43 ` ldries46 2009-05-09 7:00 ` Dmitry A. Kazakov 2009-05-10 14:27 ` ldries46 2009-05-11 10:50 ` Philipp Riegger 2009-05-14 7:34 ` ldries46
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox