Hello, I have a double click event to allow editing of my cell in column 0. Once the edit is complete, how do I then change the cell back to non-editable? How do I trigger the end of the cell being edited?
I want to do this, since , while the cell is editable the hierarchical expand and collapse do not work when the cell is editable.
[quote=333818:@Robert Kantor]Hello, I have a double click event to allow editing of my cell in column 0. Once the edit is complete, how do I then change the cell back to non-editable?
set the cell to not be editable - see http://documentation.xojo.com/index.php/ListBox.CellType
[quote=333818:@Robert Kantor]How do I trigger the end of the cell being edited?
In code ? if the user leaves the cell, presses enter then THEY end the edit
Thank you. CellLostFocus was the event I was missing and then I set the cell back to normal.
Note that cells WON’T ALWAYS lose focus
Suppose you ave a dialog or something and a person can edit a cell
And on this dialog there’s a “Save” button
In a scenario like
- person starts editing and types in a value
- doesn’t press return and doesn’t click anywhere else EXCEPT on the save button
on macOS the Save button does NOT get focus so the cell wont lose focus
You may need to take some action (like setting the focus elsewhere) in the buttons action to force the lost focus event in the cell to occur
Windows and Linux may behave differently here and pressing the button may give the button focus
Never assume that a cell lost focus will ALWAYS happen - if you need it to then force it to happen
The way I do it is to call SetFocus on the listbox itself. That causes the cell to lose focus and revert back to display mode.
ps: I find that sometimes a cell will NOT go into edit mode no matter how much double clicking occurs.
Have to refresh the list to make it work again