[Mono-list] No VBox content in Dialog

Frank Hrebabetzky hreba at terra.com.br
Mon Jun 30 21:47:17 EDT 2008


Hi everybody,

The method below should pop up a Dialog for user input, convert it to a 
number and return that number. The problem is that the VBox part of the 
Dialog is always empty. Any hint?


   public static ushort AskItemNumber (string wintitle, string itemname,
     out bool valid)
   // Open a modal dialog and ask for the number of 'itemname' items.
   // Return this, or 0 if the user input is invalid.
   {
     Label	lab;
     Entry	entry;
     HBox	hbox;
     Dialog	dialog;
     ushort	n;

     lab	= new Label ("Number of " + itemname + "?");
     entry = new Entry (3);
     hbox = new HBox (false, 6);
     hbox.PackStart (lab);
     hbox.PackStart (entry);

     dialog = new Dialog (wintitle, null, DialogFlags.Modal);
     dialog.VBox.PackStart (lab);
     dialog.AddButton ("o.k.", ResponseType.Ok);
     dialog.Run();

     valid = true;  n=0;//s.c.
     try { n = Convert.ToUInt16(entry.Text);}
     catch { valid = false; }
     dialog.Destroy();
     if (valid) return n; else return 0;
   } // AskItemNumber

-- 
Frank Hrebabetzky		+55 / 48 / 3235 1106
Florianopolis, Brazil


More information about the Mono-list mailing list