本文整理汇总了C#中ComboBoxEntry.SetActiveIter方法的典型用法代码示例。如果您正苦于以下问题:C# ComboBoxEntry.SetActiveIter方法的具体用法?C# ComboBoxEntry.SetActiveIter怎么用?C# ComboBoxEntry.SetActiveIter使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ComboBoxEntry
的用法示例。
在下文中一共展示了ComboBoxEntry.SetActiveIter方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: SelIterCmb
private void SelIterCmb(ComboBoxEntry cmb, string itemtoselect)
{
Boolean isSelected = false;
TreeIter cmbiter;
cmb.Model.GetIterFirst (out cmbiter);
do {
GLib.Value value = new GLib.Value();
cmb.Model.GetValue(cmbiter,0,ref value);
if ((value.Val as string).Equals(itemtoselect, StringComparison.CurrentCultureIgnoreCase)){
cmb.SetActiveIter(cmbiter);
isSelected = true;
}
} while (cmb.Model.IterNext(ref cmbiter));
if (!isSelected) {
cmb.AppendText (itemtoselect);
this.SelIterCmb (cmb, itemtoselect);
}
}
示例2: NewProjectWizzard_New
//.........这里部分代码省略.........
cbeWorkspace = new ComboBoxEntry();
cbeWorkspace.Model = storeWorkspace;
cbeWorkspace.TextColumn = 0;
cbeWorkspace.Changed+= OnCbeWorkspaceChanged;
this.feLocation = new FileEntry();
this.table3.Attach (this.feLocation,1,2,2,3);
Gtk.Table.TableChild w9 = ((Gtk.Table.TableChild)(this.table3 [this.feLocation]));
w9.XOptions = ((Gtk.AttachOptions)(4));
w9.YOptions = ((Gtk.AttachOptions)(4));
table3.Attach(cbeWorkspace,1,2,1,2,AttachOptions.Fill|AttachOptions.Expand,AttachOptions.Fill,0,0);
CellRendererText rendererWorkspace = new CellRendererText();
cbeWorkspace.PackStart(rendererWorkspace, true);
cbeWorkspace.SetCellDataFunc(rendererWorkspace, new Gtk.CellLayoutDataFunc(RenderWorkspacePath));
cbeWorkspace.WidthRequest = 125;
cbeWorkspace.SetCellDataFunc(cbeWorkspace.Cells[0], new Gtk.CellLayoutDataFunc(RenderWorkspaceName));
string currentWorkspace ="";
if((MainClass.Workspace!= null) && !string.IsNullOrEmpty(MainClass.Workspace.FilePath))
{
string name = System.IO.Path.GetFileNameWithoutExtension(MainClass.Workspace.FilePath);
storeWorkspace.AppendValues (name,MainClass.Workspace.FilePath,1);
currentWorkspace = MainClass.Workspace.FilePath;
}
IList<RecentFile> lRecentProjects = MainClass.Settings.RecentFiles.GetWorkspace();
foreach(RecentFile rf in lRecentProjects){
if(rf.FileName == currentWorkspace) continue;
if(File.Exists(rf.FileName)){
string name = System.IO.Path.GetFileNameWithoutExtension(rf.FileName);
storeWorkspace.AppendValues(name,rf.FileName,0);
}
}
//storeWorkspace.AppendValues("","-------------",-1);
worksDefaultName = "Workspace"+MainClass.Settings.WorkspaceCount.ToString();
TreeIter tiNewW = storeWorkspace.AppendValues(worksDefaultName,MainClass.Paths.WorkDir,2);
if(!String.IsNullOrEmpty(currentWorkspace)){
cbeWorkspace.Active =0;
}
else {
feLocation.DefaultPath = MainClass.Paths.WorkDir;
cbeWorkspace.SetActiveIter(tiNewW);
//storeWorkspace.AppendValues(worksDefaultName,MainClass.Paths.WorkDir,2);
}
prjDefaultName = "Project"+MainClass.Settings.ProjectCount.ToString();
entrProjectName.Text = prjDefaultName;
cbeWorkspace.ShowAll();
feLocation.ShowAll();
CellRendererText rendererTemplate = new CellRendererText();
cbTemplate.PackStart(rendererTemplate, true);
storeTemplate = new ListStore(typeof(string), typeof(string), typeof(string));
cbTemplate.Model = storeTemplate;
cbTemplate.Changed+= delegate(object sender, EventArgs e) {
if(cbTemplate.Active <0) return;
if(cbTemplate.ActiveText != KEY_CUSTOM){
tblLibraries.Sensitive = false;
tblScreens.Sensitive = false;
ivSelectOrientation.Sensitive = false;
} else {
ivSelectOrientation.Sensitive = true;
tblLibraries.Sensitive = true;
tblScreens.Sensitive = true;
}
TreeIter tiChb = new TreeIter();
cbTemplate.GetActiveIter(out tiChb);
if(tiChb.Equals(TreeIter.Zero))return;
string appPath = storeTemplate.GetValue(tiChb, 2).ToString();
if(File.Exists(appPath)){
AppFile app = new AppFile(appPath);
List<string> libs = new List<string>(app.Libs);
Widget[] widgets = tblLibraries.Children;
foreach (Widget w in widgets ){
int indx = libs.FindIndex(x=>x==w.Name);
if(indx>-1) {
(w as CheckButton).Active = true;
} else {
(w as CheckButton).Active = false;
}
}
}
};
btnBack.Sensitive = false;
}