Re: How insert to Edit Text

new topic     » goto parent     » topic index » view thread      » older message » newer message

----- Original Message -----
From: <aku at inbox.as>
To: "EUforum" <EUforum at topica.com>
Subject: How insert to Edit Text


>
> How can I insert text at cursor position into an edittext control?
>

Hi Aku,

here is a sample program you could try...


----------------
include win32lib.ew
constant win = create(Window, "", 0, 0, 0, 400, 300, 0),
         fld1 = create(EditText, "", win, 5, 5, 300, 25, 0),
         fld2 = create(EditText, "", win, 5, 35, 300, 25, 0),
         btn = create(Button, "Insert", win, 5, 75, 56, 40, 0)

procedure ins()
    integer where
    sequence newtext
    sequence oldtext
    sequence updtext

    where = getIndex(fld1)
    newtext = getText(fld2)
    oldtext = getText(fld1)

    updtext = oldtext[1 .. where-1] & newtext & oldtext[where  ..
length(oldtext)]

    setText(fld1, updtext)
    setIndex(fld1, where + length(newtext))

end procedure
onClick[btn] = routine_id("ins")

WinMain(win, 0)
----------------

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu