Event combo box

Hi i am trying to put a simple application together to let me put events into a text file and then let me click a date on a second form to let me see my events for that date in a text box. I have all the input forms working correctly but am struggling a
bit with the reading data part. i would really appreciate if anyone can give me any pointers as to how i can get the info to appear in the second form, so far my second form looks like this:
 public TicketInformationForm()
         InitializeComponent();
      //creating the community events list.
      List<Community_Event> CommnunityEvents;
      //create the Create Event list method.
      private void CreateEventList()
         CommnunityEvents = new List<Community_Event>();
         // call the extract Data method.
         ExtractData();
         if (CommnunityEvents.Count > 0)
            //if there are no events for the date selected display the following
            eventComboBox.Text = " -Events- ";
            descriptionTextBox.Text = "Pick an event";
         else
            //if there are no events for the date selected display the following
            eventComboBox.Text = " No Events ";
            descriptionTextBox.Text = "No events today.";
      //Create Method ExtractData
      private void ExtractData()
         CommnunityEvents.Clear();
         // load the data from the file
         List<Community_Event> tempList = new List<Community_Event>();
         string[] fileLines = File.ReadLines(@"C:\Users\IAN\Documents\calendar.txt");
         foreach(string line in fileLines)
            string[] items = fileLines[1].Split(",".ToCharArray());
               Community_Event newEvent = new Community_Event();
               newEvent.Day = Convert.ToInt32(items[0]);//Converting the Integer to a string.
               newEvent.Time = items[1];
               newEvent.Price = Convert.ToInt32(items[2]);//Converting the decimal to a string.
               newEvent.Event = items[3];
               newEvent.Description = items[4];
         CommnunityEvents = (from ev in tempList
                                      where ev.Day == 1
                                      select ev).ToList();
      private void dateMonthCalendar_DateChanged(object sender, DateRangeEventArgs e)
         //calling the create event list method to display any events in the eventscombo box.
         CreateEventList();
      private void eventComboBox_SelectedIndexChanged(object sender, EventArgs e)
      private void descriptionTextBox_TextChanged(object sender, EventArgs e)
      private void TicketInformationForm_Load(object sender, EventArgs e)
         //calling the create event list to open the form with today's events displayed if any.
         CreateEventList();

Hi, thanks for the reply, sorry I should have mentioned that I have already created the community event class with the get and set properties set up in it for all the fields I am adding to the text file like date time etc. i just do not seem to be able
to extract the data using the code I have above. sorry I am relatively new to this stuff and am just trying out a few applications to teach myself.

