07-11-2023 11:54 AM - edited 07-11-2023 11:54 AM
I have a multicolumn listbox that has disabled, greyed out columns. I do this by discarding any click events on the columns themselves.
If the user presses an edit "cell", it makes that column editable
The problem is, when I press "Save" the way I get the buttons to work is the mouse down? event is discarded so the user can't edit the text in the cell. Otherwise the default MC Listbox behavior will allow them to change the "Save" text to something else. However, if I try to set the edit cell property to -2,-2 which is supposed to be "No cell selected for editing" per the context help, it actually sets cell 0,0 to be the edit position! And if I don't change the edit position at all, i get the following, which allows a cell to continue to be edited even after save was pressed.
Is there any way to easily de-activate the cell being edited? I'm starting to think simulating a click off the listbox may be the only way. I could also handle an edit event on the MC Listbox and discard it if the user changes a value in an un-editable column. But that is not ideal because the UI will be kind of confusing that way.
Solved! Go to Solution.
07-11-2023 01:29 PM
Instead of alter edit position, maybe set/unset Allow Editing Cells?
07-11-2023 03:57 PM - edited 07-11-2023 03:58 PM
@zou wrote:
Instead of alter edit position, maybe set/unset Allow Editing Cells?
Unfortunately that doesn't work either
07-11-2023 04:09 PM
I solved this by setting focus on the MC Listbox then using the Keybd_event function in user32.dll to send an <Enter> keystroke, which causes the user entry to be accepted.
07-11-2023 04:15 PM
I can post my VI this evening.
Or you can try KeyFocus to other ctrls instead of simulate a click.
07-12-2023 01:01 PM
@zou wrote:
I can post my VI this evening.
Or you can try KeyFocus to other ctrls instead of simulate a click.
Same issue with a Table Control and the Mouse Down Event for a similar type UI with non-editable cells. Using @zou's suggestion, that is setting KeyFocus to FALSE for the Table Control allows one click in a cell and clear any edit positions in the table.