Combobox and datagrid

Hi all !
I have a proplem which i don't solve .
Can You help me ?and
Could you rewritten code for me ?
  oItem = oForm.Items.Add("MyGrid", SAPbouiCOM.BoFormItemTypes.it_GRID)
        ' Set the grid dimentions and position
        oItem.Left = 20
        oItem.Top = 60
        oItem.Width = 650
        oItem.Height = 300
        oGrid = oItem.Specific
        oForm.DataSources.DataTables.Add("MyDataTable")
oForm.DataSources.DataTables.Item(0).ExecuteQuery("select U_NameChild,U_Birthdate,U_*** from OHEM where EmpID='" & EmplID & "'")
        oGrid.DataTable = oForm.DataSources.DataTables.Item("MyDataTable")
        oGrid.Columns.Item(0).Width = 50
        oGrid.Columns.Item(1).Width = 60
        oGrid.Columns.Item(2).Width = 130
        oGrid = oGrid.Columns.Item("U_***")
        oGrid.Type = SAPbouiCOM.BoGridColumnType.gct_ComboBox
        Dim oComboBoxColumn As SAPbouiCOM.ComboBoxColumn
        oComboBoxColumn = New SAPbouiCOM.ComboBoxColumn
        oComboBoxColumn = oGrid.Columns.Item("U_***")
        oComboBoxColumn.ValidValues.Add("1", "Nam")
        oComboBoxColumn.ValidValues.Add("2", "Nu")
URL=http://imageshack.usIMGhttp://img101.imageshack.us/img101/3803/huynhade1.png[/IMG][/url]

Dear Nguyen,
my sample code is as follows, and has been tested, works well.
        oItem = oFirstForm.Items.Add("MyGrid", SAPbouiCOM.BoFormItemTypes.it_GRID)
        ' Set the grid dimentions and position
        oItem.Left = 20
        oItem.Top = 60
        oItem.Width = 650
        oItem.Height = 300
        oGrid = oItem.Specific
        oFirstForm.DataSources.DataTables.Add("MyDataTable")
        oFirstForm.DataSources.DataTables.Item(0).ExecuteQuery("select CardCode, CardType, u_sdn from OCRD")
        oGrid.DataTable = oFirstForm.DataSources.DataTables.Item("MyDataTable")
        oGrid.Columns.Item(0).Width = 50
        oGrid.Columns.Item(1).Width = 60
        oGrid.Columns.Item(2).Width = 60
        oGrid.Columns.Item(2).Type = SAPbouiCOM.BoGridColumnType.gct_ComboBox
        Dim oComboBoxColumn As SAPbouiCOM.ComboBoxColumn
        oComboBoxColumn = oGrid.Columns.Item(2)
        oComboBoxColumn.ValidValues.Add("1", "today")
        oComboBoxColumn.ValidValues.Add("2", "tommorrow")

