FB II Compiler

PG PRO

Debugging

Memory

System

Mathematics

Resources

Disk I/O

Windows

Controls

Menus

Mouse

Keyboard

Text

Fonts

Drawing

Sound

Clipboard

Printing

Communication

ASM

Made with FB

TEXT

Insert text in an Edit Field


Where Edit$(100) = whaterver your edit field # is
Txt$ = text string you want to add

EDIT FIELD #100 '<---this activates the edit field
TexH& = TEHANDLE(100)
SETSELECT _maxint,_maxint
CALL TEINSERT(@Txt$+1,LEN(Txt$),TexH&)
cr$ = CHR$(13)
TEKEY$ = cr$
EDIT FIELD #0 <--- deactivates editfield

This should do it for you.

Mike


'=================
' could be called for instance :
' FN NewInsertText(efID,@text$,_maxint,_maxint)
' or
' FN NewInsertText(efID,strHndl&,_maxint,_maxint)
' or
' FN NewInsertText(efID,strPtr&,_maxint,_maxint)

CLEAR LOCAL MODE
  DIM teH&,strPtr&,state%,OSErr%

LOCAL FN NewInsertText (fieldID%, memAdr&, startPos%, endPos%)
  teH& = TEHANDLE(fieldID%)
  LONG IF teH&
    state%=FN HGETSTATE(memAdr&)
    LONG IF state%>-1
      strLen% = FN GETHANDLESIZE(memAdr&)
      OSErr%=FN HLOCK(memAdr&)
      strPtr&=[memAdr&]
    XELSE
      strLen% =PEEK(memAdr&)
      strPtr&=memAdr&+1
    END IF
    LONG IF OSErr%=_noerr
      CALL TESETSELECT (startPos%, endPos%, teH&)
      CALL TEINSERT (strPtr& , strLen%, teH&)
      CALL INVALRECT (teH&..viewRect%)
      IF state%>-1 THEN state%=FN HSETSTATE(memadr&,state%)
    END IF
  END IF
END FN
'=================

Alain