[Gtk-sharp-list] Layout of Gtk# Labels, Entry fields, and other widgets

Daniel Morgan danielmorgan@verizon.net
Sat, 11 Dec 2004 03:24:26 -0500


I have updated the Login Screen for Mono SQL Query to have the labels =
for
the data fields moved to the left, but the overall layout still looks =
base.
Any ideas for improvement?

http://img52.exs.cx/my.php?loc=3Dimg52&image=3Dmonosqlquerylogin31do.png

For anyone curious (shameless plug), here is a screenshot of Mono SQL =
Query
showing connection to multiple databases: MySQL, PostgreSQL, and =
Firebird.
The picture only shows these databases, but it can connect to Oracle, =
MySQL,
SQL Lite, Sybase, and ODBC data sources too.

http://img120.exs.cx/my.php?loc=3Dimg120&image=3Dmonosqlquery21li.png

And here is the Novell Forge project for it.

http://forge.novell.com/modules/xfmod/project/admin/?group_id=3D1564


I have the source for the layout of the Login Dialog here:

			dialog =3D new Dialog ();
		=09
			dialog.AllowGrow =3D true;
			dialog.Title =3D "Login";
			dialog.BorderWidth =3D 5;
			dialog.VBox.BorderWidth =3D 5;
			dialog.HasSeparator =3D false;

			Frame frame =3D new Frame ("Connection");
	=09
			Table table =3D new Table (7, 2, false);
			table.ColumnSpacing =3D 5;
			table.RowSpacing =3D 5;
			Label label =3D null;

			label =3D new Label ("_Provider");
			label.Xalign =3D 0.9f;
			table.Attach (label, 0, 1, 0, 1, AttachOptions.Fill,
AttachOptions.Fill, 1, 1);
			providerOptionMenu =3D CreateProviderOptionMenu();
			table.Attach (providerOptionMenu, 1, 8, 0, 1,
AttachOptions.Fill, AttachOptions.Fill, 10, 1);
		=09
			label =3D new Label ("_Connection String");
			label.Xalign =3D 0.9f;
			table.Attach (label, 0, 1, 1, 2, AttachOptions.Fill,
AttachOptions.Fill, 1, 1);
			connection_entry =3D new Entry ();
			connection_entry.Changed +=3D new EventHandler
(OnConnectionEntryChanged);
			table.Attach (connection_entry, 1, 8, 1, 2,
AttachOptions.Fill, AttachOptions.Fill, 10, 1);
		=09
			label =3D new Label ("_Server");
			label.Xalign =3D 0.9f;
			table.Attach (label, 0, 1, 2, 3, AttachOptions.Fill,
AttachOptions.Fill, 1, 1);
			server_entry =3D new Entry ();
			server_entry.Changed +=3D new EventHandler
(OnParameterChanged);
			table.Attach (server_entry, 1, 8, 2, 3,
AttachOptions.Fill, AttachOptions.Fill, 10, 1);

			label =3D new Label ("_Database");
			label.Xalign =3D 0.9f;
			table.Attach (label, 0, 1, 3, 4, AttachOptions.Fill,
AttachOptions.Fill, 1, 1);
			database_entry =3D new Entry ();
			database_entry.Changed +=3D new EventHandler
(OnParameterChanged);
			table.Attach (database_entry, 1, 8, 3, 4,
AttachOptions.Fill, AttachOptions.Fill, 10, 1);

			label =3D new Label ("_User ID");
			label.Xalign =3D 0.9f;
			table.Attach (label, 0, 1, 4, 5, AttachOptions.Fill,
AttachOptions.Fill, 1, 1);
			userid_entry =3D new Entry ();
			userid_entry.Changed +=3D new EventHandler
(OnParameterChanged);
			table.Attach (userid_entry, 1, 8, 4, 5,
AttachOptions.Fill, AttachOptions.Fill, 10, 1);

			label =3D new Label ("_Password");
			label.Xalign =3D 0.9f;
			table.Attach (label, 0, 1, 5, 6, AttachOptions.Fill,
AttachOptions.Fill, 1, 1);
			password_entry =3D new Entry ();
			password_entry.Visibility =3D false;
			password_entry.Changed +=3D new EventHandler
(OnParameterChanged);
			table.Attach (password_entry, 1, 8, 5, 6,
AttachOptions.Fill, AttachOptions.Fill, 10, 1);

			label =3D new Label ("_Other");
			label.Xalign =3D 0.9f;
			table.Attach (label, 0, 1, 6, 7, AttachOptions.Fill,
AttachOptions.Fill, 1, 1);
			other_entry =3D new Entry ();
			other_entry.Changed +=3D new EventHandler
(OnParameterChanged);
			table.Attach (other_entry, 1, 8, 6, 7,
AttachOptions.Fill, AttachOptions.Fill, 10, 1);

			table.Show();
			frame.Add (table);

			dialog.VBox.PackStart (frame, false, false, 5);
		=09
			Frame appSettingFrame =3D new Frame ("App Settings");
			appSettingFrame.Add (grid);
			dialog.VBox.PackStart (appSettingFrame, true, true,
10);

			Button button =3D null;
			button =3D new Button (Stock.Ok);
			button.Clicked +=3D new EventHandler (Connect_Action);
			button.CanDefault =3D true;
			dialog.ActionArea.PackStart (button, true, true, 0);
			button.GrabDefault ();

			button =3D new Button (Stock.Cancel);
			button.Clicked +=3D new EventHandler (Dialog_Cancel);
			dialog.ActionArea.PackStart (button, true, true, 0);
			dialog.Modal =3D true;
			dialog.SetDefaultSize (500, 500);

			statusBar =3D new Statusbar ();
			statusBar.HasResizeGrip =3D false;
			dialog.VBox.PackEnd (statusBar, false, false, 0);

			SetStatusBarText ("Ready!");

			dialog.ShowAll ();