Similar Messages

  • Updating charts and datagrids based on selection

    I am trying to find some documentation and samples explaining how I can pick something in a combobox and have it populate a series of datagrids and charts.
    OUTLINE:
    A.  Using an XML table of all municipalities in our region populate a combobox.  Then have the user select the municipality they are interested in.
    B.Take a census table that is in XML format and by using HTTPServices read it into Flex and then based on what municipality the user selected populate a datagrid and variety of charts with data pertaining to the muni.
    I know it is done because I see it all the time and took a class last week where it was shown.  Unfortunately it was the last day of the class and time was running out so we just got a brief overview of this.
    I would greatly appriciate anyone who can point me to samples and documentation whether it be online or in books.  And I should mention that terminology is still an issue.  Am I attempting to do a custom event or what?
    The code below all works.  What I mean I am successfully populating the combobox and the datagrid with the appropriate data.  I am just not able to get the two communicating with each other.  In other words the datagrid is showing the entire table and ignoring the combobox.
    <?xml version="1.0" encoding="utf-8"?>
    <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
    layout="vertical"
    creationComplete="initApp()">
    <mx:Script>
      <![CDATA[
       import mx.rpc.events.*;
       import mx.controls.*;
       import mx.charts.*;
       import mx.collections.*;
       [Bindable]
       private var acMuni:ArrayCollection = new ArrayCollection;
       [Bindable]
       private var acCity:ArrayCollection = new ArrayCollection;
       private function initApp():void {
        muniHS.send();
        cityHS.send();
       private function eHandler(e:ResultEvent):void {
        acMuni = e.result.GetAllMUNIS.MUNIS;
       private function fHandler(e:FaultEvent):void {
        var faultInfo:String="fault code: "+ e.fault.faultCode +"\n\n";
        faultInfo+="fault string: "+e.fault.faultString+"\n\n";
        mx.controls.Alert.show(faultInfo,"Fault Information");
        var eventInfo:String="event target: "+e.target+"\n\n";
        eventInfo+="event type: "+e.type+"\n\n";
        mx.controls.Alert.show(eventInfo,"Event Information");
       private function eCityHandler(e:ResultEvent):void {
        this.acCity = e.result.GetCITIES.CITIES;
      ]]>
    </mx:Script>
    <mx:HTTPService id="muniHS"
      url="data/GetAllMunis.xml"
      result="eHandler(event)"
      fault="fHandler(event)"
      showBusyCursor="true"/>
    <mx:HTTPService id="cityHS"
      url="data/CityNames.xml"
      resultFormat="object"
      result="eCityHandler(event)"
      fault="fHandler(event)"
      showBusyCursor="true"/>
    <mx:Panel width="100%" height="50%"
      paddingBottom="10"
      paddingLeft="10"
      paddingRight="10"
      paddingTop="10" title="DataGrid">
    <mx:ComboBox id="muniCB"
      dataProvider="{acCity}"
      prompt="Select a Municipality"
      labelField="city"/>
      <mx:DataGrid id="dg"
       width="100%"
       height="100%"
       dataProvider="{acMuni}">
       <mx:columns>
        <mx:DataGridColumn headerText="municipality" dataField="city"/>
        <mx:DataGridColumn dataField="year"/>
        <mx:DataGridColumn headerText="month" dataField="month_no"/>
        <mx:DataGridColumn headerText="labor force" dataField="laborforce"/>
        <mx:DataGridColumn dataField="employed"/>
        <mx:DataGridColumn dataField="unemployed"/>
        <mx:DataGridColumn headerText="unemployment rate" dataField="unemp_rate"/>
        <mx:DataGridColumn headerText="tract" dataField="geogkey"/>
        <mx:DataGridColumn headerText="extended tract" dataField="geogkeyx"/>
       </mx:columns>
      </mx:DataGrid>
    </mx:Panel>
    </mx:Application>
    Thanks for any help you can provide
    Richard Krell

    If this post answers your querstion or helps, please mark it as such.
    First, use XMLListCollection for the data for the ConboBox and for the Muni result handler xlcMuni (instead of acMuni).
    Here is a simplified version of your app with the answer. It uses e4x syntax for filtering.
    http://livedocs.adobe.com/flex/3/html/help.html?content=13_Working_with_XML_03.html
    --------------- CityNames.xml ----------------
    <?xml version="1.0" encoding="utf-8"?>
    <CITIES>
      <city>Chicago</city>
      <city>New York</city>
      <city>Boston</city>
    </CITIES>
    ---------- GetAllMunis.xml ------------
    <?xml version="1.0" encoding="utf-8"?>
    <MUNIS>
      <muni>
        <city>Chicago</city>
        <year>1866</year>
      </muni>
      <muni>
        <city>New York</city>
        <year>1872</year>
      </muni>
      <muni>
        <city>Boston</city>
        <year>1756</year>
      </muni>
    </MUNIS>
    ------------- MainApp.mxml -------------------
    <?xml version="1.0" encoding="utf-8"?>
    <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
      creationComplete="muniHS.send();cityHS.send();">
      <mx:Script>
        <![CDATA[
          import mx.events.ListEvent;
          import mx.rpc.events.*;
          import mx.controls.*;
          import mx.charts.*;
          import mx.collections.*;
          [Bindable] private var xlcMuni:XMLListCollection = new XMLListCollection;
          [Bindable] private var xlcCity:XMLListCollection = new XMLListCollection;
          [Bindable] private var xlcDG:XMLListCollection = new XMLListCollection;
          private function eHandler(e:ResultEvent):void {
            this.xlcMuni = new XMLListCollection(e.result..muni);
          private function eCityHandler(e:ResultEvent):void {
            this.xlcCity = new XMLListCollection(e.result.city);
          private function populateDG(evt:ListEvent):void{
            var temp:XMLList = xlcMuni.copy();
            xlcDG = new XMLListCollection(temp.(city == ComboBox(evt.currentTarget).selectedItem));
        ]]>
      </mx:Script>
      <mx:HTTPService id="muniHS" resultFormat="e4x"
        url="data/GetAllMunis.xml" useProxy="false"
        result="eHandler(event)"/>
      <mx:HTTPService id="cityHS" url="data/CityNames.xml"
        resultFormat="e4x" result="eCityHandler(event)"/>
      <mx:Panel width="100%" height="50%" title="DataGrid">
        <mx:ComboBox id="muniCB" dataProvider="{xlcCity}"
          prompt="Select a Municipality" labelField="city"
          change="populateDG(event)"/>
        <mx:DataGrid id="dg" width="100%" height="100%"
          dataProvider="{xlcDG}">
          <mx:columns>
            <mx:DataGridColumn headerText="municipality" dataField="city"/>
            <mx:DataGridColumn dataField="year"/>
          </mx:columns>
        </mx:DataGrid>
      </mx:Panel>
    </mx:Application>

  • Combobox in Datagrid

    How do I get the combobox that is a renderer in a datagrid's
    column to show the value that correlates to the datagrid's
    dataprovider data?
    Here is the XML for the dataProvider of the datagrid:
    <items>
    <item>
    <productnumber>1</productnumber>
    <color>red</color>
    <price>12.00</price>
    </item>
    <item>
    <productnumber>2</productnumber>
    <color>blue</color>
    <price>15.00</price>
    </item>
    <item>
    <productnumber>3</productnumber>
    <color>white</color>
    <price>10.00</price>
    </item>
    </items>
    Here is the XML of the dataProvider for the combobox:
    <colors>
    <color>black</color>
    <color>green</color>
    <color>blue</color>
    <color>yellow</color>
    <color>white</color>
    <color>red</color>
    <color>gray</color>
    </colors>
    So in other words, the datagrid will show a row for each
    <item>, and the column that shows <color> is a
    combobox, and I want the combobox to be showing the correct
    <color> in the list of <colors>. I do know that the
    datagrid column for the combobox is an itemRenderer, but how do I
    get the combobox to set the right <color> with the
    dataProvider=<colors> ?
    Can someone please give me an example or point me to one?
    Thanks.

    "happybrowndog" <[email protected]> wrote in
    message
    news:gchuu5$e5a$[email protected]..
    > How do I get the combobox that is a renderer in a
    datagrid's column to
    > show the
    > value that correlates to the datagrid's dataprovider
    data?
    http://shigeru-nakagaki.com/index.cfm/2007/8/22/20070822-ComboBox-for-DataGrid-ItemEditor

  • Problem In Rendreing combobox in DataGrid

    Hi
         i am making a datagrid in which i am rendring a combobox and data provider of my data grid is xml type.The real trick is getting the XML file to be updated when changes to the itemRenderer(combobox) occurred.i am unable to reflect the changes on itemRendrer(combox) from updated xml dynamically.
    can any body guides me how to implement that feature.
    Thanks and regards
       Vineet Osho 

    hi
         i am attaching the code.it will updating the xml.on runtime i just want how to update the combobox when call the service again.for this i need id of combobx.so my problem is that i cant access my rendrer(combobox) from this.
    <root>
    <data>
      <expirationdate>10/13/2010</expirationdate>
      <ldfID>4292</ldfID>
      <effectivedate>10/13/2009</effectivedate>
      <customerpolicyID>1018</customerpolicyID>
      <priorcarriername>m</priorcarriername>
      <lastupdatetimestamp>02/11/2011</lastupdatetimestamp>
      <lossevaluationdate>10/13/2006</lossevaluationdate>
      <lastupdateuserID>13</lastupdateuserID>
      <noopen>no</noopen>
    </data>
    <data>
      <expirationdate>10/13/2009</expirationdate>
      <ldfID>4293</ldfID>
      <effectivedate>10/13/2008</effectivedate>
      <customerpolicyID>1018</customerpolicyID>
      <priorcarriername>m</priorcarriername>
      <lastupdatetimestamp>02/11/2011</lastupdatetimestamp>
      <lossevaluationdate>10/13/2006</lossevaluationdate>
      <lastupdateuserID>13</lastupdateuserID>
      <noopen>yes</noopen>
    </data>
    <data>
      <expirationdate>10/13/2008</expirationdate>
      <ldfID>4294</ldfID>
      <effectivedate>10/13/2007</effectivedate>
      <customerpolicyID>1018</customerpolicyID>
      <priorcarriername>m</priorcarriername>
      <lastupdatetimestamp>02/11/2011</lastupdatetimestamp>
      <lossevaluationdate>10/13/2006</lossevaluationdate>
      <lastupdateuserID>13</lastupdateuserID>
      <noopen>yes</noopen>
    </data>
    <data>
      <expirationdate>10/13/2007</expirationdate>
      <ldfID>4295</ldfID>
      <effectivedate>10/13/2006</effectivedate>
      <customerpolicyID>1018</customerpolicyID>
      <priorcarriername>m</priorcarriername>
      <lastupdatetimestamp>02/11/2011</lastupdatetimestamp>
      <lossevaluationdate>10/13/2006</lossevaluationdate>
      <lastupdateuserID>13</lastupdateuserID>
      <noopen>no</noopen>
    </data>
    <data>
      <expirationdate>10/13/2006</expirationdate>
      <ldfID>4296</ldfID>
      <effectivedate>10/13/2005</effectivedate>
      <customerpolicyID>1018</customerpolicyID>
      <priorcarriername>m</priorcarriername>
      <lastupdatetimestamp>02/11/2011</lastupdatetimestamp>
      <lossevaluationdate>10/13/2006</lossevaluationdate>
      <lastupdateuserID>13</lastupdateuserID>
      <noopen>yes</noopen>
    </data>
    </root>
    <?xml version="1.0" encoding="utf-8"?>
    <s: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" minWidth="955" minHeight="600"
                   creationComplete="init()" xmlns:local="*">
            <mx:DataGrid id="dgTest" editable="true"  y = "30"
                dataProvider = "{gridData.data}" width = "100%">
                <mx:columns>
                    <mx:DataGridColumn dataField = "lastupdateuserID" width = "80" headerText = "first"
                        sortable="false">
                        <mx:itemRenderer>
                            <fx:Component>
                                <mx:TextInput  width = "100"/>
                            </fx:Component>
                        </mx:itemRenderer>
                    </mx:DataGridColumn>
                    <mx:DataGridColumn  width = "80" headerText = "second" editable="false">
                        <mx:itemRenderer>
                            <fx:Component>
                                <mx:Box>
                                    <fx:Script>
                                        <![CDATA[
                                            import mx.controls.Alert;
                                            public function populateArray(str:String):void{
                                                outerDocument.arrTemp[outerDocument.dgTest.selectedIndex] = str;
                                                outerDocument.xmlGenrate();
                                            public function onCreate():void{
                                                cmbChange.dataProvider = outerDocument.xml.node;
                                        ]]>
                                    </fx:Script>
                                    <mx:ComboBox  id="cmbChange" height="50%" width="50%"
                                        creationComplete="onCreate()"
                                          change="populateArray(cmbChange.selectedItem+'')">
                                    </mx:ComboBox>
                                </mx:Box>
                            </fx:Component>
                        </mx:itemRenderer>
                    </mx:DataGridColumn>
                </mx:columns>
            </mx:DataGrid> 
        <s:Button id="btnSave" label="Save" click="test()"/>
        <fx:Declarations>
            <s:HTTPService id="httpTest" resultFormat="e4x" result="resulthandler(event)" fault=";"/>
        </fx:Declarations>
        <fx:Script>
            <![CDATA[
                import mx.collections.ArrayCollection;
                import mx.events.ChildExistenceChangedEvent;
                import mx.controls.Alert;
                import mx.controls.CheckBox;
                import mx.events.ListEvent;
                import mx.rpc.events.ResultEvent;
                import mx.utils.ObjectUtil;
                import spark.components.ComboBox;
                import spark.components.TextInput;
                import spark.components.supportClasses.ItemRenderer;
                [Bindable]
                public var xml:XML = new XML(<root>
                                        <node>yes</node>
                                        <node>no</node>
                                        </root>);
                [Bindable]
                public var arrTemp:Array =[];
                private var req_XML:XML;
                [Bindable]
                private var gridData:XML;
                private function endHandler(ev:DataEvent):void{
                    Alert.show("Hello");
                public function xmlGenrate():void{
                    var obj:XML = gridData;
                    var temp:XMLList = obj.data.children();
                        var i :int = 0;
                        for(var a:int=0;a < temp.length(); a++){
                            var str1:String = temp[a].localName();
                                var str:XML=createXml(i);
                                if(str1 == 'noopen'){
                                    delete gridData.data.noopen[i];
                                    gridData.data[i].insertChildAfter(gridData.data.lastupdateuserID[i],str);
                                    if(i==gridData.data.length()-1){
                                        return ;
                                    else{
                                        i++;
                                if(obj.data[i].toString().indexOf('noopen')==-1){
                                    gridData.data[i].insertChildAfter(gridData.data.lastupdateuserID[i],str);
                                    if(i==gridData.data.length()-1){
                                        return ;
                                    else{
                                        i++;
                private function createXml(i:int):XML{
                    if(arrTemp[i] == 'null'){
                        req_XML = <noopen></noopen>;
                    else{
                        req_XML = <noopen>{arrTemp[i].toString()}</noopen>;
                    return req_XML;
                private function init():void{
                    httpTest.url = 'data.xml';
                    httpTest.send();
                private function resulthandler(ev:ResultEvent):void{
                    gridData = ev.result as XML;
                    for(var i:int =0;i<gridData.data.length();i++){
                        arrTemp[i] = gridData.data[i].noopen;
                public function test():void{
                    Alert.show(gridData.data+'');
            ]]>
        </fx:Script>
    </s:Application>

  • Combobox as Datagrid Item editor

    Hi there, i'm trying to use a combobox as an itemEditor for a datagridcolumn, and i'm having some difficulties in doing this.
    I'm using the code below to define the column, so far so good the itemeditor appears and selects the item accordingly to the value of the datafield.
    My problem is, if I open the combobox and do not choose none of the items, the value that passes to the datagrid is 0, but i want to pass the old value. So that the value remains the same.
    the dataprodiver for the combobox is this one (rows from database)
    id description
    1     xxxxx
    2     yyyyy
    the datafield banda_horaria_id holds an integer witch match one of the values above.
    Can anyone help me, and tell me what should i do to maintain the value if none of the combobox items is selected.
    Thanks in advance.
    PlumbSoldier
    <mx:DataGridColumn headerText="Banda Horária" dataField="banda_horaria_id" id="bandaHoraria"
                            rendererIsEditor="false" editorDataField="selectedItem" >
                            <mx:itemEditor>
                                <mx:Component>
                                    <mx:ComboBox initialize="outerDocument.cbBandaHoraria(event)"
                                            fontWeight="normal" labelField="descricao"  >
                                        <mx:Script>
                                            <![CDATA[
                                            import mx.controls.DataGrid;
                                            private var columnDataField:String;
                                            private var dtGrid:DataGrid;
                                                 override public function set data(value:Object):void
                                                    dtGrid=listData.owner as DataGrid;
                                                    columnDataField=dtGrid.columns[listData.columnIndex].dataField;
                                                    super.data = value;
                                                    if (value != null)
                                                        var len:int = this.dataProvider.length;
                                                        for (var i:int = 0; i < len; i++)
                                                            if (this.dataProvider[i].id == value[columnDataField])
                                                                this.selectedIndex = i;
                                                                break;
                                                public function onChange():void
                                                    var index:int = this.selectedIndex;
                                                    if (index !=-1){
                                                    id = this.dataProvider[index].id;
                                                    }  else{
                                                        var len:int = this.dataProvider.length;
                                                        for (var i:int = 0; i < len; i++)
                                                            if (this.dataProvider[i].id == data[columnDataField])
                                                                this.selectedIndex = i;
                                                                break;
                                            ]]>
                                        </mx:Script>
                                    </mx:ComboBox>
                                </mx:Component>
                            </mx:itemEditor>
                        </mx:DataGridColumn>

    Thanks for your help rgadiparthi , but that didn't helped me.
    But i managed to solve my problem.

  • ComboBox and TextInput

    I have to add a change event listener... 
    I did add one something like this.... 
    Private function Change(event:Event):void{
          inputtxt.txt+=event.currentTarget.selectedIndex;
          vs.selectedChild=vsRef;
    <mx:TextInput id="inputtxt"/>
    <mx:Button id="searchBtn" label="Search" change="Change(event)"/>
    ***This does nothing for me though***
    OR
    [Bindable] public var Emp:String;
    [Bindable] public var ary:Array = ["Emp name", "Emp number", "Emp id"];
    This is my combobox array now I have a text box next it, so that the user can enter name, number or id...
    What should be in my change function?, I have:
    private function change():void{
              if  (cb.selectedIndex==0)
                   Emp=cb.selectedItem
              else if (cbEmp.selectedIndex==1)
                   Emp=????
              else
                   Emp=????
    <mx:ComboBox id="cb" dataProvider="{ary}"/>
    and how do I store what user has enter....
    which one is the right approach and how will they work... I'm just a little confused....
    Thanks...

    can you show me how to incorporate valueCommit with TextInput, combobox and search and I do have to search based on what the used enter...
    So if I have
    <mx:Script>
    <![CDATA[
    [Bindable] public var Emp:String;
    [Bindable] public var ary:Array = ["Emp name", "Emp number", "Emp id"];
    ]]>
    </mx:Script>
    <mx:ComboBox id="cb" dataProvider="{ary}"/>
    <mx:TextInput id="inputtxt"/>
    <mx:Button id="searchBtn" label="Search"/>
    <mx:ViewStack id="vs">
    <src:Ref id="vsRef"/>
    </mx:ViewStack>
    Now what I want to do is when the user enter either Employee Name or Number or ID in the textInput box next to the combobox filter based on what is selected in combobox (name, number or id) I have to bring up the viewstack which shows the datagrid with data based on what the user has input...
    Can anyone help me with how do I incoprporate valueCommit or cb.selectedItem....
    I'll really appreciate that.
    Thanks...

  • Castom ComboBox and lose binding

    Hello. I'm trying to write my own ComboBox and I ran into a problem.
    public class TestComboBox : ComboBox
    public static readonly DependencyProperty SelectedCarProperty = DependencyProperty.Register("SelectedCar", typeof(string), typeof(TestComboBox), new FrameworkPropertyMetadata(null, OnSelectedCarPropertyChanged));
    public TestComboBox()
    this.Cars = new ObservableCollection<string>() { "Select Car", "BMW", "Mersedes", "Audi" };
    this.ItemsSource = this.Cars;
    this.SelectedItem = this.Cars[0];
    public string SelectedCar
    get { return (string)GetValue(SelectedCarProperty); }
    set { this.SetValue(SelectedCarProperty, value); }
    public IList<string> Cars { get; private set; }
    protected override void OnSelectionChanged(SelectionChangedEventArgs e)
    base.OnSelectionChanged(e);
    this.SelectedCar = (string)SelectedItem;
    private static void OnSelectedCarPropertyChanged(DependencyObject source, DependencyPropertyChangedEventArgs e)
    var car = (string)e.NewValue;
    var editor = (TestComboBox)source;
    editor.SelectedItem = car;
    When I try to install the default value, I lose the binding. If I commented this code, everything works fine.
    this.SelectedItem = this.Cars[0];
    How can I set the default value without losing binding to the VM
    P.S
    TestApp

    I use this code.
    <propgrid:PropertyGrid Margin="0,0,11,7">
    <propgrid:PropertyGrid.Items>
    <propgrid:PropertyGridCategoryItem DisplayName="Main">
    <propgrid:PropertyGridPropertyItem Value="{Binding Car, Mode=TwoWay}"
    DisplayName="Car">
    <propgrid:PropertyGridPropertyItem.ValueTemplate>
    <DataTemplate>
    <wpfApplication1:TestComboBox SelectedCar="{Binding Value, Mode=TwoWay, RelativeSource={RelativeSource AncestorType={x:Type propgrid:IPropertyDataAccessor}}}" />
    </DataTemplate>
    </propgrid:PropertyGridPropertyItem.ValueTemplate>
    </propgrid:PropertyGridPropertyItem>
    </propgrid:PropertyGridCategoryItem>
    </propgrid:PropertyGrid.Items>
    </propgrid:PropertyGrid>
    I found a solution my problem Ijust replacedthe code
    this.SelectedItem = this.Cars[0];
    with this
    this.Loaded += (sender, args) =>
    if (this.SelectedItem == null)
    this.SelectedItem = this.Cars[0];
    And now everything works fine

  • How do i split a line in a csv file and populate a combobox and a textbox with the parts

    What I'm trying to do is split the line and fill a combobox and with the selecteditem and the textbox with the value of the combobox selecteditem which is the second part of the line split.
    Thanks in advance for the help or suggestions.

    Then you should create a class to represent the items in the ComboBox:
    Public Class MyItem
    Public Property PartA As String
    Public Property PartB As String
    End Class
    ...and add instances of this class to the ComboBox:
    Try
    Dim mydocpath1 As String = Environment.GetFolderPath(Environment.SpecialFolder.Desktop)
    Dim mylines() As String = File.ReadAllLines(mydocpath1 + "\TextFile1.txt")
    For Each line In mylines
    Dim parts() As String = line.Split(","c)
    Dim item As MyItem = New MyItem With {.PartA = parts(0), .PartB = parts(1)}
    cmb1.Items.Add(item)
    Next line
    cmb1.SelectedItem = cmb1.Items(1) 'select second item
    Catch ex As Exception
    MsgBox(ex.Message)
    End Try
    Then you set the DisplayMemberPath of the ComboBox to the name of one property and bind the Text property of the TextBlock to the other one:
    <ComboBox Name="cmb1" DisplayMemberPath="PartA" />
    <TextBlock Text="{Binding ElementName=cmb1, Path=SelectedItem.PartB}" />
    That should solve your issue.
    Once again, please remember to mark helpful posts as answer to close your threads and remember that a new thread deserves a new question.

  • Without data in textfield and datagrid if i click add or delete button it should through msgbox

    hi friends ,,
                     i am new to flex i am doing a application in flex4,i need help from this, i have two text inputs and one datagrid, and one add button and delete button.
    my requirement is without data if i click add or delete it should through error box how to do that,
    In 3 condtition it should  thorugh error or msg box;
    conditions are,
                      1.both textinputs and datagrid----> click (add or delete)--->error or msg box
                       2.both textinputs dont have value and datagrid have values----> click (add or delete)--->error or msg box
                       3..both textinputs  have value and datagrid  dont have values----> click (add or delete)--->error or msg box
    any suggession or snippet code are welcome
    Thanks in advance,
    B.venkatesan.

    Hi,
    Please try following code:
    <?xml version="1.0" encoding="utf-8"?><s: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" minWidth="955" minHeight="600">
     <fx:Declarations>
     <!-- Place non-visual elements (e.g., services, value objects) here -->
     </fx:Declarations>
     <fx:Script>
    <![CDATA[
     import mx.collections.ArrayCollection; 
    import mx.controls.Alert; 
    public function check():void{ 
    if(input1.text=="" || input2.text=="" || Dg1.dataProvider==""){
    Alert.show(
    "Enter the text boxes and DataGrid.");}
    else{Alert.show(
    "Do not Enter the text boxes DataGrid."); 
    ]]>
    </fx:Script>
     <s:TextInput x="77" y="107" id="input1"/>
     <s:TextInput x="254" y="107" id="input2"/>
     <mx:DataGrid x="80" y="150" id="Dg1">
     <mx:ArrayCollection>
     </mx:ArrayCollection>
     </mx:DataGrid>
     <s:Button x="95" y="329" label="Add" click="check()" />
     <s:Button x="290" y="329" label="Delete" click="check()"/></s:Application>
    I am keeping Arraycollection empty for example.Please try when you provide data to Arraycollection.
    Thanks and Regards,
    Vibhuti Gosavi | [email protected] | www.infocepts.com

  • Combobox and checkbox in jexcelapi

    Hay Gays,
    with Writing Spreadsheets i want to cells which contain combobox and other cells which contain checkbox ,i need help with that i tried alot of things ?

    You simply write your own TableCellRenderer that returns a different Component instance for each row.
    It could do this by having three TableCellRenderers installed in it and it simply delegates the call to getTableCellRendererComponent to the appropriate renderer:
    public class CompositeTablecellRenderer implements TableCellRenderer
      private TableCellRenderer[] cellRenderers;
      public CompositeTablecellRenderer()
        // create your nested renderers here
      public Component getTableCellRendererComponent(...)
        TableCellRenderer renderer = cellRenderers[row % cellRenderers.length]; // For example!
        return renderer.getTableCellRendererComponent(...);
    }It's up to your application to determine which renderer to use for which row. Cell editors create another level of complexity but it's still achievable (I wrote one that mapped Class to TableCellRenderer so it could determine the renderer based on the value's class at runtime - it sort of works but subclasses prove tricky).
    Hope this helps.

  • Combobox and button renderer

    Hi all,
    I read the documentation about JTables but couldn't figure out how to solve my problem. I want to render combobox and button in the same JTable cell like in Netbeans. How can I do this? Any suggestions?

    Anyone with ideas?

  • ComboBox and DataTable

    Hey All,
    I have found a lot of posts on here about adding values to a combo box using the valid values collection. I am trying to assign a datatable to the Combobox in my case. I add my datatable in the xml and assign a query to it. Then I assign that to the databind property of the combobox and when the form loads it only displays the 1st record in the query.
    Any ideas what I am doing wrong?
    I basically just want to display the list of item groups in my combo box without manually adding these to the valid values collection.
    Curtis

    Hi Curtis.
    If it can help you this is some methods used in my programs:
    1) ValidValues in xml file
    <item uid="cType" type="113" left="100" tab_order="0"
             width="150" top="10" height="14" visible="1" enabled="1" from_pane="0" to_pane="0" disp_desc="1"
             right_just="0" description="" linkto="" forecolor="-1" backcolor="-1" text_style="0" font_size="-1" supp_zeros="0"
             AffectsFormMode="1">
      <AutoManagedAttribute />
      <specific AffectsFormMode="1" TabOrder="0">
       <ValidValues>
        <action type="add">
         <ValidValue value="A" description="AAA" />
         <ValidValue value="E" description="EEE" />
         <ValidValue value="B" description="BB" />
         <ValidValue value="D" description="DD" />
        </action>
       </ValidValues>
      <databind databound="1" table="@TABLE_A" alias="U_TYPE" />
    </specific>
    </item>
    2) Add ValidValues to combobox.
    Private Sub CreateForm()
        Dim oForm As SAPbouiCOM.Form
        Dim oComboBox As SAPbouiCOM.ComboBox
        Set oForm = SBO_Application.Forms.Add("MYFORM")
        oForm.DataSources.UserDataSources.Add "DS", dt_SHORT_TEXT, 20
        Set oComboBox = oForm.Items.Add("cCombo1", it_COMBO_BOX).Specific
        oComboBox.DataBind.SetBound True, "", "DS"
        oComboBox.ValidValues.Add "A", "Value A"
        oComboBox.ValidValues.Add "B", "Value B"
        oComboBox.ValidValues.Add "C", "Value C"
    End Sub
    3) Add Linked Table for field.
    See this thread [User defined Valid values in SBO|User defined Valid values in SBO;
    4) Recordset
    See this thread [Fill values in combobox from database table|Fill values in combobox from database table;
    5) LoadSeries Method (look SDK Help)
    Other ways  I don't know.
    Best regards
    Sierdna S.

  • [svn:fx-trunk] 11737: ComboBox and DropDownList bug fixes

    Revision: 11737
    Author:   [email protected]
    Date:     2009-11-12 13:25:33 -0800 (Thu, 12 Nov 2009)
    Log Message:
    ComboBox and DropDownList bug fixes
    SDK-23635 - Implement type-ahead in DropDownList
    Added code in DropDownListBase keyDownHandler to listen for letters and change the selection if there is a match. At some point, we should modify findKey and findString (I'll file an ECR for that). For now, I've just overridden findKey and cobbled together the logic from List.findKey and List.findString. In ComboBox, we override findKey to do nothing since ComboBox has its own logic that relies on textInput changes.
    SDK-23859 - DropDownList does not reset caretIndex when selection is cleared
    Fixed this in two places. In ComboBox.keyDownHandlerHelper, we update the caret index when ESC is pressed. In DropDownListBase.dropDownController_closeHandler, we update the caret index if the commit has been canceled (ie. ESC was pressed).
    SDK-24175 - ComboBox does not select an item with ENTER when openOnInput = false
    When the ComboBox was closed and the arrow keys were pressed, the selectedIndex was changed. When ENTER was pressed, it was committing actualProposedSelectedIndex, not selectedIndex. The fix is to override the selectedIndex setter to keep actualProposedSelectedIndex in sync if selectedIndex was changed. Usually it is kept in sync when the dropDown is opened.
    SDK-24174 - ComboBox does not scroll correctly when openOnInput = false
    When typing in a match, the caretIndex was changed, but not the selectedIndex (because matching when it is closed doesn't commit the value until you press ENTER or lose focus). When closed, the navigation keys were changing the selectedIndex relative to the previous selectedIndex. I updated this to change relative to caretIndex instead. In most cases, caretIndex and selectedIndex are equivalent while the dropDown is closed.
    Other changes:
    - Replaced some calls to dropDownController.isOpen with isDropDownOpen.
    - Added protection RTE protection to ComboBox.changeHighlightedSelection
    QE notes: None
    Doc notes: None
    Bugs: SDK-23635, SDK-23859, SDK-24175, SDK-24174
    Reviewer: Deepa
    Tests run: ComboBox, DropDownList
    Is noteworthy for integration: No
    Ticket Links:
        http://bugs.adobe.com/jira/browse/SDK-23635
        http://bugs.adobe.com/jira/browse/SDK-23859
        http://bugs.adobe.com/jira/browse/SDK-24175
        http://bugs.adobe.com/jira/browse/SDK-24174
        http://bugs.adobe.com/jira/browse/SDK-23635
        http://bugs.adobe.com/jira/browse/SDK-23859
        http://bugs.adobe.com/jira/browse/SDK-24175
        http://bugs.adobe.com/jira/browse/SDK-24174
    Modified Paths:
        flex/sdk/trunk/frameworks/projects/spark/src/spark/components/ComboBox.as
        flex/sdk/trunk/frameworks/projects/spark/src/spark/components/DropDownListBase.as

    This bug figures out also when creating a custom spark ComboBox, then trying to programatically update the userProposedSelectedIndex property. The proposed selected index is selected, but does not apply the same skin as when mouse is on rollover or item is selected due to up and down keys.
    The issue seems like updating the status of the item renderer to rollover or selected to get the same skin applied.
    Please could you attach DropDow nList.as that you edited ?
    Thank you so much.

  • [svn:fx-3.x] 10689: Modify TileBase renderer creation sequence to match those of List and DataGrid .

    Revision: 10689
    Author:   [email protected]
    Date:     2009-09-29 11:11:24 -0700 (Tue, 29 Sep 2009)
    Log Message:
    Modify TileBase renderer creation sequence to match those of List and DataGrid.
    QE Notes: None
    Doc Notes: None
    Bugs: SDK-23487
    Reviewer: Corey
    API Change: No
    Is noteworthy for integration: No
    tests: checkintests mustella/components/TileList, HorizontalList
    Ticket Links:
        http://bugs.adobe.com/jira/browse/SDK-23487
    Modified Paths:
        flex/sdk/branches/3.x/frameworks/projects/framework/src/mx/controls/listClasses/TileBase. as

    zeratul289 wrote:
    Look for this:
    Subsection "Display"
    Depth 24
    Modes "800x600" "640x480"
    ViewPort 0 0
    EndSubsection
    And change it to this:
    Subsection "Display"
    Depth 24
    Modes "1280x1024" "800x600" "640x480"
    ViewPort 0 0
    EndSubsection
    The resolution for your monitor was missing for that particular depth.
    Close. worked after I added the "1024x768" mode as well as "1280x1024".

  • ComboBox and JList working to gether?

    Hey
    Is it possible to get ComboBox and JList to work together?
    Eksampel.
    In the ComboBox there are 3 options to pick. Football, Hockey and Baseball. When one of these are picked all the names of the players
    from for example football is shown in a JList.
    Is this possbile? If yes how? can you give example or link to toturial?

    do you know a tutorial on this?Did you read the API for either JComboBox or JList????????
    Both contain links to the Swing tutorial.
    And why is it so difficult to post a Swing related question in the Swing forum???????

Maybe you are looking for