Search Results

Search found 931 results on 38 pages for 'combobox'.

Page 10/38 | < Previous Page | 6 7 8 9 10 11 12 13 14 15 16 17  | Next Page >

  • zk selecting combobox item programatically

    - by Abdul Khaliq
    I cannot set the value of combobox programatically can some one tell me what missing in the code public class Profile extends Window implements AfterCompose { @Override public void afterCompose() { Session session = Sessions.getCurrent(false); ApplicationContext ctx = WebApplicationContextUtils.getRequiredWebApplicationContext( (ServletContext) getDesktop().getWebApp().getNativeContext()); UsersDao usersDao = (UsersDao) ctx.getBean("daoUsers"); User user = (User) session.getAttribute("user"); user = usersDao.getUser(user.getUsername(),user.getPassword()); Textbox username_t = (Textbox) this.getFellow("username"); Textbox password_t = (Textbox) this.getFellow("password"); Textbox conpassword_t = (Textbox) this.getFellow("con_password"); Textbox firstname_t = (Textbox) this.getFellow("firstName"); Textbox lastname_t = (Textbox) this.getFellow("lastName"); Textbox email_t = (Textbox) this.getFellow("email"); Combobox hintQuestion_t = (Combobox) this.getFellow("hintQuestion"); Textbox hintAnswer_t = (Textbox) this.getFellow("hintAnswer"); Combobox locale_t = (Combobox) this.getFellow("locale"); Combobox authority_t = (Combobox) this.getFellow("authority"); username_t.setText(user.getUsername()); firstname_t.setText(user.getUserDetails().getFirstName()); lastname_t.setText(user.getUserDetails().getLastName()); email_t.setText(user.getUserDetails().getEmail()); Comboitem selectedItem = getSelectedIndexComboboxItem(hintQuestion_t, user.getHintQuestion()); hintQuestion_t.setSelectedItem(selectedItem); hintAnswer_t.setText(user.getHintAnswer()); selectedItem = getSelectedIndexComboboxItem(locale_t, user.getUserDetails().getLocale()); locale_t.setSelectedItem(selectedItem); selectedItem = getSelectedIndexComboboxItem(authority_t, ((Authority)user.getAuthorities().toArray()[0]).getRole()); authority_t.setSelectedItem(selectedItem); } private Comboitem getSelectedIndexComboboxItem(Combobox combobox, String value) { List<Comboitem> items = combobox.getItems(); Comboitem item = items.get(0); for (int i = 0; i < items.size(); i++) { Comboitem comboitem = items.get(i); String label = (String)comboitem.getLabel(); String cval = (String)comboitem.getValue(); if ((label!=null && label.equalsIgnoreCase(value)) || (cval != null && cval.equalsIgnoreCase(value))) { item = comboitem; break; } } return item; } } // zk file <window id="profile" use="com.jf.web.zk.ui.Profile"> <tabbox id="tabbox" width="40%" > <tabs> <tab label="Account Information"/> <tab label="Personal Information"/> <tab label="Contact Details"/> </tabs> <tabpanels> <tabpanel> <grid> <rows> <row> <label value="${i18nUtils.message('user.username')}"/> <hbox> <textbox id="username" />*,a-zA-Z,0-9 </hbox> </row> <row> <label value="${i18nUtils.message('user.password')}"/> <hbox> <textbox id="password" type="password"/>* </hbox> </row> <row> <label value="${i18nUtils.message('registration.user.password.confirm')}"/> <hbox> <textbox id="con_password" type="password"/>* </hbox> </row> <row> <label value="${i18nUtils.message('user.details.first.name')}"/> <hbox> <textbox id="firstName" type="text"/>* </hbox> </row> <row> <label value="${i18nUtils.message('user.details.last.name')}"/> <hbox> <textbox id="lastName" type="text"/>* </hbox> </row> <row> <label value="${i18nUtils.message('user.details.email')}"/> <hbox> <textbox id="email" type="text"/>* </hbox> </row> <row> <label value="${i18nUtils.message('user.hint.question')}"/> <hbox> <combobox id="hintQuestion" onCreate='self.setSelectedIndex(1);'> <comboitem label="${i18nUtils.message('user.hint.question.possible.value1')}" /> <comboitem label="${i18nUtils.message('user.hint.question.possible.value2')}" /> <comboitem label="${i18nUtils.message('user.hint.question.possible.value3')}" /> <comboitem label="${i18nUtils.message('user.hint.question.possible.value4')}" /> <comboitem label="${i18nUtils.message('user.hint.question.possible.value5')}" /> </combobox>* </hbox> </row> <row> <label value="${i18nUtils.message('user.hint.answer')}"/> <hbox> <textbox id="hintAnswer" type="text"/>* </hbox> </row> <row> <label value="${i18nUtils.message('user.details.locale')}"/> <hbox> <combobox id="locale" onCreate='self.setSelectedIndex(1);self.setReadonly(true);'> <comboitem label="${i18nUtils.message('user.details.locale.en')}" value="en_US"/> <comboitem label="${i18nUtils.message('user.details.locale.bg')}" value="bg_BG"/> </combobox>* </hbox> </row> <row> <label value="${i18nUtils.message('authority.account.type')}"/> <hbox> <combobox id="authority" onCreate='self.setSelectedIndex(0);self.setReadonly(true);'> <comboitem label="${i18nUtils.message('authority.job.seeker')}" value="Job Seeker"/> <comboitem label="${i18nUtils.message('authority.employer')}" value="Employer"/> <comboitem label="${i18nUtils.message('authority.hra')}" value="Human Resource Agency"/> <comboitem label="${i18nUtils.message('authority.advertiser')}" value="Advertiser"/> </combobox>* </hbox> </row> </rows> </grid> </tabpanel> </tabpanels> </tabbox> <grid width="40%"> <rows> <row> <button label="${i18nUtils.message('bttn.save')}" onClick="save()"/> <button label="${i18nUtils.message('bttn.cancel')}" onClick="cancel()"/> </row> </rows> </grid> </window> </zk> The "getSelectedIndexComboboxItem()" does return the correct selected item but there seems no effect on the UI. Like for example the locale is set to default Bulgarian language and I need to set it to English. Abdul Khaliq

    Read the article

  • How to insert item which type is QString to a ComboBox in Qt?

    - by Hanny
    I have an item which type is QString: for example: QString name="Name" the question is: How can I put this name variable into a combobox? I've read the Qt 4.6.2 docs but still cant figure out how to do that. Please dont refer me back to that Qt 4.6.2 docs again.. Please help me ASAP!! this is really urgent! thank you very much!! :)

    Read the article

  • another way to suggest combobox item

    - by aliassad
    Hi there .. Is there any way to let combobox suggest elements which not only start with combobox text? I mean even if the combobox text has space between it's characters, for example if combobox has these items hello hi hellothere when we try to type "he" or "h e" or "h e", the combobox would suggest hello and hellothere

    Read the article

  • Do WPF ComboBox SelectedIndex and SelectedValue have different behavior on SelectionChanged event?

    - by Junior Mayhé
    Hello guys I got this cbxJobPosition_SelectionChanged firing as expected. The problem is when a external method tries to set cbxJobPosition. cbxJobPosition is databinded with a list of objects of type JobPosition: JobPositionID: 1, JobPositionName: Manager JobPositionID: 2, JobPositionName: Employee JobPositionID: 3, JobPositionName: Third party Here's the XAML: <ComboBox Cursor="Hand" DataContext="{Binding}" ItemsSource="{Binding}" FontSize="13" Name="cbxJobPosition" SelectedValuePath="JobPositionID" DisplayMemberPath="JobPositionName" SelectedIndex="0" Width="233" Height="23" SelectionChanged="cbxJobPosition_SelectionChanged" /> On UserControl_Loaded method, it reads from database the list of jobs and try to set the specific job position "Third party": //calls cbxJobPosition_SelectionChanged and passes the correct SelectedValue within cbxJobPosition.SelectedIndex = 3; //calls cbxJobPosition_SelectionChanged and but won't pass the correct SelectedValue within cbxJobPosition.SelectedValue = "3"; As you can notice, when the processing is automatically redirected to cbxJobPosition_SelectionChanged, the SelectedValue attribute will have different values for each statement above when you're debugging within cbxJobPosition_SelectionChanged event. Does anyone know if this difference is expected, am I missing something or it could be a bug?

    Read the article

  • How to get Combobox.SelectedItem Return string value of what is selected instead of Service Reference Class?

    - by Rohit Acharya
    I currently have the following code for a button. The message box shows SilverlightApplication2.ServiceReference2.Employee instead of the text string selected by the user. The combobox items are being populated by a WCF service. As a result I am unable to pass it to the Async call. How do I get the string of what user selected? private void btnAdd_Click(object sender, RoutedEventArgs e) { object selectedItem = comobo1.SelectedItem.ToString(); MessageBox.Show(selectedItem.ToString()); var proxy = new Service1Client(); proxy.GetAllEmployeesCompleted += proxy_GetAllEmployeesCompleted; proxy.GetAllEmployeesAsync(selectedItem.ToString()); }

    Read the article

  • Kendo UI Combo Box Reset Value

    - by ciantrius
    I'm using the Kendo UI ComboBoxes in cascade mode to build up a filter that I wish to apply. How do I clear/reset the value of a Kendo UI ComboBox? I've tried: $("#comboBox").data("kendoComboBox").val(''); $("#comboBox").data("kendoComboBox").select(''); $("#comboBox").data("kendoComboBox").select(null); all to no avail. The project is an MVC4 app using the Razor engine and the code is basically the same as the Kendo UI example.

    Read the article

  • Getting value of "System.Windows.Controls.TextBlock" when binding to Silverlight ComboBox

    - by sipwiz
    I'm attempting to use a Silverlight ComboBox with a static list of elements in a very simple binding scenario. The problem is the selected item is not returning me the Text of the TextBlock within the ComboBox and is instead returning "System.Windows.Controls.TextBlock". My XAML is: <ComboBox SelectedValue="{Binding Country, Mode=TwoWay, NotifyOnValidationError=True, ValidatesOnExceptions=True}"> <TextBlock FontSize="11" Text="Afghanistan" /> <TextBlock FontSize="11" Text="Albania" /> <TextBlock FontSize="11" Text="Algeria" /> </ComboBox> In my C# file I'm binding to the ComboBox using: Customer customer = new Customer() { Country = "Albania" }; DataContext = customer; The binding does not result in Albania as the selected country and updating the ComboBox choice results in the Country being set to "System.Windows.Controls.TextBlock". I've tried fiddling around with DisplayMemberPath and SelectedValuePath but haven't found the answer. I suspect it's something really simple I'm missing.

    Read the article

  • C# - Fill a combo box with a DataTable

    - by MrG
    I'm used to work with Java where large amounts of examples are available. For various reasons I had to switch to C# and trying to do the following in SharpDevelop: // Form has a menu containing a combobox added via SharpDevelop's GUI // --- Variables languages = new string[2]; languages[0] = "English"; languages[1] = "German"; DataSet myDataSet = new DataSet(); // --- Preparation DataTable lTable = new DataTable("Lang"); DataColumn lName = new DataColumn("Language", typeof(string)); lTable.Columns.Add( lName ); for( int i=0; i<languages.Length; i++ ) { DataRow lLang = lTable.NewRow(); lLang["Language"] = languages[i]; lTable.Rows.Add(lLang); } myDataSet.Tables.Add(lTable); // --- Handling the combobox mnuActionLanguage.ComboBox.DataSource = myDataSet.Tables["Lang"].DefaultView; mnuActionLanguage.ComboBox.DisplayMember = "Language"; One would assume to see some values in the dropdown, but it's empty. Please tell me what I'm doing wrong ;( EDIT: mnuActionLanguage.ComboBox.DataBind() is what I also found on the net, but it doesn't work in my case. SOLUTION mnuActionLanguage.ComboBox.BindingContext = this.BindingContext; at the end solved the problem!

    Read the article

  • Excel VBA ComboBox2 doesn't get the right content

    - by Marc
    Hi, I'm having a problem with the content of a combobox. On my userform, there are 3 comboboxes. Depending on the chosen item from combobox1, combobox2 should display either set 1 or set 2. The same will be happening with the content of combobox 3, which depends upon the combination of chosen items from combobox 1 and 2. However, I'm running into problems with combobox 2, which is always populated by set 2, even if I select the item in combobox 1 that should generate set 1 in the second combobox. This is the code I used: Private Sub UserForm_Initialize() With ComboBox1 .Clear .AddItem "In contrast" .AddItem "Eng?" .AddItem "Trillers" .AddItem "Natuur(lijk)" .AddItem "Muziektrafiek" End With If ComboBox1.Value = "In contrast" Then GoTo LineComboBox1Set1 End If If ComboBox1.Value = "Eng?" Then GoTo LineComboBox1set2 End If If ComboBox1.Value = "Trillers" Then GoTo LineComboBox1set2 End If If ComboBox1.Value = "Natuur(lijk)" Then GoTo LineComboBox1set2 End If If ComboBox1.Value = "Muziektrafiek" Then GoTo LineComboBox1set2 End If LineComboBox1Set1: With ComboBox2 .Clear .AddItem "Op verkenning" .AddItem "Gehoord? Gezien?" .AddItem "On stage" .AddItem "Creabende" .AddItem "Ingeblikt" End With LineComboBox1set2: With ComboBox2 .Clear .AddItem "Op verkenning" .AddItem "Gehoord? Gezien?" .AddItem "On stage" .AddItem "Creabende" .AddItem "Ingeblikt" .AddItem "Speak up" .AddItem "In de kijker" End With Can anyone help me on this one? Thanks a lot in advance!! Kind regards, Marc

    Read the article

  • WPF custom control derived from ComboBox that shows a Data

    Create a custom WPF control that derives from ComboBox and create a property where its value will be used as the content of the dropdown  read moreBy Michael DetrasDid you know that DotNetSlackers also publishes .net articles written by top known .net Authors? We already have over 80 articles in several categories including Silverlight. Take a look: here.

    Read the article

  • Databinding a .Net WinForms ComboBox to an Enum

    - by Tim Huffam
    This is quite simple... Define the enum eg: public enum MyEnum{ ItemOne, ItemTwo, } Within the form set the datasource of the combobox to the values of the enum eg: myCombo.DataSource = System.Enum.GetValues(typeof(MyEnum)); To have the combo auto select a value based on a bound object, set the databinding of the combo eg: class MyObject{ private MyEnum myEnumProperty; public MyEnum MyEnumProperty{get {return myEnumProperty;}} } MyObject myObj = new MyObject(); myCombo.DataBindings.Add(new Binding("SelectedIndex", myObject, "MyEnumProperty");

    Read the article

  • ComboBox exception caused in winforms FormClosing event

    - by Spooky2010
    Using c# vs2008 winforms I have an application with a bunch of child winforms. Each time a form is closed I need to store the current selected value of a combobox that is on each form to a Global application variable so that I can track it and use it in new forms. The combobox is populated on form start via a method to set its datasource to an ArrayList of items What I have found is if the combobox is populated with items in the designer, and you try to get the combobox value in the form closing event, I always get a NullReferenceException. However if the comboBox has an datasource like I DO have in my application and I try to get the combobox value in the form closing event then I would say 95% of the time I DO NOT get the NullReferenceException, but I do get it 5% of the time. That ratio can even vary depending on what computer I run the application on. for example I have 1 computer where the exception always occurs. My question is therefore what is (the best) way to get the value of the combobox, last thing before the form closes without causing the exception. I would def prefer to do it last thing before the form closes rather than track it with every selected index change event. Any advice appreciated.

    Read the article

  • Accesing WinCE ComboBox DroppedDown property (.NET CF 2.0)

    - by PabloG
    I'm implementing custom behavior sub-classing the form controls, but I cannot manage to access the DroppedDown property of the ComboBox. Looking in the help, it's supposed to be supported in CF.NET 2.0: using System; using System.Collections.Generic; using System.ComponentModel; using System.Drawing; using System.Data; using System.Text; using System.Windows.Forms; namespace xCustomControls { public partial class xComboBox : System.Windows.Forms.ComboBox { private ComboBox comboBox1; public xComboBox() { InitializeComponent(); this.KeyDown += new KeyEventHandler(this.KeyDownHandler); } private void KeyDownHandler(object sender, KeyEventArgs e) { // DroppedDown doesn't appear in the IntelliSense of ComboBox. // or this.comboBox1. if (((ComboBox)sender).DroppedDown) // fail! return; switch (e.KeyData) { case Keys.Up: case Keys.Enter: case Keys.Down: e.Handled = true; this.Parent.SelectNextControl((Control)sender, e.KeyData != Keys.Up, true, true, true); ... fails with 'System.Windows.Forms.ComboBox' does not contain a definition for 'DroppedDown' and no extension method 'DroppedDown' accepting a first argument of type 'System.Windows.Forms.ComboBox' could be found How can I access the property? TIA, Pablo

    Read the article

  • How can I make a Yes/No combobox return true/false?

    - by Kasper Hansen
    I am new to creating forms in Visual Studio and C#. But I made a UI that has some comboboxes where the DropDownStyle is DropDownList. The items shown is Yes and No. But I need to assign this as a boolean value to a property on some object ai and currently do this: if (cmbExample.Text == "Yes") { ai.isPacketType = true; } else if (cmbExample.Text == "No") { ai.isPacketType = false; } I basically want to do something like this (or some other one liner): ai.isPacketType = cmbExample.Text; How do I link the Text Yes to the value true and No to false?

    Read the article

  • combobox intem does not show in crystal report [migrated]

    - by upitnik
    I am creating a simple printing application using crstal reports, C# and visual studio 2010. On my winform I have some textboxes, comboboxes. Comboboxes are using data for fill from the XML file. On my report I created some parameters and linked with the selection of comboboxes. When I use: cryRpt.SetParameterValue("PAR3", cmbSome.SelectedIndex); on my report I see the 0 or 1 depending my item selection. Now I want to display, not the index but the value ie: Monday. If I use selectedItem, selectedText or selectedValue i do not see anything on my report. To see what happend i put another textbox on my form and linked it with the combobox selection as: txtProe.Text = Convert.ToString(cmbSome.SelectedItem); or txtProe.Text = cmbSome.Text; In both case when I click the button I see that my selection from cmbSome is passed to it. Does anyone knows what happens here ??!

    Read the article

  • ComboBox Data Binding

    - by Geertjan
    Let's create a databound combobox, levering MVC in a desktop application. The result will be a combobox, provided by the NetBeans ChoiceView, that displays data retrieved from a database: What follows is not much different from the NetBeans Platform CRUD Application Tutorial and you're advised to consult that document if anything that follows isn't clear enough. One kind of interesting thing about the instructions that follow is that it shows that you're able to create an application where each element of the MVC architecture can be located within a separate module: Start by creating a new NetBeans Platform application named "MyApplication". Model We're going to start by generating JPA entity classes from a database connection. In the New Project wizard, choose "Java Class Library". Click Next. Name the Java Class Library "MyEntities". Click Finish. Right-click the MyEntities project, choose New, and then select "Entity Classes from Database". Work through the wizard, selecting the tables of interest from your database, and naming the package "entities". Click Finish. Now a JPA entity is created for each of the selected tables. In the Project Properties dialog of the project, choose "Copy Dependent Libraries" in the Packaging panel. Build the project. In your project's "dist" folder (visible in the Files window), you'll now see a JAR, together with a "lib" folder that contains the JARs you'll need. In your NetBeans Platform application, create a module named "MyModel", with code name base "org.my.model". Right-click the project, choose Properties, and in the "Libraries" panel, click Add Dependency button in the Wrapped JARs subtab to add all the JARs from the previous step to the module. Also include "derby-client.jar" or the equivalent driver for your database connection to the module. Controler In your NetBeans Platform application, create a module named "MyControler", with code name base "org.my.controler". Right-click the module's Libraries node, in the Projects window, and add a dependency on "Explorer & Property Sheet API". In the MyControler module, create a class with this content: package org.my.controler; import org.openide.explorer.ExplorerManager; public class MyUtils { static ExplorerManager controler; public static ExplorerManager getControler() { if (controler == null) { controler = new ExplorerManager(); } return controler; } } View In your NetBeans Platform application, create a module named "MyView", with code name base "org.my.view".  Create a new Window Component, in "explorer" view, for example, let it open on startup, with class name prefix "MyView". Add dependencies on the Nodes API and on the Explorer & Property Sheet API. Also add dependencies on the "MyModel" module and the "MyControler" module. Before doing so, in the "MyModel" module, make the "entities" package and the "javax.persistence" packages public (in the Libraries panel of the Project Properties dialog) and make the one package that you have in the "MyControler" package public too. Define the top part of the MyViewTopComponent as follows: public final class MyViewTopComponent extends TopComponent implements ExplorerManager.Provider { ExplorerManager controler = MyUtils.getControler(); public MyViewTopComponent() { initComponents(); setName(Bundle.CTL_MyViewTopComponent()); setToolTipText(Bundle.HINT_MyViewTopComponent()); setLayout(new BoxLayout(this, BoxLayout.PAGE_AXIS)); controler.setRootContext(new AbstractNode(Children.create(new ChildFactory<Customer>() { @Override protected boolean createKeys(List list) { EntityManager entityManager = Persistence. createEntityManagerFactory("MyEntitiesPU").createEntityManager(); Query query = entityManager.createNamedQuery("Customer.findAll"); list.addAll(query.getResultList()); return true; } @Override protected Node createNodeForKey(Customer key) { Node customerNode = new AbstractNode(Children.LEAF, Lookups.singleton(key)); customerNode.setDisplayName(key.getName()); return customerNode; } }, true))); controler.addPropertyChangeListener(new PropertyChangeListener() { @Override public void propertyChange(PropertyChangeEvent evt) { Customer selectedCustomer = controler.getSelectedNodes()[0].getLookup().lookup(Customer.class); StatusDisplayer.getDefault().setStatusText(selectedCustomer.getName()); } }); JPanel row1 = new JPanel(new FlowLayout(FlowLayout.LEADING)); row1.add(new JLabel("Customers: ")); row1.add(new ChoiceView()); add(row1); } @Override public ExplorerManager getExplorerManager() { return controler; } ... ... ... Now run the application and you'll see the same as the image with which this blog entry started.

    Read the article

  • Binding to Silverlight ComboBox and Using SelectedValue, SelectedValuePath and DisplayMemberPath

    How do you bind a ComboBox to a collection of objects, and then bind a property from the selected objects to some other scalar property? I received this question today from a friend of mine (a variation of this question). I decided to walk through the scenario here in case anyone else runs into it. This is one of those things that can be confusing it is simple, but it is is much easier shown the explained. This post lays out the scenario and you can download the sample code at the end. When we...Did you know that DotNetSlackers also publishes .net articles written by top known .net Authors? We already have over 80 articles in several categories including Silverlight. Take a look: here.

    Read the article

< Previous Page | 6 7 8 9 10 11 12 13 14 15 16 17  | Next Page >