Combo Select in Matrix

Hi to all,
I have a problem in combo Select in Matrix. I have a form with A matrix and One Column as a combobox. This Column is bind to one of the field of Table.
I have loaded the combo with valid values, but when i select the combo item, it is not set in that column, i.e No value.
regards
Bikram

Hi,
Have you added a row to the matrix after initialisation of the column with the valid value ? if not add a row to the matrix. Check the below code
SAPbouiCOM.Matrix oMatrix = null;
SAPbobsCOM.Recordset oRecordset = null;
LoadFromXML("frmLMM.srf");
Global.oForm = Global.SboApplication.Forms.Item("frmLMM");
oRecordset = (SAPbobsCOM.Recordset)(Global.oCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.BoRecordset));
oRecordset.DoQuery("select UnitDisply,UnitName from owgt");
oRecordset.MoveFirst();
oMatrix = (SAPbouiCOM.Matrix)(Global.SboApplication.Forms.Item("frmLMM").Items.Item("MtrxSrvc").Specific);
for (int i = 0; i < oRecordset.RecordCount; i++)
                   oMatrix.Columns.Item("colUom").ValidValues.Add(oRecordset.Fields.Item("UnitDisply").Value.ToString(),
                   oRecordset.Fields.Item("UnitName").Value.ToString());
                    oRecordset.MoveNext();
oMatrix.AddRow();
Regards,
Noor

