Addition: Since this thread does apply to unicode apparently. my guess the pseudocode for this would be something like..
On click get the clickcharchunk --get the unicodetext from the field determine if the clichcharchunk word 2 number returned is at the single or double byte position and adjust accordingly (again, haven't ever really dealt with unicode, but mark mentioned something about this) set a holding container to char 1 to your calculated split point. At this point you don't really need to put the 2nd half into a holding container, should be able to delete char 1 to your calculated split point in your container then set the unicodetext of the original field to the unicodetext of field "Your holding container" & the unicode you want inserted & the unicodetext of field "the original field" On Sun, Aug 29, 2010 at 6:49 AM, Mike Bonner <[email protected]> wrote: > I don't think this applies when using get and set for unicode, but if > its a straight text field where you can use put, there are a couple > options. > > YOu can do: > > put "What I want inserted" into the selectedtext > > This will insert at the insertion point if nothing is selected, or > will replace whatever is selected in the field. > > Or, you can do > > put "What I want inserted" after char (word 4 of the selectedchunk) of field 1 > > But if I recall correctly, this solution is a little more complicated > because you have check word 2 and word 4 of the selectedchunk to see > whats selected then determine programatically in that range where the > insertion should occur, or if the selection should be removed or... > If the selection is just an insertion point, then the example above > (word 4 of the selectedchunk) of field "yourfield" works fine. > > Another option, if the text of the field is locked, is to check the > clickcharchunk which will return the number position of the clicked > char (same format as clickchunk or selectedchunk except both word2 and > word 4 will be the same) at which point you can decide to put > something before or after that char, or split the field at that spot. > To do the insertion directly with this method, your mouseup handler > could contain: > on mouseup > put "your insertion string" before char (word 2 of the clickcharchunk) of > me > end mouseup > > On Sun, Aug 29, 2010 at 5:09 AM, Richmond <[email protected]> wrote: >> Imagine a field "fTX" that contains the text 'meaty chunks'; >> when I click between 'meaty' and 'chunks' I want to be >> able to insert something there via code rather than via keyboard. >> >> So, why does this not work; in the script of fld "fTX" ? >> >> on mouseUp >> select the text of me >> end mouseUp >> >> i.e. the text in fld "fTX" is not selected. >> >> Now: >> >> 1. How can I get to a situation where when I click in a textField containing >> text I get this: >> >> 1.1. the part of the string in the field before the place where I click (or >> move my cursor) is selected >> and put into another field (e.g. 'fBEFORE') and the part of the string >> after the place where I click >> (or move my cursor) is selcted and put into another field (e.g. >> 'fAFTER')? >> >> 1.2. allowing me to INSERT text programmtically between the 2 chunks of the >> string. >> >> Something tells me (I dunno what) that I am not being screamingly original >> and this must be: >> >> 2.1. Documented somewhere. >> >> 2.2. Have been done many, many times before. >> >> 2.3. I am just being 'plain stooopid'. >> >> Richmond. >> _______________________________________________ >> use-revolution mailing list >> [email protected] >> Please visit this url to subscribe, unsubscribe and manage your subscription >> preferences: >> http://lists.runrev.com/mailman/listinfo/use-revolution >> > _______________________________________________ use-revolution mailing list [email protected] Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-revolution
