Re: RE: [win32] cursor

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

global procedure insertText( integer id, sequence text )

   -- replace selection; True means allow undo
   VOID = sendMessage( id, EM_REPLACESEL, True, text)

end procedure


7/11/2002 2:13:05 PM, mistertrik at hotmail.com wrote:

>
>I tried that, and in the IDE it recognised it, but it said it couldn't find 
>it when I ran the program.. I must have an older version of win32lib.
>=====================================================
>.______<-------------------\__
>/ _____<--------------------__|===
>||_    <-------------------/
>\__| Mr Trick
>
>
>>From: Derek Parnell <ddparnell at bigpond.com>
>>Reply-To: EUforum at topica.com
>>To: EUforum <EUforum at topica.com>
>>Subject: Re: RE: [win32] cursor
>>Date: Thu, 07 Nov 2002 13:26:41 +1100
>>
>>
>>Actually you can do this in the current Win32lib...
>>
>>  insertText(myctrl, "hello there")
>>
>>instead of the getIndex() and setText() method.
>>
>>Also, setIndex() does set the cursor position in edit boxes.
>>
>>
>>7/11/2002 12:35:50 PM, Brian Broker <bkb at cnw.com> wrote:
>>
>> >
>> >You might consider using sendMessage and EM_REPLACESEL instead of your
>> >method outlined below.
>> >
>> >Example:
>> >
>> >     out = allocate_string("something to insert")
>> >     if sendMessage(myctrl,EM_REPLACESEL,True,out) then end if
>> >     free(out)
>> >
>> >Only problem might be making sure nothing is selected at the time
>> >because it will be replaced.  If nothing is selected then it just
>> >inserts text at point of cursor...
>> >
>> >-- Brian
>> >
>> >mistertrik wrote:
>> >> bah.... ok thanks.
>> >>
>> >> I think that there should be at least a wrapper func called
>> >> getCursorPosition or something.
>> >>
>> >> Also, to insert text where the cursor is, it looks like I'm going to
>> >> have to
>> >> do something like this:
>> >> sequence text
>> >> atom pos
>> >> text = getText(myctrl)
>> >> pos = getIndex(myctrl)
>> >> setText(myctrl, text[1..pos] & "hello there" &
>> >> text[pos+1..length(text)])
>> >>
>> >> In my mind, when setSelectedText was called, if there wasn't anything
>> >> selected it would insert text at the cursor position.
>> >> That seems to be more logical, rather than do nothing.
>> >>
>> >> =====================================================
>> >> .______<-------------------\__
>> >> / _____<--------------------__|===
>> >> ||_    <-------------------/
>> >> \__| Mr Trick
>> >>
>> >>
>> >> >From: Derek Parnell <ddparnell at bigpond.com>
>> >> >Reply-To: EUforum at topica.com
>> >> >To: EUforum <EUforum at topica.com>
>> >> >Subject: Re: [win32] cursor
>> >> >Date: Thu, 07 Nov 2002 11:37:49 +1100
>> >> >
>> >> >
>> >> >Its not documented as such but the getIndex() call will return the
>> >> >cursor
>> >> >location from an edit or
>> >> >richedit box. Currently the docs only mention ListView and Treeview, 
>>but
>> >> >it
>> >> >also works for Listbox
>> >> >and Combos.
>> >> >
>> >> >7/11/2002 11:27:13 AM, mistertrik at hotmail.com wrote:
>> >> >
>> >> > >
>> >> > >How do you find the cursor position in a MLEedit?
>> >> > >
>> >> > >I have an edit window, and I want to be able to insert a string into
>> >> >where
>> >> > >the cursor position is.
>> >> > >
>> >> > >=====================================================
>> >> > >.______<-------------------\__
<snip>

>
>
>
Cheers,
Derek Parnell 
ICQ# 7647806

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

Search



Quick Links

User menu

Not signed in.

Misc Menu