Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
180
Showing buttons in a grid cells
posted

I have a grid with multiple columns.  In one of the columns I need to show 3 buttons and in another column I need to show 2 buttons.

When the screen loads I create a three button editor and a two button editor.  See code below:

        private UltraTextEditor TwoButtonEditor = new UltraTextEditor();

        private UltraTextEditor ThreeButtonEditor = new UltraTextEditor(); 

        private void CreateTwoButtonCellEditor()

        {

            EditorButton Charge = new EditorButton();

            EditorButton Waive = new EditorButton();

 

            Charge.Text = "C";

            Charge.Width = 34;

            Charge.Key = WorkViewAccountsConstants.CHARGE_KEY;

            Waive.Text = "W";

            Waive.Width = 34;

            Waive.Key = WorkViewAccountsConstants.WAIVE_KEY;

            TwoButtonEditor.ButtonsRight.Add(Charge);

            TwoButtonEditor.ButtonsRight.Add(Waive);

 

            TwoButtonEditor.EditorButtonClick += TwoButtonEditor_EditorButtonClick;

        }

 

        private void CreateThreeButtonCellEditor()

        {

            EditorButton Approve = new EditorButton();

            EditorButton Reject = new EditorButton();

            EditorButton HFF = new EditorButton();

 

            Approve.Text = "A";

            Approve.Width = 34;

            Approve.Key = WorkViewAccountsConstants.APPROVE_KEY;

            Reject.Text = "R";

            Reject.Width = 34;

            Reject.Key = WorkViewAccountsConstants.REJECT_KEY;

            HFF.Text = "H";

            HFF.Width = 34;

            HFF.Key = WorkViewAccountsConstants.HFF_KEY;

            ThreeButtonEditor.ButtonsRight.Add(Approve);

            ThreeButtonEditor.ButtonsRight.Add(Reject);

            ThreeButtonEditor.ButtonsRight.Add(HFF);

 

            ThreeButtonEditor.EditorButtonClick += ThreeButtonEditor_EditorButtonClick;

        }

 

In the InitializeRow event of the grid I add the editors to the correct row cells like this:

            row.Cells[WorkViewAccountsConstants.COL_DECISION_BUTTONS].EditorComponent = ThreeButtonEditor;

            row.Cells[WorkViewAccountsConstants.COL_FEEDECISION_BUTTONS].EditorComponent = TwoButtonEditor;

 

When I show the grid, the buttons in the cells do not appear.  When the mouse enters the cells, the buttons appears.  When the mouse leaves the cells the buttons disappear.  I read a post where a ToolTip was causing this issue so I added the following statement to the grid to turn off the ToolTip:

this.gridTransactions.DisplayLayout.Override.TipStyleCell = TipStyle.Hide;

The problem still exists.

 

Is there something I'm not doing correctly?  Also, how do I capture when the user clicks a button in a cell?  I added the event handler you see in the code above, but when I set a break point in the ThreeButtonEditor_EditorButtonClick and TwoButtonEditor_EditorButtonClick methods, nothing happens.  The event isn't firing.

 

 

 

 

Parents
  • 469350
    Offline posted

    Hi,

    There's nothing wrong there, the buttons are only supposed to show up when the mouse is in the cell or when the cell is Active. That's the intended behavior.

    If you want the buttons to show all the time, you can set the ButtonDisplayStyle property on the column to Always.

    Regarding the events, I don't see anything wrong with the code you have here. You are hooking the EditorButtonClick event of the editor, and that's the correct way to handle it. I don't see any reason why the events should not be firing.

     

Reply Children