Similar Messages

  • How to use the Combo Box In MAtrix Colums

    HI Experts,
    Good Mornong.How to use the Combo Box In MAtrix Colums?
    Regards And Thanks,
    M.Thippa Reddy

    hi,
    loading data in to the combobox on form load.but, it should be done when atleast one row is active.
    the values what ever you are inserting in to combo should  be less than or eqhal to 100 or 150.if it exceeds beyond that performance issue arises.it takes more time to load all the data.so, it is better to have 100 or less.
    oMatrix.AddRow()
    RS = Nothing
    RS = ocompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.BoRecordset)
    RS.DoQuery("select ItemCode,ItemName from oitm")
    oCombo = oMatrix.Columns.Item("ColumnUID").Cells.Item(oMatrix.RowCount).Specific
    For i = 1 To RS.RecordCount
          If RS.EoF = False Then
                oCombo.ValidValues.Add(RS.Fields.Item("ItemCode").Value,RS.Fields.Item("ItemName").Value)
                RS.MoveNext()
          End If
    Next
    the above code is inserting data from database to column combobox.
    you can fill combo directly also as shown below.
    oCombo.ValidValues.Add("x","1")
    oCombo.ValidValues.Add("y","2")
    oCombo.ValidValues.Add("z","3")
    oCombo.ValidValues.Add("","")
    and what ever the values you are filling into combo should be unique.other wise it shows valid value exists.
    regards,
    varma

  • Problem  in Combo Select

    Hi,
    In my form i have a combo. My requirement is, for example i load 5 data A,B,C,D,E in combo. First i select the 'A' and load the corresponding elements in the matrix, next i select 'B' and the corresponding elements of 'B'  was loaded in matrix now again i select 'A ' it should check 'A' is already selected and the corresponding elements are already displayed in matrix again the elements of 'A' should not be loaded in matrix. Plz tell how to check this.
    Thanks in Advance.
    Regards,
    Madhavi

    Hi Madhavi,
    here are the main parts of my little example.
    Some hints:
    The form is managed in a shared class (only one form at a time)
    The Matrix is loaded via a DataTable
    The Matrix is ReLoaded on every time the "ABCDE-Combo" is selected (except the value is already selected)
    In the example I load Businesspartners into matrix where their CardName starts with A or B or....or E (you must adapt it for your needs)
    SboCon.SboDI is the SAPbobsCOM.Company
    SboCon.SboUI is the SAPbouiCOM.Application
    Some global vars (initialize them somewhere when the form is opened!):
        Private Shared oForm As SAPbouiCOM.Form
        Private Shared oUds As SAPbouiCOM.UserDataSources
        Private Shared oDts As SAPbouiCOM.DataTables
        Private Shared oDtBp As SAPbouiCOM.DataTable
        Private Shared oMtxBp As SAPbouiCOM.Matrix
        Private Shared SelVals As System.Collections.ArrayList ' The values of the combo which already selected by the user
    Init the vars somewhere (where you normally do this) on form load:
                oForm = '...set it in your way
                oDts = oForm.DataSources.DataTables
                oUds = oForm.DataSources.UserDataSources
                oMtxBp = oForm.Items.Item("MTX_BP").Specific
               ' DataBinding and related:
                '### Data Tables
                oDts.Add("DT_BP")
                '### UserDataSources
                '# ABCDE Combo:
                oUds.Add("UDS_SELBP", SAPbouiCOM.BoDataType.dt_SHORT_TEXT, 100)
                oForm.Items.Item("CBX_SELBP").Specific.databind.setbound(True, "", "UDS_SELBP")
                '### Fill ABCDE Combo
                oForm.Items.Item("CBX_SELBP").DisplayDesc = True
                oCbx = oForm.Items.Item("CBX_SELBP").Specific
                oCbx.ValidValues.Add("0", "Please select...")
                For val As Integer = Asc("A") To Asc("E")
                    oCbx.ValidValues.Add(Chr(val), "Load " & Chr(val) & " BP")
                Next
                oUds.Item("UDS_SELBP").ValueEx = "0"
    The Combo Select Event:
                If pVal.ItemUID = "CBX_SELBP" And pVal.EventType = SAPbouiCOM.BoEventTypes.et_COMBO_SELECT Then
                    If Not pVal.BeforeAction Then
                        If oUds.Item("UDS_SELBP").ValueEx != "0" Then
                            Dim oCbx As SAPbouiCOM.ComboBox = oForm.Items.Item("CBX_SELBP").Specific
                            If SelVals.Contains(oUds.Item("UDS_SELBP").ValueEx) Then
                                ' BP already selected - do nothing
                                SboCon.SboUI.StatusBar.SetText("Already selected!")
                            Else
                                If Not SelVals.Contains(oUds.Item("UDS_SELBP").ValueEx) Then
                                    SelVals.Add(oUds.Item("UDS_SELBP").ValueEx)
                                End If
                                Dim query As String
                                oDtBp.Clear()
                                oMtxBp.Clear()
                                ' Build query for BPs where their names starts with the Combo-Value
                                query = "SELECT CardCode, CardName FROM OCRD WHERE "
                                For i As Int16 = 0 To SelVals.Count - 1
                                    If i > 0 Then query &= " OR "
                                    query &= "CardName LIKE '" & SelVals(i) & "%' "
                                Next
                                query &= " ORDER BY CardName"
                                ' load the MTX via DataTable (reloaded every time based on collected combo-values)
                                oDtBp.ExecuteQuery(query)
                                With oMtxBp.Columns
                                    ' Zeilen-Nr.
                                    .Item("0").DataBind.Bind("DT_BP", "CardCode")
                                    .Item("1").DataBind.Bind("DT_BP", "CardName")
                                End With
                                oMtxBp.LoadFromDataSource()
                                oMtxBp.AutoResizeColumns()
                                SboCon.SboUI.StatusBar.SetText(oUds.Item("UDS_SELBP").ValueEx & " added!", SAPbouiCOM.BoMessageTime.bmt_Short, SAPbouiCOM.BoStatusBarMessageType.smt_Success)
                            End If
                            ' reset Combo to "Please select..."
                            oUds.Item("UDS_SELBP").ValueEx = 0
                        End If
                    End If
                End If
    ATTENTION: REPLACE the "!=" with less (<)/greater(>) symbol, they're not shown in ths forum
    I hope I didn't forget sth. - here it works..
    Cheers,
    Roland
    Edited by: Roland Toschek on Sep 25, 2008 11:54 AM

  • How to set condition in choose from list based on the combo selection

    Dear Members,
         i have a requirement to filter the item based on the itemgroup. After choosing the itemgroup in the dropdown list i have to filter the item for the particular group in the choose from the list.since i have tried in the combo select it doesnt work out for me.any body can suggest me is it doable. if so pls tell me the work around.
    My coding is as follows..
    Case SAPbouiCOM.BoEventTypes.et_COMBO_SELECT
    if pval.itemUID="Cmb"
                                objChooseCollection = objForm.ChooseFromLists
                                objChooseFromList = objChooseCollection.Item("CFL1")
                                objConditions = objChooseFromList.GetConditions()
                                objcondition = objConditions.Add()
                                objcondition.Alias = "itmsgrpcod"
                                objcondition.Operation = SAPbouiCOM.BoConditionOperation.co_EQUAL
                                objcondition.CondVal = Form.items.item("Cmb").specific.selected.value
                                objChooseFromList.SetConditions(objConditions)
    End if
    With Regards,
    jai.
    Edited by: JaiShankarRaman on Dec 23, 2009 10:47 AM

    Hello,
    Following is a code sample which I am using:
            Dim oForm As SAPbouiCOM.Form
            Dim oMatrix As SAPbouiCOM.Matrix
            Dim oChooseFromList As SAPbouiCOM.ChooseFromList
            Dim oConditions As SAPbouiCOM.Conditions
            Dim oCondition As SAPbouiCOM.Condition
            Dim CodeType As Integer
            Try
                oForm = oPayOn.SBO_Application.Forms.GetForm(CflEvent.FormTypeEx, CflEvent.FormTypeCount)
                oMatrix = oForm.Items.Item("AC_MATRIX").Specific
                oChooseFromList = oForm.ChooseFromLists.Item("ACC_CFL1")
                CodeType = oMatrix.Columns.Item("AC_MC00").Cells.Item(CflEvent.Row).Specific.Selected.Value
                oConditions = oChooseFromList.GetConditions
                If oConditions.Count > 0 Then
                    oCondition = oConditions.Item(0)
                Else
                    oCondition = oConditions.Add
                End If
                oCondition.Alias = "U_CodeType"
                oCondition.Operation = SAPbouiCOM.BoConditionOperation.co_EQUAL
                oCondition.CondVal = CodeType
                oChooseFromList.SetConditions(oConditions)
            Catch ex As Exception
                'oPayOn.SBO_Application.SetStatusBarMessage(ex.Message, SAPbouiCOM.BoMessageTime.bmt_Medium, True)
            End Try
        End Sub
    I am calling this in the CFL event - before action. So when the user clicks on CFL button - but before it opens - this code is called and the condition is applied. Here AC_MC00 is a combo column in a matrix.
    Regards
    Rahul Jain

  • Combo select

    HI All,
    I have one requirement that is we had to display data depending up on our combo select
    That is if we select one item in a combo it should display items accordingly in a matrix. It means if we are having 5 columns.
    Thanx and Regards,
    krishna.v

    Hi,
    Use the Combo Select Event and refill the matrix.
    Case SAPbouiCOM.BoEventTypes.et_COMBO_SELECT
    If pVal.ItemUID = "cmbApStats" Then
               'Code for Refilling the matrix
    End IF
    Hope it helps.
    Regards,
    Vasu Natari.

  • When combo selected, user form sholud be open

    Hi
    In system form, when value is selected in the combo box, at same time  user form should be opened. what is the coding for this process? can anyone help me..
    Regards
    Bhuvana

    Hi Bhuvana
    in the combo select event use this code to get your User form to load
    LoadFromXML("solution.srf")(Name of the srf file)
    oform = oapp.Forms.Item("solut")(FormUID)
      service_solution() (databinding)
    this is an easy way to load a form the for this use should have LoadFromXml() function like this
    Public Sub LoadFromXML(ByVal FileName As String)
            Dim oXmlDoc As New Xml.XmlDocument
            Dim sPath As String
            Try
    sPath = IO.Directory.GetParent(Application.StartupPath).ToString
                oXmlDoc.Load(sPath & "\" & FileName)
                oapp.LoadBatchActions(oXmlDoc.InnerXml)
            Catch ex As Exception
                oapp.MessageBox(ex.Message)
            End Try
        End Sub
    if this helps do reward points
    Edited by: Cool Ice on Jul 28, 2008 12:44 PM

  • Handle multiple rows selection on Matrix

    Hi all,
    i'd like to know if someone could help me with multiple selections on matrix via shift + left mouse button on a matrix.
    I got a matrix with one column containing a checkbox for selection. The matrix, on a UDO Form, is defined as auto selecting, so multiple selection of rows is allowed.
    I want to add the rows selected by the checkbox (using shift + left mouse button on the selection start and selection end) column to the matrix selected rows collection.
    Is there any chance to catch an event handling this situation?
    I can add the rows in the matrix selected rows collection clicking the checkboxes one by one, but when i use the multiple selection i can't get any event handling this.
    I know i couldn't use the checkbox for the selection and use instead the native function of sap b1 matrix., but this way is faster (and more clear, because you see the check when a row is selected) when you have multiple rows selected one by one
    I hope i've been clear enough, and hope somene can give me an hint.
    Thanks in advance.

    Hi Cesidio,
    if I understand you correctly you want to select one row than shift+mouseclick some rows lower and the result should be, that all rows are selected ?
    You can achieve this by catching the itempressed event and querying pVal.Modifiers.
    This is an example for Grid :
    private void Grid0_PressedAfter(object sboObject, SAPbouiCOM.SBOItemEventArg pVal)
                if (pVal.Modifiers == SAPbouiCOM.BoModifiersEnum.mt_SHIFT)
                    int lastRowSelected =Grid0.Rows.SelectedRows.Item(Grid0.Rows.SelectedRows.Count-1,SAPbouiCOM.BoOrderType.ot_RowOrder);
                    if (lastRowSelected < pVal.Row)
                        for (int i = pVal.Row; i > lastRowSelected; i--)
                            Grid0.Rows.SelectedRows.Add(i);
    regards,
    Maik

  • Updation of Column according to the selection of Combo Columnn of Matrix.

    Hii Experts,
                  I have a matrix with two columns.
                  First column  is a combobox & validvalues are "Departmental,Contractor"
                  Now I want that if one choose Departmental in 1st column then one could not write anything to 2nd column but in case of  Contractor ,one can write to  2nd column.
                  But I could not Disable 2nd column because One can choose Departmental in row 1 & Contractor in row 2.
    so this is the situation,How I should handle it?
    Thanks,
    Nabanita

    This is basically the same. I can;t write out the exact code right now, so I will give you the algorithm I would use:
    1. User selects combobox in column 1
    2. User clicks on or moves focus on column 2 -> Check have they selected Departmental; if Yes allow event to continue (BubbleEvent = true). if No block the event (BubbleEvent = false) and click column 3  - therefore the cursor will be in the correct field
    3. User clicks on or moves focus on column 3 -> Check have they selected Contractor; if Yes allow event to continue (BubbleEvent = true). if No block the event (BubbleEvent = false) and click column 2  - therefore the cursor will be in the correct field
    Important to note, that for each step above I am working within the row level. I am only blocking or allowing the event on row x based on the selected value in column 1 of row x.

  • How  the condition of combo box of matrix can be passed in query

    Hi,
    I want to get the parameter code and description for a particular category. Category code is in the matrix combo box  if i pass tat field in a where condition i cant retrieve the parameter code but its working in the database. Please identify the mistake and correct it.
    Private Sub Addcomboparam(ByVal oCombo As SAPbouiCOM.Column)
            Try
                Dim RS As SAPbobsCOM.Recordset
                'Dim Bob As SAPbobsCOM.SBObob
                RS = Ocompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.BoRecordset)
                'Bob = Ocompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.BoBridge)
                RS.DoQuery("select Code,U_paradesc from [@PSSIT_QCPARAMETER] where U_catcode='" & txtcatcode.Selected.Value.ToString() & "'")
                RS.MoveFirst()
                While RS.EoF = False
                    oCombo.ValidValues.Add(RS.Fields.Item("Code").Value, RS.Fields.Item("U_paradesc").Value)
                    RS.MoveNext()
                End While
            Catch ex As Exception
                MessageBox.Show(ex.Message)
            End Try
        End Sub
    Regards,
    Madhavi

    I think that the problem is, that you accesed
    txtcatcode.Selected.Value.ToString
    but txtcatcode isnt declared.
    try to do it as
    dim x as string
    x = txtcatcode.Selected.Value.ToString
    and to seccond line add watch and breakpoint.
    what you have in x variable? Or use try catch statement for receive error.
    Petr

  • Combo box in matrix column does not bind

    Dear Sirs,
    I have a master data UDO with three child tables, and I generated an xml form file using the B1DE form ganerator for this UDO.
    After that I used screen painter to set some columns of the matrix bindend to the child tables as combo box.
    In the load data event of the form I populate each combo box cell with the valid values I want.
    Now, when I add (or update) data , the combo box let me choose the valid values correctly (and I can see the choosen value in the cell) , but then data are not saved in the DB, while the data entered in edit text columns are correclty saved.
    Anyone have an idea of the problem?
    Thank you for the help
    Massimo

    Massimo,
    Have a look at the SDK Sample for Matrix and DataSource ...
    ...\Program Files\SAP\SAP Business One SDK\Samples\COM UI\VB.NET\06.MatrixAndDataSources
    This may help.
    Eddy

  • Combo selection problem

    Hello,
    I have a problem with a combo box. I've uploaded the combobox with data from a table:
    string sSQL = "SELECT BankCode, BankName FROM ODSC";
    oRs.DoQuery(sSQL);
    oRs.MoveFirst();
    for (int i = 0; i < oRs.RecordCount; i++)
    oComboBox.ValidValues.Add(oRs.Fields.Item("BankCode").Value.ToString(), oRs.Fields.Item("BankName").Value.ToString());
      oRs.MoveNext();
    In the variable dfltbank, I have a bank which i want to select in the combobox:
    oComboBox.Select(dfltbank, APbouiCOM.BoSearchKey.psk_ByValue); (in the constructor of the class).             
    I also have an item event on this combobox et_COMBO_SELECT.
    The problem is that event gets triggers when the form is loading because of my selection above and i get "Object not set to an instance of an object" (the class the forms load in is null, because the event got triggered before the constructor of the class finished).
    How can i solve this?
    Thank you in advance,

    Have you tried checking for the pval.InnerEvent status?  That will help to ferret out events that happen internally in code vs events that are caused by the user explicitly.
    If pval.InnerEvent = True then
      'do this
    Else
      'do that
    End If

  • Combo selection - Trouble

    Hi guys,
    Have made a small test application to tell my problem.
    Have rendered a table with a comboBox.Everything works fine,the way I wanted it to be, apart from the following things.
    [1]
    When the user Doubleclicks on one of the combocells,the comboitem in the combobox is already displayed on the tablecell.I dont want it to be like that.
    I want the comboitem to be displayed on the tablecell only when the user explicitly goes and selects the comboitem.If the user doublciks on the cell as said before,the old cell value should remain.
    [2]
    How to catch a combo close up event when the user explicitly selects an item from the combo.Because I want to do something when the user does so....
    see Pic:
    http://i337.photobucket.com/albums/n399/turniphorse/ComboSelection.jpg
    Iam attaching the code(running) also along with this....
    Any help is greatly appreciated.
    Thanks.
    package set.test;
    import java.awt.Color;
    import java.awt.Component;
    import java.awt.Dimension;
    import java.awt.GridLayout;
    import java.awt.Point;
    import java.awt.event.MouseAdapter;
    import java.awt.event.MouseEvent;
    import java.util.Vector;
    import javax.swing.DefaultCellEditor;
    import javax.swing.JButton;
    import javax.swing.JComboBox;
    import javax.swing.JFrame;
    import javax.swing.JPanel;
    import javax.swing.JScrollPane;
    import javax.swing.JTable;
    import javax.swing.ListSelectionModel;
    import javax.swing.table.DefaultTableCellRenderer;
    import javax.swing.table.DefaultTableModel;
    import javax.swing.table.TableCellRenderer;
    import javax.swing.table.TableColumn;
    public class TableCellColour extends JPanel {
             private int tableHilightedRow, tableHilightedCol;
             JTable table = null;       
             private Vector rowData;
              private Vector columnNames;
              private JButton jButton = null;  //  @jve:decl-index=0:visual-constraint="348,164"
    public TableCellColour(){
         super(new GridLayout(1,0));
         rowData = new Vector();
         columnNames = new Vector();
         this.columnNames.addElement("Entry Type");
         this.columnNames.addElement("First");
         this.columnNames.addElement("Last");
         this.tableHilightedRow = -1;
         this.tableHilightedCol = -1;
         table = new JTable(new MyTableModel(rowData,columnNames));
         addRows();
         table.setPreferredScrollableViewportSize(new Dimension(500,70));     
         JScrollPane scrollpane = new JScrollPane(table);
         //Create the scroll pane and add the table to it.
        JScrollPane scrollPane = new JScrollPane(table);
        table.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
        //table.setSelectionBackground(Color.YELLOW);
        table.addMouseListener(new MouseHandler());     
        setUpStartEndRangeColumn(table);
            add(scrollPane);
            add(getJButton());
    private void addRows(){
         Vector row = new Vector();     
         row.addElement("");
         row.addElement("555");
         row.addElement("566");
         MyTableModel myModel = (MyTableModel) this.table.getModel();
         myModel.addRow(row);
         Vector row1 = new Vector();
         row1.clear();
         row1.addElement("");
         row1.addElement("655");
         row1.addElement("666");     
         myModel.addRow(row1);
         Vector row2 = new Vector();
         row2.clear();
         row2.addElement("");
         row2.addElement("755");
         row2.addElement("766");     
         myModel.addRow(row2);
         Vector row3 = new Vector();
         row3.clear();
         row3.addElement("");
         row3.addElement("855");
         row3.addElement("866");     
         myModel.addRow(row3);
    public void setUpStartEndRangeColumn(JTable table){
         // These are the combobox values          
         JComboBox comboBox1 = new JComboBox();
         comboBox1.addItem("First");
        //sportColumn.setCellEditor(new DefaultCellEditor(comboBox));
         //JComboBox comboBox = new JComboBox(values1);     
         MyComboBoxEditor cellEditor = new MyComboBoxEditor(comboBox1);
         TableColumn startRange = table.getColumnModel().getColumn(1);
         //startRange.setCellEditor(new DefaultCellEditor(comboBox));
         startRange.setCellEditor(cellEditor);
         MyComboBoxRenderer  comboRenderer= new MyComboBoxRenderer();
         DefaultTableCellRenderer renderer = new DefaultTableCellRenderer();
         startRange.setCellRenderer(comboRenderer);  
         JComboBox comboBox2 = new JComboBox();
         comboBox2.addItem("Last");
         TableColumn endRange = table.getColumnModel().getColumn(2);
         MyComboBoxEditor cellEditor2 = new MyComboBoxEditor(comboBox2);
         endRange.setCellEditor(cellEditor2);
         DefaultTableCellRenderer renderer2 = new DefaultTableCellRenderer();
         endRange.setCellRenderer(comboRenderer);
    public void setTableRowColSelection() {
         if (tableHilightedRow != -1)
              table.setRowSelectionInterval(0, tableHilightedRow);
         if (tableHilightedCol != -1)
              table.setColumnSelectionInterval(0, tableHilightedCol);
    public class MyTableModel extends DefaultTableModel{
         public MyTableModel(Vector rowDataSet, Vector columnNamesSet) {
              super(rowDataSet, columnNamesSet);
         public Class getColumnClass(int columnIndex) {
              return getValueAt(0, columnIndex).getClass();
         public boolean isCellEditable(int row,int col){
                 if(col<1)
                   return false;
                   else
                        return true;
         public void setValueAt(Object value,int row,int col){
              super.setValueAt(value, row, col);
    public class MyComboBoxEditor extends DefaultCellEditor {
         private static final long serialVersionUID = 1L;
         public MyComboBoxEditor(JComboBox combo) {
             super(combo);         
             setClickCountToStart(2);         
       public void setClickCountToStart(int count)  {
            super.setClickCountToStart(count);       
    public class MyComboBoxRenderer extends JComboBox implements TableCellRenderer {
         int highlightRow = -1;
         int highlightCol = -1;
        public MyComboBoxRenderer() {
           super();
           setOpaque(true);     
        public Component getTableCellRendererComponent(JTable table, Object value,
                boolean isSelected, boolean hasFocus, int row, int column) {
              if (row == highlightRow && column == highlightCol) {
                   setBackground(Color.yellow);
              else if (isSelected) {
                  // setBackground(Color.yellow);
                    setForeground(table.getSelectionForeground());
                  super.setBackground(table.getSelectionBackground());
              } else
                   //setBackground(Color.yellow);
                    setForeground(table.getForeground());
                    setBackground(table.getBackground());               
              setBorder(null);          
              removeAllItems();
              addItem( value );          
              return this;
        public void setHighlightCell(int row, int col) {
              highlightRow = row;
              highlightCol = col;
              tableHilightedRow = highlightRow;
              tableHilightedCol = highlightCol;               
              setTableRowColSelection();
    class MouseHandler extends MouseAdapter {
        public void mousePressed(MouseEvent e) {
            JComboBox comp = null;
            Point p = e.getPoint();
             int row = table.rowAtPoint(p);
              int col = table.columnAtPoint(p);          
              int click = e.getClickCount();
              MyComboBoxRenderer render = (MyComboBoxRenderer) table.getCellRenderer(row, col);
              String eVal = (String)table.getValueAt(row,col);
              comp = (JComboBox) render.getTableCellRendererComponent(table,eVal,true,true,row,col);
              if(click==1&& (row != -1) && (col != 0))
                   render.setHighlightCell(row, col);
           table.repaint();               
    private static void  createAndShowGUI(){
         JFrame frame = new JFrame("TableComBoBox");
         frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
         TableCellColour newContentPane = new TableCellColour();     
         newContentPane.setOpaque(true);
         frame.setContentPane(newContentPane);
         frame.pack();
         frame.setVisible(true);
    * This method initializes jButton     
    * @return javax.swing.JButton     
    private JButton getJButton() {
         if (this.jButton == null) {
              jButton = new JButton();
              jButton.setSize(new Dimension(176, 29));
              jButton.addActionListener(new java.awt.event.ActionListener() {
                   public void actionPerformed(java.awt.event.ActionEvent e) {
                        table.getModel().setValueAt("Test",0, 1);
                        table.repaint();
         return jButton;
    public static void main(String[] args) {
        //Schedule a job for the event-dispatching thread:
        //creating and showing this application's GUI.
        javax.swing.SwingUtilities.invokeLater(new Runnable() {
            public void run() {           
               createAndShowGUI();
    }

    [2] - Use a TableModelListener - whenever the data in the cell is changed a TableModel event is fired.

  • Depend on first combo selection, second combo should disable and enable

    hi
    i am using jstl and jsp. I have two combos , first combo has 4 items
    when clicking the 3rd item and 4 th items second combo should
    be disabled( that means he should not select second combo items)
    combo items are not hardcoded they are polulating by mapping through hibernate to database. Please help me how to do it by
    using javascript or jstl conditions.
    can any body help me please...this is urgent
    thanks
    jalandhar
    Message was edited by:
    jalandhar
    Message was edited by:
    jalandhar

    Hi,
    This is not a javascript forum, please google for a javascript forum. (Javascript is not java)
    Kaj

  • Combo select value

    I have a problem with comobox select. I have build a form with 3 comboboxes. I added to the form a button for clear all the controls values in the form. When I am in the find mode nad i want to clear the combobox selected value it does not clear the value. and this is only when I am in find mode.
    I have also added the empty value to the combo datasource.
    the code is something like this:
    oCombo.Select(string.Empty, SAPbouiCOM.BoSearchKey.psk_ByValue);
    string selectedValue = _cmbCausale.Selected.Value;
    The problem is that  when I am in find mode the selectedValue it is not string.Empty but it is the last selected value from the form.
    does any one have any suggestion?

    HI,
    Set the datasource value to clear the combobox, then it will work.
    Regards
    J.

  • Add CheckBox column for selection in MAtrix

    How do I add the CheckBox selection column for the matrix like SAP have

    Hi Marc,
    Adding a checkbox column for a matrix is quite simple.  If through screen painter, then, you simply select the column and go to the columns tab in the screen painter menu and by default the Type will be set to edit.  You just need to change it to Check Box.  One thing you need to keep in mind is, you need to databind the column for sure.
    If the same is got to be done thorough code, the same property will be displayed in code as well.
    Regards,
    Satish.

Maybe you are looking for

  • XML publisher report with a template file missing

    I get the following error Active template file not found in the template definition <TEMPLATE_NAME> for date <EFFDT>. (235,2515) PSXP_RPTDEFNMANAGER.TemplateDefn.OnExecute Name:GetActiveTemplateFile PCPC:15872 Statement:346 but in Reporting Tools > X

  • User exit for FF68

    Does anyone know of a way to take a value from FF68 and use it to post an accounting document. We require to put the Issuer value into ref Key 3. A substitution does not work, as it is not called. There do not seem to be any user exits in the standar

  • Flash Player 10 processor system requirement discrepancy

    http://www.ehow.com/info_8526453_flash-player-10-system-requirements.html says that Flash Player 10 on Windows computers requires "a Pentium 4 processor running at 2.33 GHz or an Athalon 64 2800+ processor." However, http://www.downloadatoz.com/essen

  • 7.0 Manual

    I downloaded the manual [features guide] for ipod but it is in the older version. I downloaded 7.0x and it looks totally different than the pics in the manual! I don't have an import button, and my new music keeps going into shuffel! can someone help

  • What is needed to plug in mac charger in europe ?

    what is needed to plug in mac charger in europe ?