プログラムが読み込まれると、コンボボックスにデフォルト値がありません。プログラムがロードされたときに最初の値をデフォルト値にしたい。どうやってやるの?
using Gtk;
using System;
class SharpApp : Window
{
Label label;
Label label2;
Label label3;
Label label4;
public SharpApp() : base(" VALUTASOFFAN")
{
SetDefaultSize(411, 199);
SetPosition(WindowPosition.Center);
SetIconFromFile("..\\..\\web.png");
DeleteEvent += new DeleteEventHandler(OnDelete);
string[] valutor = new string[]
{
"YEN",
"SEK",
"EURO"
};
//BOX1
Fixed fix = new Fixed();
ComboBox cb = new ComboBox(valutor);
ComboBox cb2 = new ComboBox(valutor);
Entry entry = new Entry ();
Entry entry2 = new Entry ();
cb.Changed += OnChanged;
cb2.Changed += OnChanged2;
entry.Changed += onChanged3;
entry2.Changed += onChanged4;
ComboBox combo = ComboBox.NewText();
combo.Active = 0
cb.Active = 0;
label = new Label("-");
label2 = new Label("-");
label3 = new Label("-");
label4 = new Label("-");
fix.Put(entry, 100, 30);
fix.Put(entry2, 100, 100);
fix.Put(cb, 300, 30);
fix.Put(cb2, 300, 100);
//fix.Put(label3, 10, 30);
//fix.Put(label4, 10, 100);
Add(fix);
ShowAll();
}
void OnChanged(object sender, EventArgs args)
{
ComboBox cb = (ComboBox) sender;
label.Text = cb.ActiveText;
}
void OnChanged2(object sender2, EventArgs args)
{
ComboBox cb2 = (ComboBox) sender2;
label2.Text = cb2.ActiveText;
}
void onChanged3(object sender3, EventArgs args)
{
Entry entry = (Entry)sender3;
label3.Text = entry.Text;
}
void onChanged4(object sender4, EventArgs args)
{
Entry entry2 = (Entry)sender4;
label4.Text = entry2.Text;
}
public static void Main()
{
Application.Init();
new SharpApp();
Application.Run();
}
void OnDelete(object obj, DeleteEventArgs args)
{
Application.Quit();
}
}