From fnaumann@mail.cs.uni-magdeburg.de Tue Feb 17 01:57:19 2004 From: Henk Robbers To: mint@fishpool.com Subject: Re: [MiNT] off topic: objc_edit() problem Date: Tue, 17 Feb 2004 01:53:32 +0100 User-Agent: KMail/1.5.1 References: In-Reply-To: MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200402170153.32494.h.robbers@chello.nl> Delivered-To: mint@fishpool.com Delivered-To: mint@lists.fishpool.fi X-ecartis-version: Ecartis v1.0.0 Sender: mint-bounce@lists.fishpool.fi Errors-to: mint-bounce@lists.fishpool.fi X-original-sender: h.robbers@chello.nl Precedence: bulk List-help: List-unsubscribe: List-ID: X-List-ID: 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