[Gtk-sharp-list] Left-justified text in a label

Daniel Morgan danielmorgan@verizon.net
Mon, 29 Nov 2004 21:57:36 -0500


How do you left-justify text in a Gtk Label?

No matter what I try, nothing seems to work.  It is hell-bent on being
centered.

I have a screenshot of the Dialog.

http://img22.exs.cx/my.php?loc=img22&image=login_screen.png

// sample code
dialog = new Dialog ();
		
dialog.AllowGrow = true;
dialog.Title = "Login";
dialog.BorderWidth = 3;
dialog.VBox.BorderWidth = 5;
dialog.HasSeparator = false;

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

label = new Label ("_Provider");
label.Layout.Alignment = Pango.Alignment.Left;
table.Attach (label, 0, 1, 0, 1);
providerOptionMenu = CreateProviderOptionMenu();
table.Attach (providerOptionMenu, 1, 5, 0, 1);
			
label = new Label ("_Connection String");
label.Layout.Alignment = Pango.Alignment.Left;
table.Attach (label, 0, 1, 1, 2);
connection_entry = new Entry ();
connection_entry.Changed += new EventHandler (OnConnectionEntryChanged);
table.Attach (connection_entry, 1, 5, 1, 2);

label = new Label ("_Server");
label.Layout.Alignment = Pango.Alignment.Left;
table.Attach (label, 0, 1, 2, 3);
server_entry = new Entry ();
server_entry.Changed += new EventHandler (OnParameterChanged);
table.Attach (server_entry, 1, 5, 2, 3);

// [...]			

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

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

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

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

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

SetStatusBarText ("Ready!");

dialog.ShowAll ();