Search code examples
textfieldcodenameonelong-press

how to get long press event of textfield in codename one


I am developing in Codename One.

I am having TextField in one form.

I want to open a dialog box on TextField's long press event

So how can I get long press event of TextField in codename one ?

I already tried by impementing ActionEvent and checked with

if(event.isLongEvent()){

}

but its not working..

Any idea ?

Thanks in advance. Akash


Solution

  • Since text field uses native editing the long press event will be grabbed by the native editing functionality so for the text field it just won't work well.

    You can derive most components and override longPress or add a long press listener to the form which will have a similar effect but its likely to cause an issue with the native input.