本文整理汇总了C#中Gtk.ComboBox.GetActiveIter方法的典型用法代码示例。如果您正苦于以下问题:C# ComboBox.GetActiveIter方法的具体用法?C# ComboBox.GetActiveIter怎么用?C# ComboBox.GetActiveIter使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Gtk.ComboBox
的用法示例。
在下文中一共展示了ComboBox.GetActiveIter方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetId
public static object GetId(ComboBox comboBox)
{
TreeIter treeIter;
comboBox.GetActiveIter (out treeIter);
IList row = (IList)comboBox.Model.GetValue (treeIter, 0);
return row [0];
}
示例2: GetId
public static object GetId(ComboBox comboBox)
{
TreeIter treeIter;
comboBox.GetActiveIter (out treeIter);
IList row = (IList)comboBox.Model.GetValue (treeIter, 0); //ILIST 0 por que es el unico elemento aunque dentro vallan las columnas
return row [0];
}
示例3: GetActiveString
public static string GetActiveString(ComboBox box)
{
TreeIter iter;
if(!box.GetActiveIter(out iter))
return null;
return (string)box.Model.GetValue(iter, 0);
}
示例4: GetActiveText
public static string GetActiveText(ComboBox cbox)
{
if (cbox.Active < 0)
return "";
TreeIter iter;
cbox.GetActiveIter (out iter);
string cvalue = ((ListStore) cbox.Model).GetValue (iter, 0).ToString();
return cvalue;
}
示例5: ComboBoxHelper
public ComboBoxHelper(ComboBox comboBox, IDbConnection dbConnection, string keyFieldName,
string valueFieldName,string tableName,int initialId)
{
this.comboBox = comboBox;
//this.initalId = initialId;
CellRendererText cellRenderText1 = new CellRendererText();
comboBox.PackStart(cellRenderText1,false);
comboBox.AddAttribute(cellRenderText1,"text",0);//el ultimo parametro el 0 sirve para elegir la columna a visualizar
CellRendererText cellRenderText = new CellRendererText();
comboBox.PackStart(cellRenderText,false);
comboBox.AddAttribute(cellRenderText,"text",1);//el ultimo parametro el 1 sirve para elegir la columna a visualizar
listStore = new ListStore(typeof(int),typeof(string));
TreeIter initialTreeIter;/* = listStore.AppendValues(0, "Sin asignar");*/
IDbCommand dbCommand = dbConnection.CreateCommand();
dbCommand.CommandText = string.Format(selectFormat, keyFieldName,valueFieldName,tableName);
IDataReader dataReader = dbCommand.ExecuteReader();
//Recorre el dataReader para insertar los valores en el comboBox
while(dataReader.Read())
{
int id =(int) dataReader["id"];
string nombre = (string)dataReader["nombre"];
treeIter = listStore.AppendValues(id,nombre);
if (id == initialId)
initialTreeIter = treeIter;
}
dataReader.Close();
comboBox.Model = listStore;
comboBox.SetActiveIter(initialTreeIter);
comboBox.Changed += delegate {
TreeIter treeIter;
comboBox.GetActiveIter(out treeIter);
int id = (int) listStore.GetValue(treeIter,0);
Console.WriteLine("ID = "+ id);
};
}
示例6: GetActiveVar
string GetActiveVar (ComboBox combo)
{
Gtk.TreeIter iter;
if (!combo.GetActiveIter (out iter))
return string.Empty;
string var = (string) combo.Model.GetValue (iter, 0);
if (String.Compare (var, "(None)") == 0)
return String.Empty;
else
return var.Trim ();
}
示例7: MainToolbar
//.........这里部分代码省略.........
var runtimeComboVBox = new VBox ();
runtimeComboVBox.PackStart (runtimeCombo, true, false, 0);
configurationCombosBox.PackStart (runtimeComboVBox, false, false, 0);
AddWidget (configurationCombosBox);
buttonBarBox = new Alignment (0.5f, 0.5f, 0, 0);
buttonBarBox.LeftPadding = (uint) 7;
buttonBarBox.Add (buttonBar);
buttonBarBox.NoShowAll = true;
AddWidget (buttonBarBox);
AddSpace (24);
statusArea = new StatusArea ();
statusArea.ShowMessage (BrandingService.ApplicationName);
var statusAreaAlign = new Alignment (0, 0, 1, 1);
statusAreaAlign.Add (statusArea);
contentBox.PackStart (statusAreaAlign, true, true, 0);
AddSpace (24);
statusAreaAlign.SizeAllocated += (object o, SizeAllocatedArgs args) => {
Gtk.Widget toplevel = this.Toplevel;
if (toplevel == null)
return;
int windowWidth = toplevel.Allocation.Width;
int center = windowWidth / 2;
int left = Math.Max (center - 300, args.Allocation.Left);
int right = Math.Min (left + 600, args.Allocation.Right);
uint left_padding = (uint) (left - args.Allocation.Left);
uint right_padding = (uint) (args.Allocation.Right - right);
if (left_padding != statusAreaAlign.LeftPadding || right_padding != statusAreaAlign.RightPadding)
statusAreaAlign.SetPadding (0, 0, (uint) left_padding, (uint) right_padding);
};
matchEntry = new SearchEntry ();
matchEntry.ForceFilterButtonVisible = true;
matchEntry.Entry.FocusOutEvent += (o, e) => {
if (SearchEntryLostFocus != null)
SearchEntryLostFocus (o, e);
};
matchEntry.Ready = true;
matchEntry.Visible = true;
matchEntry.IsCheckMenu = true;
matchEntry.WidthRequest = 240;
if (!Platform.IsMac && !Platform.IsWindows)
matchEntry.Entry.ModifyFont (Pango.FontDescription.FromString ("Sans 9")); // TODO: VV: "Segoe UI 9"
matchEntry.RoundedShape = true;
matchEntry.Entry.Changed += HandleSearchEntryChanged;
matchEntry.Activated += HandleSearchEntryActivated;
matchEntry.Entry.KeyPressEvent += HandleSearchEntryKeyPressed;
SizeAllocated += (o, e) => {
if (SearchEntryResized != null)
SearchEntryResized (o, e);
};
contentBox.PackStart (matchEntry, false, false, 0);
var align = new Gtk.Alignment (0, 0, 1f, 1f);
align.Show ();
align.TopPadding = (uint) 5;
align.LeftPadding = (uint) 9;
align.RightPadding = (uint) 18;
align.BottomPadding = (uint) 10;
align.Add (contentBox);
Add (align);
SetDefaultSizes (-1, 21);
configurationCombo.Changed += (o, e) => {
if (ConfigurationChanged != null)
ConfigurationChanged (o, e);
};
runtimeCombo.Changed += (o, e) => {
var ea = new HandledEventArgs ();
if (RuntimeChanged != null)
RuntimeChanged (o, ea);
TreeIter it;
if (runtimeCombo.GetActiveIter (out it)) {
if (ea.Handled) {
runtimeCombo.SetActiveIter (lastSelection);
return;
}
lastSelection = it;
}
};
button.Clicked += HandleStartButtonClicked;
IdeApp.CommandService.ActiveWidgetChanged += (sender, e) => {
lastCommandTarget = new WeakReference (e.OldActiveWidget);
};
this.ShowAll ();
this.statusArea.statusIconBox.HideAll ();
}
示例8: GetTargetFrameworks
List<TargetFramework> GetTargetFrameworks (ComboBox combo)
{
TreeIter iter;
if (!combo.GetActiveIter (out iter))
return new List<TargetFramework> ();
return (List<TargetFramework>) combo.Model.GetValue (iter, 1);
}
示例9: ProjectPropertyWidget
public ProjectPropertyWidget(Project project)
{
this.project = project;
Table mainTable = new Table(2,1,false);
Table propertyTable = new Table(5,2,false);
Label lblFN = new Label(System.IO.Path.GetFileName(project.ProjectName));
lblFN.UseUnderline = false;
lblFN.Selectable = true;
lblFN.Xalign = 0;
/*prjDir.LabelProp = this.project.RelativeAppFilePath;
prjFullPath.LabelProp = this.project.AbsolutProjectDir;*/
Entry entr = new Entry(this.project.RelativeAppFilePath);
entr.ModifyBg(StateType.Normal,this.Style.Background(StateType.Normal));
entr.IsEditable = false;
Entry entrFullPath = new Entry(this.project.AbsolutProjectDir);
entrFullPath.IsEditable = false;
Entry entrFacebookApi = new Entry(this.project.FacebookAppID);
entrFacebookApi.Changed+= delegate(object sender, EventArgs e)
{
this.project.FacebookAppID = entrFacebookApi.Text;
};
Entry entrTitle = new Entry(this.project.AppFile.Title);
entrTitle.Changed+= delegate(object sender, EventArgs e)
{
try{
this.project.AppFile.Title = entrTitle.Text;
} catch (Exception ex){
Moscrif.IDE.Tool.Logger.Error(ex.Message);
}
};
ComboBox cbType = new ComboBox();
ListStore projectModel = new ListStore(typeof(string), typeof(string));
CellRendererText textRenderer = new CellRendererText();
cbType.PackStart(textRenderer, true);
cbType.AddAttribute(textRenderer, "text", 0);
cbType.Model= projectModel;
TreeIter ti = new TreeIter();
foreach(SettingValue ds in MainClass.Settings.ApplicationType){// MainClass.Settings.InstallLocations){
if(ds.Value == this.project.ApplicationType){
ti = projectModel.AppendValues(ds.Display,ds.Value);
cbType.SetActiveIter(ti);
} else projectModel.AppendValues(ds.Display,ds.Value);
}
if(cbType.Active <0)
cbType.Active =0;
cbType.Changed+= delegate(object sender, EventArgs e) {
TreeIter tiSelect = new TreeIter();
cbType.GetActiveIter(out tiSelect);
string text = cbType.Model.GetValue(tiSelect,1).ToString();
project.ApplicationType =text;
};
AddControl(ref propertyTable,0,lblFN,"Project ");
AddControl(ref propertyTable,1,entr,"Project App ");
AddControl(ref propertyTable,2,entrFullPath,"Project Path ");
AddControl(ref propertyTable,3,entrTitle,"Title ");
AddControl(ref propertyTable,4,cbType,"Type ");
AddControl(ref propertyTable,5,entrFacebookApi,"Facebook ID ");
mainTable.Attach(propertyTable,0,1,0,1,AttachOptions.Expand|AttachOptions.Fill,AttachOptions.Fill,0,0);
/*int rowCount = project.ConditoinsDefine.Count;
Table conditionsTable = new Table((uint)(rowCount + 3),(uint)2,false);
GenerateContent(ref conditionsTable, MainClass.Settings.Platform.Name, 1, MainClass.Settings.Platform,false);//tableSystem
GenerateContent(ref conditionsTable, MainClass.Settings.Resolution.Name, 2,MainClass.Settings.Resolution,true); //project.Resolution);//tableSystem
int i = 3;
foreach (Condition cd in project.ConditoinsDefine) {
GenerateContent(ref conditionsTable, cd.Name, i, cd,false);
i++;
}
mainTable.Attach(conditionsTable,0,1,1,2,AttachOptions.Expand|AttachOptions.Fill,AttachOptions.Fill,0,0);
*/
this.PackStart(mainTable,true,true,0);
this.ShowAll();
}