Caret when first clicking in a text box

Previous topic - Next topic

MrTAToad

I think I've found why the caret wasn't being displayed when first clicking on a text box.  It seems that the following is the cause of the problem :

Code (glbasic) Select
caretpos = wdg.wselend

It appears that wselstart and wselend is 1 for an empty field, so at line 1589 I have added :

Code (glbasic) Select
IF caretpos>LEN(str$) THEN caretpos=LEN(str$)

Its not the most efficient (or best) place to do it, but it'll do for now...

I've noticed that DDgui_boxprint returns the height of the caret, but is used elsewhere are the column position...  :S

Kitty Hello

This seems to fix it best
Code (glbasic) Select

ELSE
LOCAL strleng% = LEN(str$)
IF wdg.wselend>strleng THEN wdg.wselend=strleng
IF wdg.wselstart>strleng THEN wdg.wselstart=strleng
caretpos = wdg.wselend


thank you for finding this!  :coke: