Brad Taylor wrote:
> 
> 
> Check out Gtk.Assistant instead -- it's the new, Gtk approved wizard
> API.  Gnome Druid has been a depreciated API for a while now.
> 
> 

Great suggestion...  I pasted in this 
http://www.mail-archive.com/mono-patc...@lists.ximian.com/msg46474.html code
sample for the Gtk.Assistant  which worked great and looked awesome.  



So I tried to write my own sample.  However mine fails with the comment in
the Application Output window:

   Gtk-CRITICAL **: gtk_assistant_set_page_complete: assertion
`GTK_IS_ASSISTANT (assistant)' failed

It happens when I try to use an event handler to call the SetPageComplete()
method.   I cant find anything like that on Google anywhere.  What exactly
is that, and what am I missing?



namespace GtkSharpSamples {

   using System;
   using Gtk;

    public static class MainClass {
                
        public static int Main (string[] argv) {
               Application.Init ();
               new MainWindow().Show();
               Application.Run ();
               return 0;
        }
                
    }
        
        //  This is the basic MainWindow you get when creating a GTK Project
        public partial class MainWindow: Gtk.Window     {       
                
                public MainWindow (): base (Gtk.WindowType.Toplevel)
                {
                        Build ();
                        new MyLittleAssistantTest().ShowAll();    //  I added 
this command to
load the Assistant
                        
                }
                
                protected void OnDeleteEvent (object sender, DeleteEventArgs a)
                {
                        Application.Quit ();
                        a.RetVal = true;
                }
        }
        


        public class MyLittleAssistantTest : Gtk.Assistant      {               
                
                
                public MyLittleAssistantTest()          {
                        SetSizeRequest( 200, 200 );
                        Title = "My Little Assistant Test";
                        Modal = true;


                        {  // Set up the intro page....
                                Label lbl = new Label(" Welcome Everyone. " );
                                AppendPage( lbl );
                                SetPageType ( lbl , AssistantPageType.Intro );
                                SetPageComplete( lbl, true );
                        }


                        {  //  Set up the second page.
                                Gtk.Button tBtn = new Gtk.Button( "Click Me" );
                                tBtn.Clicked += new 
EventHandler(ButtonClicked);                
                                
                                HBox tbox = new HBox (false, 6);
                                tbox.PackStart ( tBtn, false, false, 6);
                                                                
                                Gtk.Alignment tAlign = new Gtk.Alignment (0.5f, 
0.5f, 0.0f, 0.0f);
                                tAlign.Name = "RememberMe";
                                tAlign.Add( tbox );
                                
                                AppendPage( tAlign );
                                SetPageType( tAlign , AssistantPageType.Content 
);
                        }

                        {  //  Set up the second page.
                                Gtk.Button tBtn = new Gtk.Button();
                                tBtn.Label = "We're All Done ";
                                
                                AppendPage( tBtn );
                                SetPageType( tBtn , AssistantPageType.Summary );
                                SetPageComplete( tBtn, true );
                        }

                        Close += HandleClose;
                        Cancel += HandleClose;
                        
                }

                void ButtonClicked (object sender, EventArgs args) {
                        Alignment tAlign = ( (sender as Widget).Parent.Parent 
as Alignment );
                        if ( tAlign.Name == "RememberMe" ) {
                                SetPageComplete( tAlign as Widget , true );     
// IT FAILS HERE  
                        }
             }
                
                void HandleClose(object sender, EventArgs e) {
                        Destroy();                      
                }

                protected override bool OnDeleteEvent (Gdk.Event evnt) {
                        bool rtnVal = base.OnDeleteEvent (evnt);
                        Destroy();
                        return rtnVal;          
                }
        }
}


-- 
View this message in context: 
http://www.nabble.com/Wizard-tp22957928p23362570.html
Sent from the Mono - Gtk# mailing list archive at Nabble.com.
_______________________________________________
Gtk-sharp-list maillist  -  Gtk-sharp-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/gtk-sharp-list

Reply via email to