本文整理汇总了C#中Gtk.ListStore.AppendValues方法的典型用法代码示例。如果您正苦于以下问题:C# ListStore.AppendValues方法的具体用法?C# ListStore.AppendValues怎么用?C# ListStore.AppendValues使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Gtk.ListStore
的用法示例。
在下文中一共展示了ListStore.AppendValues方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ArticuloView
public ArticuloView () :
base(Gtk.WindowType.Toplevel)
{
this.Build ();
List<Articulo> articulos = new List<Articulo> ();
int categoriaId = 2;
CellRendererText cellRendererText = new CellRendererText ();
comboBoxCategoria.PackStart (cellRendererText, false);
comboBoxCategoria.AddAttribute (cellRendererText, "text", 1);
ListStore listStore = new ListStore (typeof(int),typeof(string));
TreeIter initialTreeIter=listStore.AppendValues (0, "<sin asignar>");
foreach (Articulo articulo in articulos) {
TreeIter currentTreeIter=listStore.AppendValues (articulo.Id, articulo.Nombre);
if (articulo.Id == categoriaId)
initialTreeIter = currentTreeIter;
}
comboBoxCategoria.Model = listStore;
comboBoxCategoria.SetActiveIter (initialTreeIter);
}
示例2: PythonOptionsWidget
public PythonOptionsWidget ()
{
this.Build();
// Python paths
m_PathsListStore = new ListStore (typeof (string));
m_PathsTreeView.Model = this.m_PathsListStore;
m_PathsTreeView.HeadersVisible = false;
TreeViewColumn column = new TreeViewColumn ();
CellRendererText ctext = new CellRendererText ();
column.PackStart (ctext, true);
column.AddAttribute (ctext, "text", 0);
m_PathsTreeView.AppendColumn (column);
m_PathsTreeView.Selection.Changed += delegate {
this.m_RemovePathButton.Sensitive = m_PathsTreeView.Selection.CountSelectedRows () == 1;
};
// Setup Python Runtime Version
m_RuntimeListStore = new ListStore (typeof (string), typeof (Type));
m_RuntimeCombo.Model = this.m_RuntimeListStore;
m_RuntimeListStore.AppendValues ("Python 2.5", typeof (Python25Runtime));
m_RuntimeListStore.AppendValues ("Python 2.6", typeof (Python26Runtime));
m_RuntimeListStore.AppendValues ("Python 2.7", typeof (Python27Runtime));
m_RuntimeListStore.AppendValues ("IronPython", typeof (IronPythonRuntime));
m_RuntimeCombo.Changed += delegate {
m_RuntimeFileEntry.Path = String.Empty;
};
}
示例3: MainWindow
public MainWindow()
: base(Gtk.WindowType.Toplevel)
{
Build ();
//comboBox.Active = 0; -> Para establecer como predeterminado un item del combo
CellRenderer cellRenderer = new CellRendererText();
comboBox.PackStart(cellRenderer, false); //expand = false
comboBox.AddAttribute(cellRenderer, "text", 0);
CellRenderer cellRenderer2 = new CellRendererText();
comboBox.PackStart(cellRenderer2, false); //expand = false
comboBox.AddAttribute(cellRenderer2, "text", 1);
listStore = new ListStore(typeof(string), typeof(string));
comboBox.Model = listStore;
listStore.AppendValues("1", "uno");
listStore.AppendValues("2", "dos");
comboBox.Changed += comboBoxChanged;
comboBox.Changed += delegate {showItemSelected(listStore);};
comboBox.Changed += delegate {
Console.WriteLine("Evento activado");
TreeIter treeIter;
if (comboBox.GetActiveIter(out treeIter) ){ // item seleccionado.
object value =listStore.GetValue(treeIter, 0);
Console.WriteLine("ComboBox.changed id={0}", value);
}
};
}
示例4: AddObjectClassDialog
public AddObjectClassDialog(Connection conn)
{
objectClasses = new List<string> ();
ui = new Glade.XML (null, "lat.glade", "addObjectClassDialog", null);
ui.Autoconnect (this);
store = new ListStore (typeof (bool), typeof (string));
CellRendererToggle crt = new CellRendererToggle();
crt.Activatable = true;
crt.Toggled += OnClassToggled;
objClassTreeView.AppendColumn ("Enabled", crt, "active", 0);
objClassTreeView.AppendColumn ("Name", new CellRendererText (), "text", 1);
objClassTreeView.Model = store;
try {
foreach (string n in conn.Data.ObjectClasses)
store.AppendValues (false, n);
} catch (Exception e) {
store.AppendValues (false, "Error getting object classes");
Log.Debug (e);
}
addObjectClassDialog.Icon = Global.latIcon;
addObjectClassDialog.Resize (300, 400);
addObjectClassDialog.Run ();
addObjectClassDialog.Destroy ();
}
示例5: ComboBoxHelper
public ComboBoxHelper(IDbConnection dbConnection,ComboBox comboBox,string nombre, string id,int elementoInicial,string tabla)
{
this.comboBox=comboBox;
IDbCommand dbCommand= dbConnection.CreateCommand();
dbCommand.CommandText = string.Format(selectFormat,id,nombre,tabla);
IDataReader dbDataReader= dbCommand.ExecuteReader();
// CellRendererText cell1=new CellRendererText();
// comboBox.PackStart(cell1,false);
// comboBox.AddAttribute(cell1,"text",0);
CellRendererText cell2=new CellRendererText();
comboBox.PackStart(cell2,false);
comboBox.AddAttribute(cell2,"text",1);//añadimos columnas
liststore=new ListStore(typeof(int),typeof(string));
TreeIter initialIter= liststore.AppendValues(0,"<sin asignar>");//si el elemento inicial no existe se selecciona esta opcion
while(dbDataReader.Read()){
int id2=(int)dbDataReader[id];
string nombre2=dbDataReader[nombre].ToString();
TreeIter iter=liststore.AppendValues(id2,nombre2);
if(elementoInicial==id2)
initialIter=iter;
}
dbDataReader.Close();
comboBox.Model=liststore;
comboBox.SetActiveIter(initialIter);
}
示例6: MonoRuntimePanelWidget
public MonoRuntimePanelWidget()
{
this.Build();
labelRunning.Markup = GettextCatalog.GetString ("MonoDevelop is currently running on <b>{0}</b>.", Runtime.SystemAssemblyService.CurrentRuntime.DisplayName);
store = new ListStore (typeof(string), typeof(object));
tree.Model = store;
CellRendererText crt = new CellRendererText ();
tree.AppendColumn ("Runtime", crt, "markup", 0);
TargetRuntime defRuntime = IdeApp.Preferences.DefaultTargetRuntime;
foreach (TargetRuntime tr in Runtime.SystemAssemblyService.GetTargetRuntimes ()) {
string name = tr.DisplayName;
TreeIter it;
if (tr == defRuntime) {
name = "<b>" + name + " (Default)</b>";
defaultIter = it = store.AppendValues (name, tr);
} else
it = store.AppendValues (name, tr);
if (tr.IsRunning)
runningIter = it;
}
tree.Selection.Changed += HandleChanged;
UpdateButtons ();
}
示例7: CompilerOptionsPanelWidget
public CompilerOptionsPanelWidget(DotNetProject project)
{
this.Build();
this.project = project;
DotNetProjectConfiguration configuration = (DotNetProjectConfiguration) project.GetActiveConfiguration (IdeApp.Workspace.ActiveConfiguration);
FSharpCompilerParameters compilerParameters = (FSharpCompilerParameters) configuration.CompilationParameters;
ListStore store = new ListStore (typeof (string));
store.AppendValues (GettextCatalog.GetString ("Executable"));
store.AppendValues (GettextCatalog.GetString ("Library"));
store.AppendValues (GettextCatalog.GetString ("Executable with GUI"));
store.AppendValues (GettextCatalog.GetString ("Module"));
compileTargetCombo.Model = store;
CellRendererText cr = new CellRendererText ();
compileTargetCombo.PackStart (cr, true);
compileTargetCombo.AddAttribute (cr, "text", 0);
compileTargetCombo.Active = (int) configuration.CompileTarget;
compileTargetCombo.Changed += new EventHandler (OnTargetChanged);
// Load the codepage. If it matches any of the supported encodigs, use the encoding name
string foundEncoding = null;
foreach (TextEncoding e in TextEncoding.SupportedEncodings) {
if (e.CodePage == -1)
continue;
if (e.CodePage == compilerParameters.CodePage)
foundEncoding = e.Id;
codepageEntry.AppendText (e.Id);
}
if (foundEncoding != null)
codepageEntry.Entry.Text = foundEncoding;
else if (compilerParameters.CodePage != 0)
codepageEntry.Entry.Text = compilerParameters.CodePage.ToString ();
}
示例8: ComboBoxHelper
public ComboBoxHelper(ComboBox comboBox, object id, string selectSql)
{
CellRendererText cellRendererText = new CellRendererText ();
comboBox.PackStart (cellRendererText, false);
comboBox.SetCellDataFunc (cellRendererText, new CellLayoutDataFunc (delegate(CellLayout cell_layout, CellRenderer cell, TreeModel tree_model, TreeIter iter) {
cellRendererText.Text = ((object[])tree_model.GetValue(iter, 0))[1].ToString();
}));
ListStore listStore = new ListStore (typeof(object));
object[] initial = new object[] { null, "<sin asignar>" };
TreeIter initialTreeIter = listStore.AppendValues ((object)initial);
IDbCommand dbCommand = App.Instance.DbConnection.CreateCommand ();
dbCommand.CommandText = selectSql;
IDataReader dataReader = dbCommand.ExecuteReader ();
while (dataReader.Read()) {
object currentId = dataReader [0];
object currentName = dataReader [1];
object[] values = new object[] { currentId, currentName };
TreeIter treeIter = listStore.AppendValues ((object)values);
if (currentId.Equals (id))
initialTreeIter = treeIter;
}
dataReader.Close ();
comboBox.Model = listStore;
comboBox.SetActiveIter (initialTreeIter);
}
示例9: Fill
public static void Fill(ComboBox comboBox, QueryResult queryResult)
{
CellRendererText cellRenderText = new CellRendererText ();
comboBox.PackStart (cellRenderText, false);
comboBox.SetCellDataFunc(cellRenderText,
delegate(CellLayout Cell_layout, CellRenderer CellView, TreeModel tree_model, TreeIter iter) {
IList row = (IList)tree_model.GetValue(iter, 0);
cellRenderText.Text = row[1].ToString();
//Vamos a ver el uso de los parámetros para acceder a SQL
});
ListStore listStore = new ListStore (typeof(IList));
//TODO localización de "Sin Asignar".
IList first = new object[] { null, "<sin asignar>" };
TreeIter treeIterFirst = listStore.AppendValues (first);
//TreeIter treeIterFirst = ListStore.AppendValues(first);
foreach (IList row in queryResult.Rows)
listStore.AppendValues (row);
comboBox.Model = listStore;
//Por defecto vale -1 (para el indice de categoría)
comboBox.Active = 0;
comboBox.SetActiveIter(treeIterFirst);
}
示例10: ApplicationWidget
public ApplicationWidget(Project project,Gtk.Window parent)
{
parentWindow =parent;
this.Build();
this.project = project;
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;
tblGlobal.Attach(cbType, 1, 2, 0,1, AttachOptions.Fill|AttachOptions.Expand, AttachOptions.Fill|AttachOptions.Expand, 0, 0);
afc = new ApplicationFileControl(project.AppFile,ApplicationFileControl.Mode.EditNoSaveButton,parentWindow);
vbox2.PackEnd(afc, true, true, 0);
}
示例11: ComboBoxHelper
public ComboBoxHelper(
ComboBox comboBox,
IDbConnection dbConnection,
string keyFieldName,
string valueFieldName,
string tableName,
int id)
{
this.comboBox = comboBox;
CellRendererText cellRendererText = new CellRendererText();
comboBox.PackStart (cellRendererText, true);
comboBox.AddAttribute (cellRendererText, "text", 1);
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 ();
while (dataReader.Read ()) {
int key = (int)dataReader[keyFieldName];
string value = (string)dataReader[valueFieldName];
TreeIter treeIter = listStore.AppendValues (key, value);
if (key == id)
initialTreeIter = treeIter;
}
dataReader.Close ();
comboBox.Model = listStore;
comboBox.SetActiveIter (initialTreeIter);
}
示例12: MainWindow
public MainWindow()
: base(Gtk.WindowType.Toplevel)
{
Build ();
treeView.Selection.Mode = SelectionMode.Multiple;//seleccion multiple de item
treeView.AppendColumn("Columna uno",new CellRendererText(),"text",0);
treeView.AppendColumn("Columna dos",new CellRendererText(),"text",1);
treeView.AppendColumn("Columna tres",new CellRendererText(),"text",2);
ListStore listStore = new ListStore(typeof(string), typeof(string), typeof(string));
treeView.Model = listStore;
listStore.AppendValues("clave uno", "valor uno", "uno");
listStore.AppendValues("clave dos", "valor dos", "dos");
listStore.AppendValues("clave tres", "valor tres", "tres");
listStore.AppendValues("clave cuatro", "valor cuatro", "cuatro");
treeView.Selection.Changed += delegate {//añade la ocurrencia del metodo al evento
int count = treeView.Selection.CountSelectedRows();
Console.WriteLine("treeView.Selection.Changed CountSelectedRows={0}", count);
treeView.Selection.SelectedForeach(delegate(TreeModel model, TreePath path, TreeIter iter)
{
object value = listStore.GetValue(iter, 0);
Console.WriteLine("value={0}", value);
});
};
}
示例13: CompilerOptionsPanelWidget
public CompilerOptionsPanelWidget (DotNetProject project)
{
this.Build();
this.project = project;
DotNetProjectConfiguration configuration = (DotNetProjectConfiguration) project.GetConfiguration (IdeApp.Workspace.ActiveConfiguration);
CSharpCompilerParameters compilerParameters = (CSharpCompilerParameters) configuration.CompilationParameters;
CSharpProjectParameters projectParameters = (CSharpProjectParameters) configuration.ProjectParameters;
ListStore store = new ListStore (typeof (string));
store.AppendValues (GettextCatalog.GetString ("Executable"));
store.AppendValues (GettextCatalog.GetString ("Library"));
store.AppendValues (GettextCatalog.GetString ("Executable with GUI"));
store.AppendValues (GettextCatalog.GetString ("Module"));
compileTargetCombo.Model = store;
CellRendererText cr = new CellRendererText ();
compileTargetCombo.PackStart (cr, true);
compileTargetCombo.AddAttribute (cr, "text", 0);
compileTargetCombo.Active = (int) configuration.CompileTarget;
compileTargetCombo.Changed += new EventHandler (OnTargetChanged);
if (project.IsLibraryBasedProjectType) {
//fixme: should we totally hide these?
compileTargetCombo.Sensitive = false;
mainClassEntry.Sensitive = false;
} else {
classListStore = new ListStore (typeof(string));
mainClassEntry.Model = classListStore;
mainClassEntry.TextColumn = 0;
((Entry)mainClassEntry.Child).Text = projectParameters.MainClass ?? string.Empty;
UpdateTarget ();
}
// Load the codepage. If it matches any of the supported encodigs, use the encoding name
string foundEncoding = null;
foreach (TextEncoding e in TextEncoding.SupportedEncodings) {
if (e.CodePage == -1)
continue;
if (e.CodePage == projectParameters.CodePage)
foundEncoding = e.Id;
codepageEntry.AppendText (e.Id);
}
if (foundEncoding != null)
codepageEntry.Entry.Text = foundEncoding;
else if (projectParameters.CodePage != 0)
codepageEntry.Entry.Text = projectParameters.CodePage.ToString ();
iconEntry.Path = projectParameters.Win32Icon;
iconEntry.DefaultPath = project.BaseDirectory;
allowUnsafeCodeCheckButton.Active = compilerParameters.UnsafeCode;
noStdLibCheckButton.Active = compilerParameters.NoStdLib;
ListStore langVerStore = new ListStore (typeof (string));
langVerStore.AppendValues (GettextCatalog.GetString ("Default"));
langVerStore.AppendValues ("ISO-1");
langVerStore.AppendValues ("ISO-2");
langVerCombo.Model = langVerStore;
langVerCombo.Active = (int) compilerParameters.LangVersion;
}
示例14: ScrapeViewModel
public ScrapeViewModel()
{
m_exploredLinks = new ListStore(typeof(string));
m_queue = new ConcurrentQueue<ScrapePair>();
m_tokenSource = new CancellationTokenSource();
m_exploredLinks.AppendValues("Test1");
m_exploredLinks.AppendValues("Test2");
}
示例15: CreateCompletionModel
TreeModel CreateCompletionModel ()
{
ListStore store = new ListStore (typeof (string));
store.AppendValues ("GNOME");
store.AppendValues ("total");
store.AppendValues ("totally");
return store;
}