Project

General

Profile

[wt v3.3.3] Editable item cursor position

Added by Vincenzo Romano over 10 years ago

I have some WStandardItem s which are set up as setFlags( ItemIsEditable ).

When I trigger the editing (single click in my case), the cursor position is always put at the field beginning.

I'd need to be able to position it somewhere else. Is it possible?

P.S.

I suspect answer is "no, you cannot" as not even the WLineEdit objects are allowed to position the cursor .


Replies (2)

RE: [wt v3.3.3] Editable item cursor position - Added by Vincenzo Romano over 10 years ago

To me a "no" answer sounds better than no answer.

Any idea?

RE: [wt v3.3.3] Editable item cursor position - Added by Eivind Midtgård over 10 years ago

I'd guess you could do it using JavaScript or jQuery. It should be possible for each element that has a caret position (not cursor position: that belongs to the mouse). This stack overflow question has some suggestions: http://stackoverflow.com/questions/499126/jquery-set-cursor-position-in-text-area

See Wt::WWidget::doJavaScript

Beware! I haven't tried it.

Regards,

Eivind

    (1-2/2)