[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [MiNT] off topic: objc_edit() problem
Hi Lonny and Konrad.
On Monday 16 February 2004 22:21, Lonny Pursell wrote:
> HI,
>
> This is probably not the place to ask this, but I don't know of a smarter
> community than the MiNT one, so I ask this here.
>
> I'm trying to allow the use of the mouse to position the text cursor within
> an editable text field. It almost works, I can click a char within a text
> field and if I type a char it indeed appears where it should. However the
> AES does not position the cursor correctly, it seems to always appear at
> the end of the field regardless. Does anyone here know if objc_edit() is
> faulty? I am using Naes for my testing.
objc_edit is ok but has limitations.
Make sure you do not use ED_END ED_INIT for positioning the cursor
with the mouse.
Only for switching between editable fields.
ED_INIT always puts the cursor on the null character of the
te_ptext string. Which is often at the end of the field.
After rsrc_load it might be convenient to put a null character at
the beginning of te_ptext. In that case you dont have to press ESC
every first time.
Do not change te_txtlen.
te_txtlen and te_tmplen tell the AES the amount of memory available
for the text and the template.
The template can be much larger than the editable text.
A wrong txtlen can cause corruption in adjacent fields and even
lead to bus errors.
A null character can be anywhere in the text field.
It indicates the amount of valid text in the field.
Anything after the null character is replaced by underscores
when the field is formatted.
The te_txtlen tells the AES how much can be typed at all.
It tells nothing about the cursor position.
It would have been nice if idx was used by ED_INIT as well, but such
is not the case.
--
Groeten; Regards.
Henk Robbers. mailto:h.robbers@chello.nl
http://members.ams.chello.nl/h.robbers/Home.html
Interactive disassembler: TT-Digger; http://digger.atari.org
A Home Cooked teXt editor: AHCX