BASIC

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

MrTAToad

  • 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: 10720
  • here on my island the sea says 'hello'
    • View Profile
    • http://www.glbasic.com
Re: Caret when first clicking in a text box
« Reply #1 on: 2010-Jun-22 »
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: