Listbox input

Windows 10 / XOJO 2018r4

Is there a way to limit the input value in a editable listbox cell.
The input must be between 0 and 127. It may not exceed 127.

Thanks
Regards
Etienne

You have the opportunity to validate the entered value in the https://documentation.xojo.com/api/deprecated/listbox.html#listbox-cellaction event.

Hi Tim,

Correct, that is what I am doing for the moment.
But I was trying to limiting the typing in the cell.
It would already be helpful if the number of charactres could be limited to 3 while entering.

regards
Etienne

It looks like https://documentation.xojo.com/api/deprecated/listbox.html#listbox-activetextcontrol returns an actual TextEdit field, so you may be able to set a limit text or mask on that. I haven’t tested this idea though.

I would use CellKeyDown to validate each character (i.e. digits) and CellAction to validate the complete entry. ActiveTextControl is an API2 thing.

That’s a good idea as well. By the way, https://documentation.xojo.com/api/deprecated/listbox.html.ActiveCell is the API 1.0 name.

I tend to create a “cell editor handler” and then the rowtag holds an instance and the listbox itself then checks to see if the specific event should be delegated to one of these (ie/ if there is a rowtag then it calls the delegates method)
then I can have each draw the cell in whatever way I want, handle keydowns clicks etc etc etc all in a reusable and extensible way