Similar Messages

  • How to populate data in the data table on combo box change event

    hi
    i am deepak .
    i am very new to JSF.
    my problem is i want to populate data in the datatable on the combo box change event.
    for example ---
    combo box has name of the city. when i will select a city
    the details of the city should populate in the datatable. and if i will select another city then the datatable should change accordingly..
    its urgent
    reply as soon as possible
    thanks in advance

    i am using Rational Application Developer to develop my application.
    i am using a combo box and i am assigning cityName from the SDO.
    and i am declaring a variable in the pageCode eg.
    private String cityName;
    public void setCityName(String cityName){
    this.cityName = cityName;
    public String getCityName(){
    return cityName;
    <h:selectOneMenu id="menu1" styleClass="selectOneMenu" value="#{pc_Test1.loginID}" valueChangeListener="#{pc_Test1.handleMenu1ValueChange}">
                        <f:selectItems
                             value="#{selectitems.pc_Test1.usercombo.LOGINID.LOGINID.toArray}" />
                   </h:selectOneMenu>
                   <hx:behavior event="onchange" target="menu1" behaviorAction="get"
                        targetAction="box1"></hx:behavior>
    and also i am declaring a requestParam type variable named city;
    and at the onChangeEvent i am writing the code
    public void handleMenu1ValueChange(ValueChangeEvent valueChangedEvent) {
    FacesContext context = FacesContext.getCurrentInstance();
    Map requestScope = ext.getApplication().createValueBinding("#{requestScope}").getValue(context);
    requestScope.put("login",(String)valueChangedEvent.getNewValue());
    and also i am creating another SDO which is used to populate data in datatable and in this SDO in the where clause i am using that requestParam .
    it is assigning value in the pageCode variable and in the requestParam but it is not populating the dataTable. i don't no why??
    it is possible that i may not clear at this point.
    please send me the way how my problem can be solved.
    thanks in advance

  • Adding an event listener to combo box

    I am working on a mortgage calculator and I cannot figure out how to add an event listener to a combo box.
    I want to get the mortgage term and interest rate to calucate the mortgage using the combo cox. Here is my program.
    Modify the mortgage program to allow the user to input the amount of a mortgage
    and then select from a menu of mortgage loans: 7 year at 5.35%, 15 year at 5.50%, and
    30 year at 5.75%. Use an array for the different loans. Display the mortgage payment
    amount. Then, list the loan balance and interest paid for each payment over the term
    of the loan. Allow the user to loop back and enter a new amount and make a new
    selection, with resulting new values. Allow user to exit if running as an application
    (can't do that for an applet though).
    import javax.swing.*;
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.event.*;
    import java.text.NumberFormat;
    import java.util.Locale;
    //creates class MortgageCalculator
    public class MortgageCalculator extends JFrame implements ActionListener {
    //creates title for calculator
         JPanel row = new JPanel();
         JLabel mortgageCalculator = new JLabel("MORTGAGE CALCULATOR", JLabel.CENTER);
    //creates labels and text fields for amount entered          
         JPanel firstRow = new JPanel(new GridLayout(3,1,1,1));
         JLabel mortgageLabel = new JLabel("Mortgage Payment $", JLabel.LEFT);
         JTextField mortgageAmount = new JTextField(10);
         JPanel secondRow = new JPanel();
         JLabel termLabel = new JLabel("Mortgage Term/Interest Rate", JLabel.LEFT);
         String[] term = {"7", "15", "30"};
         JComboBox mortgageTerm = new JComboBox(term);
         JPanel thirdRow = new JPanel();
         JLabel interestLabel = new JLabel("Interest Rate (%)", JLabel.LEFT);
         String[] interest = {"5.35", "5.50", "5.75"};
         JComboBox interestRate = new JComboBox(interest);
         JPanel fourthRow = new JPanel(new GridLayout(3, 2, 10, 10));
         JLabel paymentLabel = new JLabel("Monthly Payment $", JLabel.LEFT);
         JTextField monthlyPayment = new JTextField(10);
    //create buttons to calculate payment and clear fields
         JPanel fifthRow = new JPanel(new GridLayout(3, 2, 1, 1));
         JButton calculateButton = new JButton("CALCULATE PAYMENT");
         JButton clearButton = new JButton("CLEAR");
         JButton exitButton = new JButton("EXIT");
    //Display area
         JPanel sixthRow = new JPanel(new GridLayout(2, 2, 10, 10));
         JLabel displayArea = new JLabel(" ", JLabel.LEFT);
         JTextArea textarea = new JTextArea(" ", 8, 50);
    public MortgageCalculator() {
         super("Mortgage Calculator");                     //title of frame
         setSize(550, 350);                                             //size of frame
         setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
         Container pane = getContentPane();
         GridLayout grid = new GridLayout(7, 3, 10, 10);
         pane.setLayout(grid);
         pane.add(row);
         pane.add(mortgageCalculator);
         pane.add(firstRow);
         pane.add(mortgageLabel);
         pane.add(mortgageAmount);
         pane.add(secondRow);
         pane.add(termLabel);
         pane.add(mortgageTerm);
         pane.add(thirdRow);
         pane.add(interestLabel);
         pane.add(interestRate);
         pane.add(fourthRow);
         pane.add(paymentLabel);
         pane.add(monthlyPayment);
         monthlyPayment.setEnabled(false);
         pane.add(fifthRow);
         pane.add(calculateButton);
         pane.add(clearButton);
         pane.add(exitButton);
         pane.add(sixthRow);
         pane.add(textarea); //adds texaarea to frame
         pane.add(displayArea);
         setContentPane(pane);
         setVisible(true);
         //Adds Listener to buttons
         calculateButton.addActionListener(this);
         clearButton.addActionListener(this);
         exitButton.addActionListener(this);
         mortgageTerm.addActionListener(this);
         interestRate.addActionListener(this);
    public void actionPerformed(ActionEvent event) { 
         Object command = event.getSource();
         JComboBox mortgageTerm = (JComboBox)event.getSource();
         String termYear = (String)mortgageTerm.getSelectedItem();
    if (command == calculateButton) //calculates mortgage payment
         int year = Integer.parseInt(mortgageTerm.getText());
         double rate = new Double(interestRate.getText()).doubleValue();
         double mortgage = new Double(mortgageAmount.getText()).doubleValue();
         double interest = rate /100.0 / 12.0;
         double monthly = mortgage *(interest/(1-Math.pow(interest+1,-12.0 * year)));
                   NumberFormat myCurrencyFormatter;
                   myCurrencyFormatter = NumberFormat.getCurrencyInstance(Locale.US);
                   monthlyPayment.setText(myCurrencyFormatter.format(monthly));
         if(command == clearButton) //clears all text fields
                   mortgageAmount.setText(null);
                   //mortgageTerm.setText(null);
                   //interestRate.setText(null);
                   monthlyPayment.setText(null);
              if(command == exitButton) //sets exit button
                        System.exit(0);
         public static void main(String[] arguments) {
              MortgageCalculator mor = new MortgageCalculator();

    The OP already did this to both JComboBoxes.
    mochatay, here is a new actionPerformed method for you to use.
    I've improved a few things here and there...
    1) You can't just cast the ActionEvent's source into a JComboBox!
    What if it was a JButton that fired the event? Then you would get ClassCastExceptions (I'm sure you did)
    So check for all options, what the source of the ActionEvent actually was...
    2) You can't assume the user will always type in valid data.
    So enclose the Integer and Double parse methods in try-catch brakcets.
    Then you can do something when you know that the user has entered invalid input
    (like tell him/her what a clumsy idiot they are !)
    3) As soon as user presses an item in any JComboBox, just re-calculate.
    I did this here by programmatically clicking the 'Calculate' button.
    Alternatively, you could have a 'calculate' method, which does everything inside the
    if(command==calculateButton) if-block.
    This will be called when:
    a)calculateButton is pressed
    b)when either of the JComboBoxes are pressed.
    public void actionPerformed (ActionEvent event)
            Object command = event.getSource ();
            if (command == calculateButton) //calculates mortgage payment
                int year = 0;
                double rate = 0;
                double mortgage = 0;
                double interest = 0;
                /* If user has input invalid data, tell him so
                and return (Exit from this method back to where we were before */
                try
                    year = Integer.parseInt (mortgageTerm.getSelectedItem ().toString ());
                    rate = new Double (interestRate.getSelectedItem ().toString ()).doubleValue ();
                    mortgage = new Double (mortgageAmount.getText ()).doubleValue ();
                    interest = rate / 100.0 / 12.0;
                catch (NumberFormatException nfe)
                    /* Display a message Dialogue box with a message */
                    JOptionPane.showMessageDialog (this, "Error! Invalid input!");
                    return;
                double monthly = mortgage * (interest / (1 - Math.pow (interest + 1, -12.0 * year)));
                NumberFormat myCurrencyFormatter;
                myCurrencyFormatter = NumberFormat.getCurrencyInstance (Locale.US);
                monthlyPayment.setText (myCurrencyFormatter.format (monthly));
            else if (command == clearButton) //clears all text fields
                /* Better than setting it to null (I think) */
                mortgageAmount.setText ("");
                //mortgageTerm.setText(null);
                //interestRate.setText(null);
                monthlyPayment.setText ("");
            else if (command == exitButton) //sets exit button
                System.exit (0);
            else if (command == mortgageTerm)
                /* Programmatically 'clicks' the button,
                As is user had clicked it */
                calculateButton.doClick ();
            else if (command == interestRate)
                calculateButton.doClick ();
            //JComboBox mortgageTerm = (JComboBox) event.getSource ();
            //String termYear = (String) mortgageTerm.getSelectedItem ();
        }Hope this solves your problems.
    I also hope you'll be able to learn from what I've indicated, so you can use similar things yourself
    in future!
    Regards,
    lutha

  • Problem in event handling of combo box in JTable cell

    Hi,
    I have a combo box as an editor for a column cells in JTable. I have a event listener for this combo box. When ever I click on the JTable cell whose editor is combo box,
    I get the following exception,
    Exception occurred during event dispatching:
    java.lang.NullPointerException
         at javax.swing.plaf.basic.BasicTableUI$MouseInputHandler.setDispatchComponent(Unknown Source)
         at javax.swing.plaf.basic.BasicTableUI$MouseInputHandler.mousePressed(Unknown Source)
         at java.awt.AWTEventMulticaster.mousePressed(Unknown Source)
         at java.awt.Component.processMouseEvent(Unknown Source)
         at java.awt.Component.processEvent(Unknown Source)
         at java.awt.Container.processEvent(Unknown Source)
         at java.awt.Component.dispatchEventImpl(Unknown Source)
         at java.awt.Container.dispatchEventImpl(Unknown Source)
         at java.awt.Component.dispatchEvent(Unknown Source)
         at java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source)
         at java.awt.LightweightDispatcher.processMouseEvent(Unknown Source)
         at java.awt.LightweightDispatcher.dispatchEvent(Unknown Source)
         at java.awt.Container.dispatchEventImpl(Unknown Source)
         at java.awt.Component.dispatchEvent(Unknown Source)
         at java.awt.EventQueue.dispatchEvent(Unknown Source)
         at java.awt.EventDispatchThread.pumpOneEventForHierarchy(Unknown Source)
         at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
         at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
         at java.awt.EventDispatchThread.run(Unknown Source)
    Can any one tell me how to over come this problem.
    Thanks,
    Raghu

    Here's an example of the model I used in my JTable. I've placed 2 comboBoxes with no problems.
    Hope this helps.
    public class FileModel5 extends AbstractTableModel
    public boolean isEditable = false;
    protected static int NUM_COLUMNS = 3;
    // initialize number of rows to start out with ...
    protected static int START_NUM_ROWS = 0;
    protected int nextEmptyRow = 0;
    protected int numRows = 0;
    static final public String file = "File";
    static final public String mailName = "Mail Id";
    static final public String postName = "Post Office Id";
    static final public String columnNames[] = {"File", "Mail Id", "Post Office Id"};
    // List of data
    protected Vector data = null;
    public FileModel5()
    data = new Vector();
    public boolean isCellEditable(int rowIndex, int columnIndex)
    // The 2nd & 3rd column or Value field is editable
    if(isEditable)
    if(columnIndex > 0)
    return true;
    return false;
    * JTable uses this method to determine the default renderer/
    * editor for each cell. If we didn't implement this method,
    * then the last column would contain text ("true"/"false"),
    * rather than a check box.
    public Class getColumnClass(int c)
    return getValueAt(0, c).getClass();
    * Retrieves number of columns
    public synchronized int getColumnCount()
    return NUM_COLUMNS;
    * Get a column name
    public String getColumnName(int col)
    return columnNames[col];
    * Retrieves number of records
    public synchronized int getRowCount()
    if (numRows < START_NUM_ROWS)
    return START_NUM_ROWS;
    else
    return numRows;
    * Returns cell information of a record at location row,column
    public synchronized Object getValueAt(int row, int column)
    try
    FileRecord5 p = (FileRecord5)data.elementAt(row);
    switch (column)
    case 0:
    return (String)p.file;
    case 1:
    return (String)p.mailName;
    case 2:
    return (String)p.postName;
    catch (Exception e)
    return "";
    public void setValueAt(Object aValue, int row, int column)
    FileRecord5 arow = (FileRecord5)data.elementAt(row);
    arow.setElementAt((String)aValue, column);
    fireTableCellUpdated(row, column);
    * Returns information of an entire record at location row
    public synchronized FileRecord5 getRecordAt(int row) throws Exception
    try
    return (FileRecord5)data.elementAt(row);
    catch (Exception e)
    throw new Exception("Record not found");
    * Used to add or update a record
    * @param tableRecord
    public synchronized void updateRecord(FileRecord5 tableRecord)
    String file = tableRecord.file;
    FileRecord5 p = null;
    int index = -1;
    boolean found = false;
    boolean addedRow = false;
    int i = 0;
    while (!found && (i < nextEmptyRow))
    p = (FileRecord5)data.elementAt(i);
    if (p.file.equals(file))
    found = true;
    index = i;
    } else
    i++;
    if (found)
    { //update
    data.setElementAt(tableRecord, index);
    else
    if (numRows <= nextEmptyRow)
    //add a row
    numRows++;
    addedRow = true;
    index = nextEmptyRow;
    data.addElement(tableRecord);
    //Notify listeners that the data changed.
    if (addedRow)
    nextEmptyRow++;
    fireTableRowsInserted(index, index);
    else
    fireTableRowsUpdated(index, index);
    * Used to delete a record
    public synchronized void deleteRecord(String file)
    FileRecord5 p = null;
    int index = -1;
    boolean found = false;
    int i = 0;
    while (!found && (i < nextEmptyRow))
    p = (FileRecord5)data.elementAt(i);
    if (p.file.equals(file))
    found = true;
    index = i;
    } else
    i++;
    if (found)
    data.removeElementAt(i);
    nextEmptyRow--;
    numRows--;
    fireTableRowsDeleted(START_NUM_ROWS, numRows);
    * Clears all records
    public synchronized void clear()
    int oldNumRows = numRows;
    numRows = START_NUM_ROWS;
    data.removeAllElements();
    nextEmptyRow = 0;
    if (oldNumRows > START_NUM_ROWS)
    fireTableRowsDeleted(START_NUM_ROWS, oldNumRows - 1);
    fireTableRowsUpdated(0, START_NUM_ROWS - 1);
    * Loads the values into the combo box within the table for mail id
    public void setUpMailColumn(JTable mapTable, ArrayList mailList)
    TableColumn col = mapTable.getColumnModel().getColumn(1);
    javax.swing.JComboBox comboMail = new javax.swing.JComboBox();
    int s = mailList.size();
    for(int i=0; i<s; i++)
    comboMail.addItem(mailList.get(i));
    col.setCellEditor(new DefaultCellEditor(comboMail));
    //Set up tool tips.
    DefaultTableCellRenderer renderer = new DefaultTableCellRenderer();
    renderer.setToolTipText("Click for mail Id list");
    col.setCellRenderer(renderer);
    //Set up tool tip for the mailName column header.
    TableCellRenderer headerRenderer = col.getHeaderRenderer();
    if (headerRenderer instanceof DefaultTableCellRenderer)
    ((DefaultTableCellRenderer)headerRenderer).setToolTipText(
    "Click the Mail Id to see a list of choices");
    * Loads the values into the combo box within the table for post office id
    public void setUpPostColumn(JTable mapTable, ArrayList postList)
    TableColumn col = mapTable.getColumnModel().getColumn(2);
    javax.swing.JComboBox combo = new javax.swing.JComboBox();
    int s = postList.size();
    for(int i=0; i<s; i++)
    combo.addItem(postList.get(i));
    col.setCellEditor(new DefaultCellEditor(combo));
    //Set up tool tips.
    DefaultTableCellRenderer renderer = new DefaultTableCellRenderer();
    renderer.setToolTipText("Click for post office Id list");
    col.setCellRenderer(renderer);
    //Set up tool tip for the mailName column header.
    TableCellRenderer headerRenderer = col.getHeaderRenderer();
    if (headerRenderer instanceof DefaultTableCellRenderer)
    ((DefaultTableCellRenderer)headerRenderer).setToolTipText(
    "Click the Post Office Id to see a list of choices");
    }

  • Combo box, ring and event to modify them runtime

    Hi,
    I attached a picture of the block diagram. Using LV 8.2.1, win XP.
    What I want : User should select from Main Selection, and that brings up new values for strings in the other menus (tried both combo box and menu ring items).
    Teh problem : This block doesn't do that. Why? Looking with probe, I see the event captured and data are ok until the property node. They are not writed and on the front panel I see no difference.
    Thanx
    Attachments:
    double box test.jpg ‏97 KB
    Test doppio ring.vi ‏21 KB

    Slyfer wrote:
    I thought that the code inside the while loop but outside the event structure wasn't care.
    So if I want to do something continuosly (for example continuosly comparing two integer values to have a real-time boolean led indicator on front panel), do I put the code in the middle? This is a bit confusing thinking about the "timeout event"....
    Use the timeout event or put in the middle (=outside event structure but inside while loop.... at which CPU rate is executed?? too fast?) ??
    Just a suggestion. The timeout event for the Event Structure [ES] is equivalent to that of providing a small delay inside the while loop.
    But it is not mandatory. If you dont wire some value to the timeout terminal, but still want to something, like comparison, you can very well put that code outside the ES but inside the while loop. It ll execute.
    Else you can wire a value like 50 or 100 to the timeout terminal [ this gives enough time for the execution of the various codes inside the various events configured for the ES], so that the ES times out for every 50 or 100 ms when none of the other events occurs. If you put your comparison code here, it ll be doing the comparison all the time or whenever the ES waits and crosses the specified ms after an event has happened.
    I hope this gives you a clear idea about eventstructures.
    See the below links for more details on Event Structures.
    http://zone.ni.com/devzone/cda/tut/p/id/3331
    http://zone.ni.com:80/reference/en-XX/help/371361B-01/lvconcepts/using_events_in_labview/
    http://zone.ni.com/reference/en-XX/help/371361B-01/lvhowto/caveatsrecmndtnsevnts/
    - Partha
    LabVIEW - Wires that catch bugs!

  • Reg - 'F1' key event in Combo box

    Hi,
    Requirement:
          I have requirement that to launch a browser window on press of 'F1' key while the movie (swf) has focus. I did it and working fine for me in web application.
    Problem statement:
          When a movie had been launched and having focus in 'Combo box' (which has list of items starts with A to Z letters) control then, i pressed 'F1' key but the browser window has not been launched, instead 'Combo box's key action event get fired and the item starts with the letter 'P' has been selected in the combo box list. If now again i press 'F1' key the browser window has launched as per my requirement.
          This behavior is happening whenever the launched movie has focus in 'Combo box'; otherwise if the focus is on some other control like TextInput etc., no problem for me. One more information, if the Combo box doesn't have any item starts with the letter 'P' then no problem for me.
          I tried to understand the behavior of combo, but still i don't have any clue. Please share your knowledge/thoughts.
    Environment:
          Flex builder 3.5
          Adobe flash player 11.2
          Windows XP SP3
    Regards,
    Mani

    Hi,
    I just overridden the keydown handler function in ComboBox component to avoid its own event propagation behavior if 'F1' key is pressed and its working fine for me.
    Thanks for all,
    -Mani

  • Action event automatically triggered for combo box

    Hi all,
    I am facing a typical event handling problem for combo box in Swing(Using Net Beans 5.0, jdk 1.4.2)
    While adding items to combo box it is firing action event twice instead of once irrespective of no. of items added to it.
    For eg if there are 1 or more than 1 item added to combo box it is triggerring action event twice(one just after when first item is added and one again when rest all items are added)
    and if there is no item then also it is triggering once.
    Can you please help me out.
    Thanks

    post the SSCCE code, then only it is easy to find the problem

  • Catching COMBO BOX item changed in VALIDATE event

    Hi expert,
    I need to catch the item changed event for a combo box.
    below the code:
    <B1Listener(BoEventTypes.et_VALIDATE, False)> _
    Public Overridable Sub OnAfterValidate(ByVal pVal As ItemEvent)
                Dim form As Form = B1Connections.theAppl.Forms().Item(pVal.FormUID)
                Dim mt As Matrix = Form.Items.Item("Matrix_0").Specific
    if (pVal.ColUID.Equals("TipoList") And pVal.ItemChanged) Then
    end if
    but pVal.ItemChanged is always equal to false even if I change the value selected in combo box.
    can anyone help me?
    Thanks in advance.
    Best regards
    Andrea

    Hi Andrea,
    you can also catch the Event through
    pVal.EventType =SAPbouiCOM.BoEventTypes.et_COMBO_SELECT
    through this event, you can perform you're reuqirement.
    regards
    shiva

  • Event problem in editable combo box

    I have three editable combo box in my JDialog. I can select the value from the combo or I can enter any value. I have to perform some operation when one button is pressed after I have given the values in the three combo boxes. Here, If I select any value from the combo box, there is no problem. But if I enter the value in the combo boxes, when I press the button, in the first click nothing is happening. The First click just selects the value that entered in the last combo box and in the second click it works properly. I am not facing this problem in JDK 1.2.2 or JDK1.3. This occurs only in JDK1.4. Please let me if anyone knows the reason for this.
    Thanks.

    in the fla that contains your loadMovie() statement:
    1. drag a combobox to the stage.
    2. remove it.
    3. the combobox component will now be in your library.
    re-publish your swf and retest.

  • Not able to populate data in the combo box

    Hi Guys,
    I m new to flex development and I want to populate the data
    coming from the databasein the combobox.I am able to get the length
    .but not able to populate the data.
    Can anyone helpme out?
    The code is below:
    The data displayed in the combox box is displayed as
    [object],[object] etc.I m sure that the data is coming from the
    database and its not populated in the combo box.any help is
    appreciated.
    private function getParkinfo(event:ResultEvent):void
    { Alert.show(event.result.length.toString());
    countries.dataProvider = event.result;
    <mx:ComboBox id="countries" />

    What does the data look like in the result? Is it XML? Post a
    sample of it.

  • Show text box from one combo box selection

    Total newb here and need help.  I tried searching for a javascript to copy/paste, but without any luck.  I am using Acrobat Pro 9.2.0.  If you could help me out with the javascript or with directions on how to make the following be accomplished, I would be greatly appreciative.
    I am creating a fillable PDF and currently have a combo box that is labeled "Internship Satisfied By" with the options of "TCoB PDP", "MRKTNG 4185", and "Other College".  I would like a hidden text box (where the end user can fill in to explain) to become visible only when the end user selects the "Other College" option, but stay hidden for the other selections.  The hidden text box is labeled "Internship Explained".
    Thanks in advance! Jarrod

    Use this code as the combo box's validation script:
    if (event.value == "Other College") {
    getField("Internship Explained").display = display.visible;
    } else {
    getField("Internship Explained").display = display.hidden;

  • How can I make the combo box turn to the value of black.

    When the show button is pressed (and not before), a filled black square should be
    displayed in the display area. The combo box (or drop down list) that enables the user to choose the colour of
    the displayed shape and the altering should take effect immediately.When the show button is pressed,
    the image should immediately revert to the black square, the combo box should show the value that
    correspond to the black.
    Now ,the problem is: after I pressed show button, the image is reverted to the black square,but I don't know
    how can I make the combo box turn to the value of black.
    Any help or hint?Thanks a lot!
    coding 1.
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    import javax.swing.event.*;
    public class test extends JFrame {
         private JPanel buttonPanel;
         private DrawPanel myPanel;
         private JButton showButton;
         private JComboBox colorComboBox;
    private boolean isShow;
         private int shape;
         private boolean isFill=true;
    private String colorNames[] = {"black", "blue", "cyan", "darkGray", "gray",
    "green", "lightgray", "magenta", "orange",
    "pink", "red", "white", "yellow"}; // color names list in ComboBox
    private Color colors[] = {Color.black, Color.blue, Color.cyan, Color.darkGray,
                              Color.gray, Color.green, Color.lightGray, Color.magenta,
                              Color.orange, Color.pink, Color.red, Color.white, Color.yellow};
         public test() {
         super("Draw Shapes");
         // creat custom drawing panel
    myPanel = new DrawPanel(); // instantiate a DrawPanel object
    myPanel.setBackground(Color.white);
         // set up showButton
    // register an event handler for showButton's ActionEvent
    showButton = new JButton ("show");
         showButton.addActionListener(
              // anonymous inner class to handle showButton events
         new ActionListener() {
                   // draw a black filled square shape after clicking showButton
         public void actionPerformed (ActionEvent event) {
                             // call DrawPanel method setShowStatus and pass an parameter
              // to decide if show the shape
         myPanel.setShowStatus(true);
                   isShow = myPanel.getShowStatus();
                                            shape = DrawPanel.SQUARE;
                        // call DrawPanel method setShape to indicate shape to draw
                                            myPanel.setShape(shape);
                        // call DrawPanel method setFill to indicate to draw a filled shape
                                            myPanel.setFill(true);
                        // call DrawPanel method draw
                                            myPanel.draw();
                             myPanel.setFill(true);
                             myPanel.setForeground(Color.black);
                   }// end anonymous inner class
         );// end call to addActionListener
    // set up colorComboBox
    // register event handlers for colorComboBox's ItemEvent
    colorComboBox = new JComboBox(colorNames);
    colorComboBox.setMaximumRowCount(5);
    colorComboBox.addItemListener(
         // anonymous inner class to handle colorComboBox events
         new ItemListener() {
         // select shape's color
         public void itemStateChanged(ItemEvent event) {
         if(event.getStateChange() == ItemEvent.SELECTED)
         // call DrawPanel method setForeground
         // and pass an element value of colors array
         myPanel.setForeground(colors[colorComboBox.getSelectedIndex()]);
    myPanel.draw();
    }// end anonymous inner class
    ); // end call to addItemListener
    // set up panel containing buttons
         buttonPanel = new JPanel();
    buttonPanel.setLayout(new GridLayout(4, 1, 0, 50));
         buttonPanel.add(showButton);
    buttonPanel.add(colorComboBox);
    JPanel radioButtonPanel = new JPanel();
    radioButtonPanel.setLayout(new GridLayout(2, 1, 0, 20));
    Container container = getContentPane();
    container.setLayout(new BorderLayout(10,10));
    container.add(myPanel, BorderLayout.CENTER);
         container.add(buttonPanel, BorderLayout.EAST);
    setSize(500, 400);
         setVisible(true);
         public static void main(String args[]) {
         test application = new test();
         application.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    coding 2
    import java.awt.*;
    import javax.swing.*;
    public class DrawPanel extends JPanel {
         public final static int CIRCLE = 1, SQUARE = 2;
         private int shape;
         private boolean fill;
         private boolean showStatus;
    private int shapeSize = 100;
    private Color foreground;
         // draw a specified shape
    public void paintComponent (Graphics g){
              super.paintComponent(g);
              // find center
    int x=(getSize().width-shapeSize)/2;
              int y=(getSize().height-shapeSize)/2;
              if (shape == CIRCLE) {
         if (fill == true){
         g.setColor(foreground);
              g.fillOval(x, y, shapeSize, shapeSize);
    else{
                   g.setColor(foreground);
    g.drawOval(x, y, shapeSize, shapeSize);
              else if (shape == SQUARE){
         if (fill == true){
         g.setColor(foreground);
                        g.fillRect(x, y, shapeSize, shapeSize);
    else{
                        g.setColor(foreground);
    g.drawRect(x, y, shapeSize, shapeSize);
    // set showStatus value
    public void setShowStatus (boolean s) {
              showStatus = s;
         // return showstatus value
    public boolean getShowStatus () {
              return showStatus;
         // set fill value
    public void setFill(boolean isFill) {
              fill = isFill;
         // set shape value
    public void setShape(int shapeToDraw) {
              shape = shapeToDraw;
    // set shapeSize value
    public void setShapeSize(int newShapeSize) {
              shapeSize = newShapeSize;
    // set foreground value
    public void setForeground(Color newColor) {
              foreground = newColor;
         // repaint DrawPanel
    public void draw (){
              if(showStatus == true)
              repaint();

    Hello,
    does setSelectedIndex(int anIndex)
    do what you need?
    See Java Doc for JComboBox.

  • SBO 2005 combo box does not update value at first time

    Hi!I developed an addon for sbo 2004 with a combo box populated with the months of the year, and it works. The same code run on SBO 2005 works only after the second selection. Has anyone found the same problem?

    definition of the item:
    item = form.Items.Add("oMese", SAPbouiCOM.BoFormItemTypes.it_COMBO_BOX)
                    item.Left = 245
                    item.Top = 5
                    item.Width = 80
                    item.DisplayDesc = True
                    combo = item.Specific
                    combo.DataBind.SetBound(True, "", "uMese")
                    combo.ValidValues.Add(1, "Gennaio")
                    combo.ValidValues.Add(2, "Febbraio")
    event handling:
    inside ItemEvent in case the item is selected
    Case SAPbouiCOM.BoEventTypes.et_COMBO_SELECT
                        Select Case pVal.FormUID
                            Case "PRG_UFM_0002_RegIVAAcq"
                                retCode = oTy_RACQ.FormComboSelect(pVal, BubbleEvent)
      Public Shared Function FormComboSelect(ByVal pVal As SAPbouiCOM.ItemEvent, _
                                               ByRef BubbleEvent As Boolean, _
                                               ByRef funCaller As Object, _
                                               ByVal funCallerID As Integer, _
                                               ByRef aForm As SAPbouiCOM.Form) _
                                               As Integer
            Dim msg As String
            Dim edt As SAPbouiCOM.EditText
            Dim cmb As SAPbouiCOM.ComboBox
            Dim obt As SAPbouiCOM.OptionBtn
            Dim cbx As SAPbouiCOM.CheckBox
            Dim mtx As SAPbouiCOM.Matrix
            Try
                If pVal.Before_Action = True Then
                    Select Case pVal.ItemUID
                        Case "oMese"
                            Dim stre As New strEstremi
                            cmb = aForm.Items.Item("oMese").Specific
                            edt = aForm.Items.Item("anno").Specific
                            If Not cmb.Selected Is Nothing Then
                                GetEstremiPeriod(edt.Value, cmb.Selected.Value, "M", stre)
                                edt = aForm.Items.Item("dtFrom").Specific
                                edt.String = stre.dtFrom
                                edt = aForm.Items.Item("dtTo").Specific
                                edt.String = stre.dtTo
                            End If
    end function
    thank you I hope is enough otherwise please tell me

  • Looping through an array to get the index for each measure in a combo box

    Hi folks,
    I am working on a web application that has two combo boxes, one for year (called yearcombo) and for measures (called myURL) for that selected year, and also two radiobuttons (in radioBtnGroup). I have two years and a bunch of measure for each year. I  have a map tool tip that when you mouse over the county you see a measure for that specific year. However I have a bunch of measures for each year and I want to be able to loop through the measures (which are in an array collection inside a combobox) so my "if" expression can find every selectedIndex and bring me the tool tip for that selected measure for that selected radio button. Right now I would have to create if statements for each measure (each selectedIndex inside the myURL combobox)and each radiobutton (inside the radioBtnGroup) instead of creating a if expression to get a map tip tool for each measure. I know I would have to create a loop to search for these indexes and enter that in the if expression and also change the graphic.attributes to reflect the right measure or index selected. Do you API for Flex wizards  can give me any tips on how to code this according to my code below ? Any  help is greatly appreciated! (the print scree is attached)
    Below is the code snippet:
    if (yearcombo.selectedItem.year == "2007" && myURL.selectedIndex == 0 && radioBtnGroup.selectedValue == 0)
    fLayer.definitionExpression = "DATA_YEAR_TXT like '2007'"
    var graphic:Graphic = Graphic(event.currentTarget);
    graphic.symbol = mouseOverSymbol;
    var htmlText:String = graphic.attributes.htmlText;
    var textArea:TextArea = new TextArea();
    try{
    textArea.htmlText = myURL.selectedItem.label + graphic.attributes.ForDirIndOut.toString()
    myMap.infoWindow.content=textArea
    myMap.infoWindow.label = graphic.attributes.NAME;
    myMap.infoWindow.closeButtonVisible = false;
    myMap.infoWindow.show(myMap.toMapFromStage(event.stageX, event.stageY));}
    catch(error:Error) {
    trace("Caught Error: "+error);
    And below is the combo boxes with the arrays
    <mx:FormItem label="Year        :"  >
    <mx:ComboBox   id="yearcombo" selectedIndex="0" labelField="label" width="100%" change="changeEvt(event)"  >
    <mx:ArrayCollection id="year"  >
    <fx:Object label="2007"  year="2007" />
    <fx:Object label="2009"  year="2009" />
    </mx:ArrayCollection>
    </mx:ComboBox>
    </mx:FormItem>
    <mx:FormItem label="Measure:">
    <mx:ComboBox   id="myURL" selectedIndex="8" width="80%" mouseOver="clickEv2(event)" close="closeHandler(event)">
    <mx:ArrayCollection id="measures"   >
    <fx:Object id="forindout07" labeltext="2007 Forestry Industry Output" label="Forestry Industry Output " value="RADIO_BUTTONS/TFEI_07_forest_industry_output" year="2007"  />
    <fx:Object id="foremp07" label="2007 Forestry Employment " value="RADIO_BUTTONS/TFEI_07_forest_employment" year="2007" />
    <fx:Object id="forlabinc07" label="2007 Forestry Labor Income " value="RADIO_BUTTONS/TFEI_07_forest_labincome" year="2007" />
    <fx:Object id="forindbustax07" label="2007 Forestry Indirect Business Tax" value="RADIO_BUTTONS/TFEI_07_forest_business_tax" year="2007" />
    <fx:Object id="forindout09" label="Forestry Industry Output " value="RADIO_BUTTONS/TFEI_09_forest_industry_output" year="2009"  />
    <fx:Object id="foremp09" label="2009 Forestry Employment " value="RADIO_BUTTONS/TFEI_09_forest_employment" year="2009" />
    <fx:Object id="forlabinc09" label="2009 Forestry Labor Income " value="RADIO_BUTTONS/TFEI_09_forest_labincome" year="2009" />
    <fx:Object id="forindbustax09" label="2009 Forestry Indirect Business Tax" value="RADIO_BUTTONS/TFEI_09_forest_business_tax" year="2009" />
    <fx:Object id="blank" label=" "  />
    </mx:ArrayCollection>

    And here is the entire code
    <?xml version="1.0" encoding="utf-8"?>
    <mx:Application       
                    xmlns:fx="http://ns.adobe.com/mxml/2009"
                    xmlns:s="library://ns.adobe.com/flex/spark"
                    xmlns:mx="library://ns.adobe.com/flex/mx"
                    xmlns:esri="http://www.esri.com/2008/ags"
                    paddingBottom="8" paddingLeft="8"
                    paddingRight="8" paddingTop="8"
                    backgroundColor="0xffffff"
                    layout="vertical" >
        <!-- Start Declarations -->
    <fx:Declarations>
            <esri:SimpleFillSymbol id="mouseOverSymbol" alpha="0.5" color="0x808080">
                <esri:SimpleLineSymbol width="0" color="#000000"/>
            </esri:SimpleFillSymbol>
            <esri:SimpleFillSymbol id="defaultsym" alpha="0.01" color="#E0E0E0"   >
                <esri:SimpleLineSymbol width="1" color="#000000"/>
            </esri:SimpleFillSymbol>
        <!-- End Declarations -->
    </fx:Declarations>
        <fx:Script>
            <![CDATA[
                import com.esri.ags.Graphic;
                import com.esri.ags.SpatialReference;
                import com.esri.ags.esri_internal;
                import com.esri.ags.events.GraphicEvent;
                import com.esri.ags.geometry.Extent;
                import com.esri.ags.layers.ArcGISDynamicMapServiceLayer;
                import com.esri.ags.symbols.SimpleFillSymbol;
                import com.esri.ags.symbols.SimpleLineSymbol;
                import flash.utils.flash_proxy;
                import mx.collections.ArrayCollection;
                import mx.controls.Alert;
                import mx.controls.RadioButton;
                import mx.controls.TextArea;
                import mx.events.DropdownEvent;
                import mx.events.ItemClickEvent;
                import mx.rpc.Fault;
                import mx.rpc.events.FaultEvent;
                import flash.display.Sprite;
                import flash.events.ErrorEvent;
                import flash.events.MouseEvent;
                private function closeHandler(evt:DropdownEvent):void {
                    myLabel.text = ComboBox(evt.target).selectedItem.labeltext;
                private function loadLayerName():void
                    myLegend.layers = null;
                    layerPanel.removeAllChildren();
                    //loop through each layer and add as a radiobutton
                    for(var i:uint = 0; i < (dynamicLayer.layerInfos.length); i++)
                        var radioBtn:RadioButton = new RadioButton;
                        radioBtn.groupName = "radioBtnGroup";
                        radioBtn.value = i;
                        radioBtn.label = dynamicLayer.layerInfos[i].name;
                        if (dynamicLayer.layerInfos[i].name == "Direct Impact (Million $)")
                            radioBtn.label = "Direct Impact";
                        else if (dynamicLayer.layerInfos[i].name == "Total Impact (Million $)")
                        {radioBtn.label = "Total Impact";
                        else if (dynamicLayer.layerInfos[i].name == "Total Impact (Jobs)")
                        {radioBtn.label = "Total Impact";
                        else if (dynamicLayer.layerInfos[i].name == "Direct Impact (Jobs)")
                        {radioBtn.label = "Direct Impact";
                        else
                        {radioBtn.visible= false;
                        layerPanel.addChild(radioBtn);
                    /*     myDividerBox.getDividerAt(0).visible = false; */
                    //set the visible layer the first radio button
                     radioBtnGroup.selectedValue = 0;
                     dynamicLayer.visibleLayers = new ArrayCollection([0]);
                    myLegend.layers = [dynamicLayer];
                    myLegend.visible = true;
                private function radioClickHandler(event:ItemClickEvent):void
                    myLegend.layers = null;
                    // update the visible layers to only show the layer selected
                    dynamicLayer.visibleLayers = new ArrayCollection([event.index]);
                    myLegend.layers = [dynamicLayer];
                private function changeEvt(event:Event):void {
                if (yearcombo.selectedItem.year == "2007")
                    measures.filterFunction=filter1
                    measures.refresh()
                    myURL.dataProvider=measures
                else if (yearcombo.selectedItem.year == "2009")
                    measures.filterFunction=filter2
                    measures.refresh();
            public function filter1(item:Object):Boolean
                if (item.year=="2007") return true
                else return false
                public function filter2(item:Object):Boolean
                    if (item.year=="2009") return true
                    else return false
                private function clickEvt(event:Event):void {
                    if (yearcombo.selectedItem.year == "2007")
                        measures.filterFunction=filter3
                        measures.refresh()
                        myURL.dataProvider=measures
                    else if (yearcombo.selectedItem.year == "2009")
                        measures.filterFunction=filter4
                        measures.refresh();
                public function filter3(item:Object):Boolean
                    if (item.year=="2007") return true
                    else return false
                public function filter4(item:Object):Boolean
                    if (item.year=="2009") return true
                    else return false
                private function clickEv2(event:Event):void {
                    if (yearcombo.selectedItem.year == "2007")
                        measures.filterFunction=filter5
                        measures.refresh()
                    else if (yearcombo.selectedItem.year == "2009")
                        measures.filterFunction=filter6
                        measures.refresh();
                    else if (yearcombo.selectedItem.year == 2007 && myURL.selectedIndex==8)
                        myLegend.layers = null;
                        layerPanel.removeAllChildren();
                public function filter5(item:Object):Boolean
                    if (item.year=="2007") return true
                    else return false
                public function filter6(item:Object):Boolean
                    if (item.year=="2009") return true
                    else return false
                /* IF YOU WANT TO INCLUDE OTHER VALUES IN THE MAP TOOLTIP LIKE COUNTY NAME AND THE LABEL OF THE SELECTED ITEM
                if (myURL.selectedIndex==0)
                myTextArea.htmlText = "<b>County: </b>" + gr.attributes.NAME + "\n"
                + "<b>Measure: </b>" + myURL.selectedItem.label + gr.attributes.ForDirIndOut.toString()
                public function fLayer_graphicAddHandler(event:GraphicEvent):void
                    event.graphic.addEventListener(MouseEvent.MOUSE_OVER, onMouseOverHandler);
                    event.graphic.addEventListener(MouseEvent.MOUSE_OUT, onMouseOutHandler);
                public function onMouseOverHandler(event:MouseEvent):void
                    if (yearcombo.selectedItem.year == "2007" && myURL.selectedIndex == 0 && radioBtnGroup.selectedValue == 0)
                        fLayer.definitionExpression = "DATA_YEAR_TXT like '2007'"
                        var graphic:Graphic = Graphic(event.currentTarget);
                        graphic.symbol = mouseOverSymbol;
                        var htmlText:String = graphic.attributes.htmlText;
                        var textArea:TextArea = new TextArea();
                        try{
                        textArea.htmlText = myURL.selectedItem.label + graphic.attributes.ForDirIndOut.toString()
                        myMap.infoWindow.content=textArea
                        myMap.infoWindow.label = graphic.attributes.NAME;
                        myMap.infoWindow.closeButtonVisible = false;
                        myMap.infoWindow.show(myMap.toMapFromStage(event.stageX, event.stageY));}
                        catch(error:Error) {
                            trace("Caught Error: "+error);
                    if (yearcombo.selectedItem.year == "2007" && myURL.selectedIndex == 0 && radioBtnGroup.selectedValue == 1)
                        fLayer.definitionExpression = "DATA_YEAR_TXT like '2007'"
                        var graphic:Graphic = Graphic(event.currentTarget);
                        graphic.symbol = mouseOverSymbol;
                        var htmlText:String = graphic.attributes.htmlText;
                        var textArea:TextArea = new TextArea();
                        try{
                            textArea.htmlText = myURL.selectedItem.label + graphic.attributes.ForTotImpIndOut.toString()
                            myMap.infoWindow.content=textArea
                            myMap.infoWindow.label = graphic.attributes.NAME;
                            myMap.infoWindow.closeButtonVisible = false;
                            myMap.infoWindow.show(myMap.toMapFromStage(event.stageX, event.stageY));}
                        catch(error:Error) {
                            trace("Caught Error: "+error);
                    if (yearcombo.selectedItem.year == "2007" && myURL.selectedIndex == 1 && radioBtnGroup.selectedValue == 0)
                        fLayer.definitionExpression = "DATA_YEAR_TXT like '2007'"
                        var graphic:Graphic = Graphic(event.currentTarget);
                        graphic.symbol = mouseOverSymbol;
                        var htmlText:String = graphic.attributes.htmlText;
                        var textArea:TextArea = new TextArea();
                        try{
                            textArea.htmlText = myURL.selectedItem.label + graphic.attributes.ForDirEmp.toString()
                            myMap.infoWindow.content=textArea
                            myMap.infoWindow.label = graphic.attributes.NAME;
                            myMap.infoWindow.closeButtonVisible = false;
                            myMap.infoWindow.show(myMap.toMapFromStage(event.stageX, event.stageY));}
                        catch(error:Error) {
                            trace("Caught Error: "+error);
                    if (yearcombo.selectedItem.year == "2007" && myURL.selectedIndex == 1 && radioBtnGroup.selectedValue == 1)
                        fLayer.definitionExpression = "DATA_YEAR_TXT like '2007'"
                        var graphic:Graphic = Graphic(event.currentTarget);
                        graphic.symbol = mouseOverSymbol;
                        var htmlText:String = graphic.attributes.htmlText;
                        var textArea:TextArea = new TextArea();
                        try{
                            textArea.htmlText = myURL.selectedItem.label + graphic.attributes.ForTotImpEmp.toString()
                            myMap.infoWindow.content=textArea
                            myMap.infoWindow.label = graphic.attributes.NAME;
                            myMap.infoWindow.closeButtonVisible = false;
                            myMap.infoWindow.show(myMap.toMapFromStage(event.stageX, event.stageY));}
                        catch(error:Error) {
                            trace("Caught Error: "+error);
                    if (yearcombo.selectedItem.year == "2007" && myURL.selectedIndex == 2 && radioBtnGroup.selectedValue == 0)
                        fLayer.definitionExpression = "DATA_YEAR_TXT like '2007'"
                        var graphic:Graphic = Graphic(event.currentTarget);
                        graphic.symbol = mouseOverSymbol;
                        var htmlText:String = graphic.attributes.htmlText;
                        var textArea:TextArea = new TextArea();
                        try{
                            textArea.htmlText = myURL.selectedItem.label + graphic.attributes.ForDirLabInc.toString()
                            myMap.infoWindow.content=textArea
                            myMap.infoWindow.label = graphic.attributes.NAME;
                            myMap.infoWindow.closeButtonVisible = false;
                            myMap.infoWindow.show(myMap.toMapFromStage(event.stageX, event.stageY));}
                        catch(error:Error) {
                            trace("Caught Error: "+error);
                    if (yearcombo.selectedItem.year == "2007" && myURL.selectedIndex == 2 && radioBtnGroup.selectedValue == 1)
                        fLayer.definitionExpression = "DATA_YEAR_TXT like '2007'"
                        var graphic:Graphic = Graphic(event.currentTarget);
                        graphic.symbol = mouseOverSymbol;
                        var htmlText:String = graphic.attributes.htmlText;
                        var textArea:TextArea = new TextArea();
                        try{
                            textArea.htmlText = myURL.selectedItem.label + graphic.attributes.ForTotImpLabInc.toString()
                            myMap.infoWindow.content=textArea
                            myMap.infoWindow.label = graphic.attributes.NAME;
                            myMap.infoWindow.closeButtonVisible = false;
                            myMap.infoWindow.show(myMap.toMapFromStage(event.stageX, event.stageY));}
                        catch(error:Error) {
                            trace("Caught Error: "+error);
                    if (yearcombo.selectedItem.year == "2007" && myURL.selectedIndex == 3 )
                        fLayer.definitionExpression = "DATA_YEAR_TXT like '2007'"
                        var graphic:Graphic = Graphic(event.currentTarget);
                        graphic.symbol = mouseOverSymbol;
                        var htmlText:String = graphic.attributes.htmlText;
                        var textArea:TextArea = new TextArea();
                        try{
                            textArea.htmlText = myURL.selectedItem.label + graphic.attributes.ForIndirBusTax.toString()
                            myMap.infoWindow.content=textArea
                            myMap.infoWindow.label = graphic.attributes.NAME;
                            myMap.infoWindow.closeButtonVisible = false;
                            myMap.infoWindow.show(myMap.toMapFromStage(event.stageX, event.stageY));}
                        catch(error:Error) {
                            trace("Caught Error: "+error);
                    if (yearcombo.selectedItem.year == "2009" && myURL.selectedIndex == 0 && radioBtnGroup.selectedValue == 0)
                        fLayer.definitionExpression = "DATA_YEAR_TXT like '2009'"
                        var graphic:Graphic = Graphic(event.currentTarget);
                        graphic.symbol = mouseOverSymbol;
                        var htmlText:String = graphic.attributes.htmlText;
                        var textArea:TextArea = new TextArea();
                        try{
                            textArea.htmlText = myURL.selectedItem.label + graphic.attributes.ForDirIndOut.toString()
                            myMap.infoWindow.content=textArea
                            myMap.infoWindow.label = graphic.attributes.NAME;
                            myMap.infoWindow.closeButtonVisible = false;
                            myMap.infoWindow.show(myMap.toMapFromStage(event.stageX, event.stageY));}
                        catch(error:Error) {
                            trace("Caught Error: "+error);
                    if (yearcombo.selectedItem.year == "2009" && myURL.selectedIndex == 0 && radioBtnGroup.selectedValue == 1)
                        fLayer.definitionExpression = "DATA_YEAR_TXT like '2009'"
                        var graphic:Graphic = Graphic(event.currentTarget);
                        graphic.symbol = mouseOverSymbol;
                        var htmlText:String = graphic.attributes.htmlText;
                        var textArea:TextArea = new TextArea();
                        try{
                            textArea.htmlText = myURL.selectedItem.label + graphic.attributes.ForTotImpIndOut.toString()
                            myMap.infoWindow.content=textArea
                            myMap.infoWindow.label = graphic.attributes.NAME;
                            myMap.infoWindow.closeButtonVisible = false;
                            myMap.infoWindow.show(myMap.toMapFromStage(event.stageX, event.stageY));}
                        catch(error:Error) {
                            trace("Caught Error: "+error);
                    if (yearcombo.selectedItem.year == "2009" && myURL.selectedIndex == 1 && radioBtnGroup.selectedValue == 0)
                        fLayer.definitionExpression = "DATA_YEAR_TXT like '2009'"
                        var graphic:Graphic = Graphic(event.currentTarget);
                        graphic.symbol = mouseOverSymbol;
                        var htmlText:String = graphic.attributes.htmlText;
                        var textArea:TextArea = new TextArea();
                        try{
                            textArea.htmlText = myURL.selectedItem.label + graphic.attributes.ForDirEmp.toString()
                            myMap.infoWindow.content=textArea
                            myMap.infoWindow.label = graphic.attributes.NAME;
                            myMap.infoWindow.closeButtonVisible = false;
                            myMap.infoWindow.show(myMap.toMapFromStage(event.stageX, event.stageY));}
                        catch(error:Error) {
                            trace("Caught Error: "+error);
                    if (yearcombo.selectedItem.year == "2009" && myURL.selectedIndex == 1 && radioBtnGroup.selectedValue == 1)
                        fLayer.definitionExpression = "DATA_YEAR_TXT like '2009'"
                        var graphic:Graphic = Graphic(event.currentTarget);
                        graphic.symbol = mouseOverSymbol;
                        var htmlText:String = graphic.attributes.htmlText;
                        var textArea:TextArea = new TextArea();
                        try{
                            textArea.htmlText = myURL.selectedItem.label + graphic.attributes.ForTotImpEmp.toString()
                            myMap.infoWindow.content=textArea
                            myMap.infoWindow.label = graphic.attributes.NAME;
                            myMap.infoWindow.closeButtonVisible = false;
                            myMap.infoWindow.show(myMap.toMapFromStage(event.stageX, event.stageY));}
                        catch(error:Error) {
                            trace("Caught Error: "+error);
                    if (yearcombo.selectedItem.year == "2009" && myURL.selectedIndex == 2 && radioBtnGroup.selectedValue == 0)
                        fLayer.definitionExpression = "DATA_YEAR_TXT like '2009'"
                        var graphic:Graphic = Graphic(event.currentTarget);
                        graphic.symbol = mouseOverSymbol;
                        var htmlText:String = graphic.attributes.htmlText;
                        var textArea:TextArea = new TextArea();
                        try{
                            textArea.htmlText = myURL.selectedItem.label + graphic.attributes.ForDirLabInc.toString()
                            myMap.infoWindow.content=textArea
                            myMap.infoWindow.label = graphic.attributes.NAME;
                            myMap.infoWindow.closeButtonVisible = false;
                            myMap.infoWindow.show(myMap.toMapFromStage(event.stageX, event.stageY));}
                        catch(error:Error) {
                            trace("Caught Error: "+error);
                    if (yearcombo.selectedItem.year == "2009" && myURL.selectedIndex == 2 && radioBtnGroup.selectedValue == 1)
                        fLayer.definitionExpression = "DATA_YEAR_TXT like '2009'"
                        var graphic:Graphic = Graphic(event.currentTarget);
                        graphic.symbol = mouseOverSymbol;
                        var htmlText:String = graphic.attributes.htmlText;
                        var textArea:TextArea = new TextArea();
                        try{
                            textArea.htmlText = myURL.selectedItem.label + graphic.attributes.ForTotImpLabInc.toString()
                            myMap.infoWindow.content=textArea
                            myMap.infoWindow.label = graphic.attributes.NAME;
                            myMap.infoWindow.closeButtonVisible = false;
                            myMap.infoWindow.show(myMap.toMapFromStage(event.stageX, event.stageY));}
                        catch(error:Error) {
                            trace("Caught Error: "+error);
                    if (yearcombo.selectedItem.year == "2009" && myURL.selectedIndex == 3 )
                        fLayer.definitionExpression = "DATA_YEAR_TXT like '2009'"
                        var graphic:Graphic = Graphic(event.currentTarget);
                        graphic.symbol = mouseOverSymbol;
                        var htmlText:String = graphic.attributes.htmlText;
                        var textArea:TextArea = new TextArea();
                        try{
                            textArea.htmlText = myURL.selectedItem.label + graphic.attributes.ForIndirBusTax.toString()
                            myMap.infoWindow.content=textArea
                            myMap.infoWindow.label = graphic.attributes.NAME;
                            myMap.infoWindow.closeButtonVisible = false;
                            myMap.infoWindow.show(myMap.toMapFromStage(event.stageX, event.stageY));}
                        catch(error:Error) {
                            trace("Caught Error: "+error);
                public function onMouseOutHandler(event:MouseEvent):void
                    var gr:Graphic = Graphic(event.target);
                    gr.symbol = defaultsym;
                    myMap.infoWindow.hide();
            ]]>
        </fx:Script>
        <fx:Style>
            @namespace esri "http://www.esri.com/2008/ags";
            @namespace s "library://ns.adobe.com/flex/spark";
            @namespace mx "library://ns.adobe.com/flex/mx";
            @namespace esri "http://www.esri.com/2008/ags";
            @namespace components "com.esri.ags.components.*";
            components|InfoWindow
                content-background-alpha : 0.4;
                background-color : #4A7138;
                background-alpha : 0.7;
                border-style : solid;
        </fx:Style>
        <mx:HBox   width="930" height="800"  id="mapHbox"  horizontalAlign="center" >   
        <mx:HBox width="80">
        </mx:HBox>
        <mx:HBox id="myHBox" width="800" height="600" backgroundColor="0xffffff"  >
            <mx:VBox  height="590" width="358"  >
            <!--    <mx:Panel
                    width="356" height="100%"
                    color="0x000000"
                    borderAlpha="0.15"
                    >
                    -->
                    <mx:Canvas height="100%" width="100%" backgroundColor="0xffffff" >
                        <esri:Map id="myMap" openHandCursorVisible="false"
                                  height="100%" 
                                  logoVisible="false"
                                  doubleClickZoomEnabled="false"
                                  scrollWheelZoomEnabled="false"
                                  zoomSliderVisible="false"
                                  scaleBarVisible="false" scale="4000000" >
                            <esri:extent>
                                <esri:Extent xmin="-10736651.061900" ymin="4024099.909700" xmax="-10409195.669800" ymax="3440153.831100"      >
                                    <esri:SpatialReference wkid="102100"/>
                                </esri:Extent>
                            </esri:extent>
                            <esri:ArcGISDynamicMapServiceLayer id="dynamicLayer2"
                                                               url="http://tfs-24279/ArcGIS/rest/services/RADIO_BUTTONS/counties_layer/MapServer" />
                            <esri:ArcGISDynamicMapServiceLayer id="dynamicLayer" name=" "
                                                               alpha="1"
                                                               load="loadLayerName()"
                                                       url="http://tfs-24279/ArcGIS/rest/services/{myURL.selectedItem.value}/MapServer"   />
                            <esri:FeatureLayer id="fLayer"
                                               graphicAdd="fLayer_graphicAddHandler(event)"
                                               mode="snapshot"
                                               outFields="*"
                                               symbol="{defaultsym}"
                                               url= "http://tfs-24279/ArcGIS/rest/services/RADIO_BUTTONS/feature_layer_0709_five/FeatureServer/ 0" />
                        </esri:Map>
                    </mx:Canvas>
            <!--    </mx:Panel>-->
            </mx:VBox>       
            <mx:VBox  height="590" width="20"  >
            </mx:VBox>       
            <mx:Canvas height="500" width="400" backgroundColor="0xffffff"
                       horizontalScrollPolicy="off"
                       verticalScrollPolicy="off" >
                <mx:VBox  width="420" height="50%" paddingLeft="5" paddingTop="10" paddingRight="10" paddingBottom="10"
                         verticalGap="8">
                    <mx:Form  >
                        <mx:FormItem label="Year        :"  >
                            <mx:ComboBox   id="yearcombo" selectedIndex="0" labelField="label" width="100%" change="changeEvt(event)"  >
                                <mx:ArrayCollection id="year"  >
                                    <fx:Object label="2007"  year="2007" />
                                    <fx:Object label="2009"  year="2009" />
                                </mx:ArrayCollection>
                            </mx:ComboBox>
                        </mx:FormItem>
                        <mx:FormItem label="Measure:">
                            <mx:ComboBox   id="myURL" selectedIndex="8" width="80%" mouseOver="clickEv2(event)" close="closeHandler(event)">
                            <mx:ArrayCollection id="measures"   >
                                <fx:Object id="forindout07" labeltext="Forestry Industry Output" label="Forestry Industry Output " value="RADIO_BUTTONS/TFEI_07_forest_industry_output" year="2007"  />
                                <fx:Object id="foremp07" label="Forestry Employment " value="RADIO_BUTTONS/TFEI_07_forest_employment" year="2007" />
                                <fx:Object id="forlabinc07" label="Forestry Labor Income " value="RADIO_BUTTONS/TFEI_07_forest_labincome" year="2007" />
                                <fx:Object id="forindbustax07" label="Forestry Indirect Business Tax" value="RADIO_BUTTONS/TFEI_07_forest_business_tax" year="2007" />
                                <fx:Object id="forindout09" label="Forestry Industry Output " value="RADIO_BUTTONS/TFEI_09_forest_industry_output" year="2009"  />
                                <fx:Object id="foremp09" label="Forestry Employment " value="RADIO_BUTTONS/TFEI_09_forest_employment" year="2009" />
                                <fx:Object id="forlabinc09" label="Forestry Labor Income " value="RADIO_BUTTONS/TFEI_09_forest_labincome" year="2009" />
                                <fx:Object id="forindbustax09" label="Forestry Indirect Business Tax" value="RADIO_BUTTONS/TFEI_09_forest_business_tax" year="2009" />
                                <fx:Object id="blank" label=" "  />
                            </mx:ArrayCollection>
                        </mx:ComboBox>
                        </mx:FormItem>
                    </mx:Form>
                    <mx:VBox  id="layerPanel" width="50%" height="8%" verticalGap="3" paddingLeft="17">
                        <mx:RadioButtonGroup id="radioBtnGroup" itemClick="radioClickHandler(event)"  />
                    </mx:VBox>
                    <mx:VBox paddingLeft="17" height="50%" >
                    <mx:Canvas  id="legendPanel" width="100%"  >
                        <mx:Label id="myLabel" text=" " fontWeight="bold" />
                        <esri:Legend id="myLegend"
                                     layers="{[dynamicLayer]}"
                                     map="{myMap}" visible="false"
                                     respectCurrentMapScale="false"/>
                    </mx:Canvas>
                    <mx:TextArea width="275"  borderAlpha="0" height="200"  >
                        <mx:htmlText   >
                            <![CDATA[<font size='11'><b>Note:</b> Counties in white indicate either no data is available for that measure or the data has been supressed due to confidentiality.</font>
                            ]]>
                        </mx:htmlText>
                    </mx:TextArea>
                    </mx:VBox>   
                </mx:VBox>
            </mx:Canvas>
        </mx:HBox>
        </mx:HBox>   
    </mx:Application>

  • How to display data in a grid after selecting topic from combo box?

    could someone help me out? i'm displaying a combo box (about
    20 items) vertically. when user selects one of these items, i'd
    like for information regarding that choice to be displayed in my
    data grid. thanks - Karl from Kansas

    If you have the following:
    <mx:ComboBox id="combo_box" dataProvider="{users}"
    labelField="user_name" change="show_details(event)"
    ></mx:ComboBox>
    <mx:DataGrid id="data_grid" >
    <mx:columns>
    <mx:DataGridColumn headerText="Name"
    dataField="user_name"/>
    <mx:DataGridColumn headerText="email"
    dataField="email"/>
    </mx:columns>
    </mx:DataGrid>
    private function show_details(evt:Event):void {
    data_grid.dataProvider = evt.currentTarget.selectedItem
    This assumes that your combo box data has a user_name and
    email property value. Substitute your property values where needed.
    Vygo

Maybe you are looking for