[Mono-list] modal FileChooserDialog from FileChooserButton

dafnis dafnis at ono.com
Sun May 21 19:10:10 EDT 2006


Thanks Brian for your advice. It's not easy to find info about 'Form' at 
gnome.documentation an at Mono docs, but I will keep trying. I will also 
try to learn something about the patches applied by Eric Butler, 
providing access to the CurrentFolder and CurrentFolderUri properties of 
a FileChooserButton.

Dafnis

Brian Pickles wrote:
> Dafnis
> 
> Try Form.Show or Form.Run rather than Form.ShowDialog
> 
> Brian
> 
> On 5/18/06, *dafnis* <dafnis at ono.com <mailto:dafnis at ono.com> > wrote:
> 
>     Hi all,
> 
>     I started learning some C# just two weeks ago and this is the first
>     issue I can't solve reading the documentation, lists, etc.
> 
>     I want the Dialog that pops when you select "Other..." from a
>     FileChooserButton to be modal.
>     I've tried the following:
> 
> 
>     FileChooserDialog dialog= new FileChooserDialog(
>                     "Choose Output Directory",
>                             window,
>                             FileChooserAction.SelectFolder,
>                             Stock.Cancel,
>                             ResponseType.Cancel ,
>                             Stock.Open,
>                             ResponseType.Ok,
>                             null);
> 
>     dialog.Modal = true;
>     dialog.DestroyWithParent = false;
>     fcdOut.SelectMultiple = false;
>     FileChooserButton button = new FileChooserButton(dialog);
> 
> 
>     but the Dialog is not modal, it stays on top but I still can interact
>     with the main window.
>     If I use this constructor:
> 
> 
>     FileChooserButton button = new FileChooserButton("Choose Output
>     Directory",
>                                                                     FileChooserAction.SelectFolder);
> 
> 
>     the Dialog is not modal, and I have no clue of how to access the
>     properties of the underlying FileChooserDialog when using this last
>     constructor.
> 
>     If I use a FileChooserDialog linked to a 'normal' Button instead of a
>     FileChooserButton the Dialog is modal as expected:
> 
> 
>     Button bt = new Button("Add Files");
>     bt.Clicked += new EventHandler(bt_Clicked);
> 
>     //...
> 
>     static void bt_Clicked(object sender, EventArgs e)
>     {
>             FileChooserDialog fcd = new FileChooserDialog(
>                     "Choose some files or directories to process",
>                     window,
>                     FileChooserAction.Open,
>                     Stock.Cancel,
>                     ResponseType.Cancel,
>                     Stock.Open,
>                     ResponseType.Ok,
>                     null);
> 
>              fcd.SelectMultiple = true;
>             fcd.DestroyWithParent = true;
>             fcd.Modal = true;
> 
>             if((ResponseType)fcd.Run() == ResponseType.Ok) {
>                     foreach(string x in fcd.Filenames) {
>                              someListStore.AppendValues(x);
>                     }
>             }
>             fcd.Destroy();
>     }
> 
> 
>     I know it would be easier to use the above code to select a directory,
>     but I prefer to learn new things.
> 
> 
>     Dafnis
>     _______________________________________________
>     Mono-list maillist  -  Mono-list at lists.ximian.com
>     <mailto:Mono-list at lists.ximian.com>
>     http://lists.ximian.com/mailman/listinfo/mono-list
> 
> 
> 
> 
> -- 
> Brian Pickles



More information about the Mono-list mailing list