Author Topic: Caret when first clicking in a text box  (Read 2414 times)


  • Guest
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

Offline Kitty Hello

  • code monkey
  • Administrator
  • Prof. Inline
  • *******
  • Posts: 10816
  • here on my island the sea says 'hello'
    • View Profile
Re: Caret when first clicking in a text box
« Reply #1 on: 2010-Jun-22 »
This seems to fix it best
Code: (glbasic) [Select]
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: