本文整理汇总了C#中Gtk.ComboBox.AppendText方法的典型用法代码示例。如果您正苦于以下问题:C# ComboBox.AppendText方法的具体用法?C# ComboBox.AppendText怎么用?C# ComboBox.AppendText使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Gtk.ComboBox
的用法示例。
在下文中一共展示了ComboBox.AppendText方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ComboAccrualYearsFill
public static void ComboAccrualYearsFill(ComboBox combo, params string[] firstItems)
{
try {
logger.Info ("Запрос лет для начислений...");
TreeIter iter;
string sql = "SELECT DISTINCT year FROM accrual ORDER BY year DESC";
MySqlCommand cmd = new MySqlCommand (sql, QSMain.connectionDB);
MySqlDataReader rdr = cmd.ExecuteReader ();
((ListStore)combo.Model).Clear ();
foreach(var item in firstItems)
{
combo.AppendText (item);
}
combo.AppendText (Convert.ToString (DateTime.Now.AddYears (1).Year));
combo.AppendText (Convert.ToString (DateTime.Now.Year));
while (rdr.Read ()) {
if (rdr.GetUInt32 ("year") == DateTime.Now.Year || rdr.GetUInt32 ("year") == DateTime.Now.AddYears (1).Year)
continue;
combo.AppendText (rdr ["year"].ToString ());
}
rdr.Close ();
((ListStore)combo.Model).SetSortColumnId (0, SortType.Descending);
ListStoreWorks.SearchListStore ((ListStore)combo.Model, Convert.ToString (DateTime.Now.Year), out iter);
combo.SetActiveIter (iter);
logger.Info ("Ok");
} catch (Exception ex) {
logger.Warn (ex, "Ошибка получения списка лет!");
}
}
示例2: GroupsChanged
void GroupsChanged ()
{
if (combo != null) {
combo.Changed -= combo_Changed;
Remove (combo);
}
combo = Gtk.ComboBox.NewText ();
combo.Changed += combo_Changed;
#if GTK_SHARP_2_6
combo.RowSeparatorFunc = RowSeparatorFunc;
#endif
combo.Show ();
PackStart (combo, true, true, 0);
values = new ArrayList ();
int i = 0;
foreach (string name in manager.GroupNames) {
values.Add (name);
combo.AppendText (name);
if (name == group)
combo.Active = i;
i++;
}
#if GTK_SHARP_2_6
combo.AppendText ("");
#endif
combo.AppendText (Catalog.GetString ("Rename Group..."));
combo.AppendText (Catalog.GetString ("New Group..."));
}
示例3: FormDatabasePreferences
public FormDatabasePreferences() : base(7, 3, false)
{
typeLabel = new Gtk.Label("Type :");
serverLabel = new Gtk.Label("Server :");
portLabel = new Gtk.Label("Port :");
userLabel = new Gtk.Label("Username :");
passLabel = new Gtk.Label("Password :");
dbLabel = new Gtk.Label("Database :");
mediaLabel = new Gtk.Label("Medias path :");
typeCombo = ComboBox.NewText();
serverEntry = new Entry();
portSpinButton = new SpinButton(0f,65536f,1f);
userEntry = new Entry();
passEntry = new Entry();
dbEntry = new Entry();
passCheck = new CheckButton("Save password");
dbButton= new Button(Stock.Open);
mediaButton= new FileChooserButton("Choose the media directory", FileChooserAction.SelectFolder);
typeLabel.SetAlignment(0, (float)0.5);
serverLabel.SetAlignment(0, (float)0.5);
portLabel.SetAlignment(0, (float)0.5);
userLabel.SetAlignment(0, (float)0.5);
passLabel.SetAlignment(0, (float)0.5);
dbLabel.SetAlignment(0, (float)0.5);
mediaLabel.SetAlignment(0, (float)0.5);
typeCombo.AppendText("SQLite");
typeCombo.AppendText("PostgreSQL");
typeCombo.Changed += OnTypeComboChanged;
passEntry.Visibility = false;
dbButton.Clicked += OnDbButton;
this.Attach(typeLabel, 0, 1, 0, 1);
this.Attach(serverLabel, 0, 1, 1, 2);
this.Attach(portLabel, 0, 1, 2, 3);
this.Attach(userLabel, 0, 1, 3, 4);
this.Attach(passLabel, 0, 1, 4, 5);
this.Attach(dbLabel, 0, 1, 5, 6);
this.Attach(mediaLabel, 0, 1, 6, 7);
this.Attach(typeCombo, 1, 3, 0, 1);
this.Attach(serverEntry, 1, 3, 1, 2);
this.Attach(portSpinButton, 1, 3, 2, 3);
this.Attach(userEntry, 1, 3, 3, 4);
this.Attach(passEntry, 1, 2, 4, 5);
this.Attach(dbEntry, 1, 2, 5, 6);
this.Attach(passCheck, 2, 3, 4, 5);
this.Attach(dbButton, 2, 3, 5, 6);
this.Attach(mediaButton, 1, 3, 6, 7);
}
示例4: TasksPanelWidget
public TasksPanelWidget ()
{
Build ();
comboPriority = ComboBox.NewText ();
foreach (TaskPriority priority in Enum.GetValues (typeof (TaskPriority)))
comboPriority.AppendText (Enum.GetName (typeof (TaskPriority), priority));
comboPriority.Changed += new EventHandler (Validate);
comboPriority.Show ();
vboxPriority.PackEnd (comboPriority, false, false, 0);
tokensStore = new ListStore (typeof (string), typeof (int));
tokensTreeView.AppendColumn (String.Empty, new CellRendererText (), "text", 0);
tokensTreeView.Selection.Changed += new EventHandler (OnTokenSelectionChanged);
tokensTreeView.Model = tokensStore;
OnTokenSelectionChanged (null, null);
buttonAdd.Clicked += new EventHandler (AddToken);
buttonChange.Clicked += new EventHandler (ChangeToken);
buttonRemove.Clicked += new EventHandler (RemoveToken);
entryToken.Changed += new EventHandler (Validate);
Styles.Changed += HandleUserInterfaceSkinChanged;
}
示例5: ComboPlaceNoFill
public static void ComboPlaceNoFill(ComboBox combo, int Type_id)
{
//Заполняем комбобокс Номерами мест
try {
logger.Info ("Запрос номеров мест...");
int count = 0;
string sql = "SELECT place_no FROM places " +
"WHERE type_id = @type_id";
MySqlCommand cmd = new MySqlCommand (sql, QSMain.connectionDB);
cmd.Parameters.AddWithValue ("@type_id", Type_id);
MySqlDataReader rdr = cmd.ExecuteReader ();
while (rdr.Read ()) {
combo.AppendText (rdr ["place_no"].ToString ());
count++;
}
rdr.Close ();
if (count == 1)
combo.Active = 0;
logger.Info ("Ok");
} catch (Exception ex) {
logger.Error (ex, "Ошибка получения номеров мест!");
}
}
示例6: QueryLimitBox
public QueryLimitBox (QueryOrder [] orders, QueryLimit [] limits) : base ()
{
this.orders = orders;
this.limits = limits;
Spacing = 5;
enabled_checkbox = new CheckButton (Catalog.GetString ("_Limit to"));
enabled_checkbox.Toggled += OnEnabledToggled;
count_spin = new SpinButton (0, Double.MaxValue, 1);
count_spin.Numeric = true;
count_spin.Digits = 0;
count_spin.Value = 25;
count_spin.SetSizeRequest (60, -1);
limit_combo = ComboBox.NewText ();
foreach (QueryLimit limit in limits) {
limit_combo.AppendText (limit.Label);
}
order_combo = ComboBox.NewText ();
order_combo.RowSeparatorFunc = IsRowSeparator;
foreach (QueryOrder order in orders) {
if (order == null) {
order_combo.AppendText (String.Empty);
} else {
order_combo.AppendText (order.Label);
}
}
PackStart (enabled_checkbox, false, false, 0);
PackStart (count_spin, false, false, 0);
PackStart (limit_combo, false, false, 0);
PackStart (new Label (Catalog.GetString ("selected by")), false, false, 0);
PackStart (order_combo, false, false, 0);
enabled_checkbox.Active = false;
limit_combo.Active = 0;
order_combo.Active = 0;
OnEnabledToggled (null, null);
ShowAll ();
}
示例7: WidgetBuilderOptionPanelWidget
public WidgetBuilderOptionPanelWidget (Project project) : base (false, 6)
{
this.project = project as DotNetProject;
Gtk.HBox box = new Gtk.HBox (false, 3);
Gtk.Label lbl = new Gtk.Label (GettextCatalog.GetString ("Target Gtk# version:"));
box.PackStart (lbl, false, false, 0);
comboVersions = ComboBox.NewText ();
ReferenceManager refmgr = new ReferenceManager (project as DotNetProject);
foreach (string v in refmgr.SupportedGtkVersions)
comboVersions.AppendText (v);
comboVersions.Active = refmgr.SupportedGtkVersions.IndexOf (refmgr.GtkPackageVersion);
refmgr.Dispose ();
box.PackStart (comboVersions, false, false, 0);
box.ShowAll ();
PackStart (box, false, false, 0);
HSeparator sep = new HSeparator ();
sep.Show ();
PackStart (sep, false, false, 0);
if (!GtkDesignInfo.HasDesignedObjects (project))
return;
GtkDesignInfo designInfo = GtkDesignInfo.FromProject (project);
checkGettext = new CheckButton (GettextCatalog.GetString ("Enable gettext support"));
checkGettext.Active = designInfo.GenerateGettext;
checkGettext.Show ();
PackStart (checkGettext, false, false, 0);
box = new Gtk.HBox (false, 3);
box.PackStart (new Label (GettextCatalog.GetString ("Gettext class:")), false, false, 0);
entryGettext = new Gtk.Entry ();
entryGettext.Text = designInfo.GettextClass;
entryGettext.Sensitive = checkGettext.Active;
box.PackStart (entryGettext, false, false, 0);
box.ShowAll ();
PackStart (box, false, false, 0);
sep= new HSeparator ();
sep.Show ();
PackStart (sep, false, false, 0);
box = new Gtk.HBox (false, 3);
box.PackStart (new Label (GettextCatalog.GetString ("Stetic folder name :")), false, false, 0);
entryFolderName = new Gtk.Entry ();
entryFolderName.Text = designInfo.SteticFolderName;
entryFolderName.Sensitive = false;
box.PackStart (entryFolderName, false, false, 0);
box.ShowAll ();
PackStart (box, false, false, 0);
checkHideFiles = new CheckButton (GettextCatalog.GetString ("Hide designer files"));
checkHideFiles.Active = designInfo.HideGtkxFiles;
checkHideFiles.Show ();
PackStart (checkHideFiles, false, false, 0);
}
示例8: FileSizeQueryValueEntry
// Relative: [<|>] [num] [minutes|hours] ago
// TODO: Absolute: [>|>=|=|<|<=] [date/time]
public FileSizeQueryValueEntry () : base ()
{
spin_button = new SpinButton (0.0, 1.0, 1.0);
spin_button.Digits = 1;
spin_button.WidthChars = 4;
spin_button.SetRange (0.0, Double.MaxValue);
Add (spin_button);
combo = ComboBox.NewText ();
combo.AppendText (Catalog.GetString ("bytes"));
combo.AppendText (Catalog.GetString ("KB"));
combo.AppendText (Catalog.GetString ("MB"));
combo.AppendText (Catalog.GetString ("GB"));
combo.Realized += delegate { if (!combo_set) { combo.Active = 2; } };
Add (combo);
spin_button.ValueChanged += HandleValueChanged;
combo.Changed += HandleValueChanged;
}
示例9: WidgetBuilderOptionPanelWidget
public WidgetBuilderOptionPanelWidget (Project project) : base (false, 6)
{
this.project = project as DotNetProject;
Gtk.HBox box = new Gtk.HBox (false, 3);
Gtk.Label lbl = new Gtk.Label (GettextCatalog.GetString ("Target Gtk# version:"));
box.PackStart (lbl, false, false, 0);
comboVersions = ComboBox.NewText ();
ReferenceManager refmgr = new ReferenceManager (project as DotNetProject);
foreach (string v in refmgr.SupportedGtkVersions)
comboVersions.AppendText (v);
comboVersions.Active = refmgr.SupportedGtkVersions.IndexOf (refmgr.GtkPackageVersion);
refmgr.Dispose ();
box.PackStart (comboVersions, false, false, 0);
box.ShowAll ();
PackStart (box, false, false, 0);
HSeparator sep = new HSeparator ();
sep.Show ();
PackStart (sep, false, false, 0);
if (!GtkDesignInfo.HasDesignedObjects (project))
return;
GtkDesignInfo designInfo = GtkDesignInfo.FromProject (project);
checkGettext = new CheckButton (GettextCatalog.GetString ("Enable gettext support"));
checkGettext.Active = designInfo.GenerateGettext;
checkGettext.Show ();
PackStart (checkGettext, false, false, 0);
box = new Gtk.HBox (false, 3);
box.PackStart (new Label (GettextCatalog.GetString ("Gettext class:")), false, false, 0);
entryGettext = new Gtk.Entry ();
entryGettext.Text = designInfo.GettextClass;
entryGettext.Sensitive = checkGettext.Active;
box.PackStart (entryGettext, false, false, 0);
box.ShowAll ();
PackStart (box, false, false, 0);
box = new Gtk.HBox (false, 3);
box.PackStart (new Label (GettextCatalog.GetString ("Resource loader class:")), false, false, 0);
entryResourceLoader = new Gtk.Entry ();
entryResourceLoader.Text = designInfo.ImageResourceLoaderClass;
entryResourceLoader.Sensitive = checkGettext.Active;
box.PackStart (entryResourceLoader, false, false, 0);
box.ShowAll ();
PackStart (box, false, false, 0);
checkGettext.Clicked += delegate {
box.Sensitive = checkGettext.Active;
if (checkGettext.Active)
entryGettext.Text = "Mono.Unix.Catalog";
};
}
示例10: AppendColumns
public static void AppendColumns(TreeView treeView, IDataReader dataReader)
{
tv = treeView;
for (int index = 0; index < dataReader.FieldCount; index++)
{
Console.WriteLine("el indice es: {0}", index);
treeView.AppendColumn (dataReader.GetName (index), new CellRendererText(), "text", index);
}
//Gtk.EditedArgs args = new Gtk.EditedArgs();
Gtk.ListStore treeModel = new ListStore(typeof(string));
treeView.Model = treeModel;
// Values to be chosen in the ComboBox
Gtk.ListStore comboModel = new ListStore(typeof(string));
Gtk.ComboBox comboBox = new ComboBox(comboModel);
comboBox.AppendText("Selecciona una cantidad");
comboBox.AppendText("1");
comboBox.AppendText("2");
comboBox.AppendText("3");
comboBox.Active = 0;
Gtk.TreeViewColumn comboCol = new TreeViewColumn();
Gtk.CellRendererCombo comboCell = new CellRendererCombo();
comboCol.Title = "Combo Column";
comboCol.PackStart(comboCell, true);
comboCol.AddAttribute(comboCell, "text", 4);
comboCell.Editable = true;
comboCell.Edited += OnEdited;
comboCell.TextColumn = 0;
comboCell.Text = comboBox.ActiveText;
comboCell.Model = comboModel;
comboCell.WidthChars = 20;
treeView.AppendColumn(comboCol);
}
示例11: GtkFeatureWidget
public GtkFeatureWidget (DotNetProject project)
{
Spacing = 6;
versionCombo = Gtk.ComboBox.NewText ();
ReferenceManager refmgr = new ReferenceManager (project);
foreach (string v in refmgr.SupportedGtkVersions)
versionCombo.AppendText (v);
versionCombo.Active = 0;
refmgr.Dispose ();
// GTK# version selector
HBox box = new HBox (false, 6);
Gtk.Label vlab = new Label (GettextCatalog.GetString ("Target GTK# version:"));
box.PackStart (vlab, false, false, 0);
box.PackStart (versionCombo, false, false, 0);
box.PackStart (new Label (GettextCatalog.GetString ("(or upper)")), false, false, 0);
PackStart (box, false, false, 0);
ShowAll ();
}
示例12: SmartPlaylistQueryValueEntry
public SmartPlaylistQueryValueEntry () : base ()
{
combo = ComboBox.NewText();
combo.WidthRequest = DefaultWidth;
int count = 0;
SmartPlaylistSource playlist;
foreach (Source child in ServiceManager.SourceManager.DefaultSource.Children) {
playlist = child as SmartPlaylistSource;
if (playlist != null && playlist.DbId != null) {
if (Editor.CurrentlyEditing == null || (Editor.CurrentlyEditing != playlist && !playlist.DependsOn (Editor.CurrentlyEditing))) {
combo.AppendText (playlist.Name);
playlist_id_combo_map [(int)playlist.DbId] = count;
combo_playlist_id_map [count++] = (int) playlist.DbId;
}
}
}
Add (combo);
combo.Active = 0;
combo.Changed += HandleValueChanged;
}
示例13: TimeSpanQueryValueEntry
public TimeSpanQueryValueEntry () : base ()
{
spin_button = new SpinButton (0.0, 1.0, 1.0);
spin_button.Digits = 1;
spin_button.WidthChars = 4;
spin_button.SetRange (0.0, Double.MaxValue);
Add (spin_button);
combo = ComboBox.NewText ();
combo.AppendText (Catalog.GetString ("seconds"));
combo.AppendText (Catalog.GetString ("minutes"));
combo.AppendText (Catalog.GetString ("hours"));
combo.AppendText (Catalog.GetString ("days"));
combo.AppendText (Catalog.GetString ("weeks"));
combo.AppendText (Catalog.GetString ("months"));
combo.AppendText (Catalog.GetString ("years"));
combo.Realized += delegate { combo.Active = set_combo; };
Add (combo);
spin_button.ValueChanged += HandleValueChanged;
combo.Changed += HandleValueChanged;
}
示例14: InitializeComponent
/// <summary>
/// Replaces Windows Form Designer code
/// </summary>
private void InitializeComponent()
{
SetSizeRequest(192, 240); // Define MenuForm size
//
// Define an 8x6 table on which to lay out the test buttons, etc
//
Gtk.Table layout = new Gtk.Table(8, 6, true);
layout.BorderWidth = 8;
layout.ColumnSpacing = 2;
layout.RowSpacing = 2;
Add(layout);
// Create menu components, then add to layout
//
// DemosLabel
//
demosLabel = new Gtk.Label("Demos");
layout.Attach(demosLabel, 0, 2, 0, 1);
//
// plotSurface2DDemoButton
//
plotSurface2DDemoButton = new Gtk.Button("PlotSurface2D Demo");
plotSurface2DDemoButton.Clicked += new System.EventHandler(this.plotSurface2DDemoButton_Click);
layout.Attach(plotSurface2DDemoButton, 0, 6, 1, 2);
//
// multiPlotDemoButton
//
multiPlotDemoButton = new Gtk.Button("Multi Plot Demo");
multiPlotDemoButton.Clicked += new System.EventHandler(this.runDemoButton_Click);
layout.Attach(multiPlotDemoButton, 0, 6, 2, 3);
//
// testsLabel
//
testsLabel = new Gtk.Label("Tests");
layout.Attach(testsLabel, 0, 2, 3, 4);
//
// TestSelectComboBox
//
//
TestSelectComboBox = ComboBox.NewText();
TestSelectComboBox.AppendText("Axis Test");
TestSelectComboBox.AppendText("PlotSurface2D");
layout.Attach(TestSelectComboBox, 0, 6, 4, 5);
//
// RunTestButton
//
RunTestButton = new Gtk.Button("Run Selected Test");
RunTestButton.Clicked += new System.EventHandler(this.RunTestButton_Click);
layout.Attach(RunTestButton, 0, 6, 5, 6);
//
// quitButton
//
quitButton = new Gtk.Button("Quit");
quitButton.Clicked += new System.EventHandler(this.quitButton_Click);
layout.Attach(quitButton, 2, 4, 7, 8, 0, 0, 0, 0);
//
// Gtk.Window events
//
this.Destroyed += new EventHandler(MenuForm_Destroyed);
}
示例15: CreateDomainSelectionPage
private modelKeyPage CreateDomainSelectionPage()
{
DomainSelectionPage = new modelKeyPage(Util.GS("Select account"),KeyRecoveryPixbuf,null);
DomainSelectionPage.CancelClicked += new Gnome.CancelClickedHandler(OnCancelClicked);
DomainSelectionPage.Prepared += new Gnome.PreparedHandler(OnDomainSelectionPagePrepared);
DomainSelectionPage.ValidateClicked += new KRValidateClickedHandler(OnDomainSelectionPageValidated);
Table table = new Table(4, 3, false);
DomainSelectionPage.VBox.PackStart(table,false,false, 0);
table.ColumnSpacing = 6;
table.RowSpacing = 6;
table.BorderWidth = 12;
Label l1 = new Label(Util.GS("Select the account for which the passphrase must to be reset."));
table.Attach(l1, 0,1, 0,1,
AttachOptions.Fill | AttachOptions.Expand, 0,0,0);
l1.LineWrap = true;
l1.Xalign = 0.0F;
Label l2 = new Label(Util.GS("_iFolder Account")+":");
table.Attach(l2, 0,1,5,6,
AttachOptions.Fill | AttachOptions.Expand, 0,0,0);
l2.LineWrap = true;
l2.Xalign = 0.0F;
domainComboBox = ComboBox.NewText();
DomainController domainController = DomainController.GetDomainController();
domains= domainController.GetLoggedInDomains();
string defaultDomainID = simws.GetDefaultDomainID();
int defaultDomain = 0 ;
for (int x = 0; x < domains.Length; x++)
{
domainComboBox.AppendText(domains[x].Name+"-"+domains[x].Host);
if(defaultDomainID != null && defaultDomainID == domains[x].ID)
defaultDomain = x;
}
if( domains.Length > 0)
domainComboBox.Active = defaultDomain;
table.Attach(domainComboBox, 1,2,5,6, AttachOptions.Fill, 0,0,0);
l2.MnemonicWidget = domainComboBox;
Label l3 = new Label(Util.GS("Click Forward to proceed."));
table.Attach(l3, 0, 1, 7, 8,
AttachOptions.Fill | AttachOptions.Expand, 0, 0, 0);
l3.LineWrap = true;
l3.Xalign = 0.0F;
return DomainSelectionPage;
}