How do I trap the "text insertion point"?

Alan Gayne alanIra9 at mac.com
Wed Oct 23 22:36:01 EDT 2002


Ken,

Thanks for the ideas.  Actually I came up with something a bit different.

The following handler is in the stack script:
	on selectionChanged
  		 set the cInsertionPoint of this stack to the selectedChunk
	end selectionChanged

The button script is as follows: (actually since the button is part of a 
group "buttonBar" the mouseUp handler is in the script of the group -- 
the cBtnText is the custom property of each button where the text is 
stored
	on mouseUp
  		 put the last word of the cInsertionPoint of this stack into 
activeFld
  		 if fld activeFld is empty then
   			  put the cBtnText of the target into fld activeFld
  		 else
     			set the typingRate to 0
    			 type the cBtnText of the target
  		 end if
	end mouseUp

This seems to work great.

Speaking of the "buttonBar" group, I'd also like to emulate the Quickeys 
feature where the user can option-drag a button to duplicate it and then 
be able to drag it to another location on the buttonBar and then have 
the other buttons move so as to get out of the way.  Anyone have an idea 
about this one?

Thanks and regards,
Alan
On Wednesday, October 23, 2002, at 10:11  PM, Ken Ray wrote:

> Alan,
>
> How about:
>
> 1) set the traversalOn of the button to false -- so it doesn't take the
> focus away from the field
>
> 2) have the button say either:
>
> -- "field 1" is your field and "the myProp of this card" is your custom
> property
>
> on mouseUp
>   if the selectedChunk of field 1 is not empty then
>     type (the myProp of this card)
>   end if
> end mouseUp
>
> This has the effect of "typing" the text so you see it show up one 
> character
> at a time. If this is too slow, you can do:
>
> on mouseUp
>   if the selectedChunk of field 1 is not empty then
>     put (the myProp of this card) before char (word 2 of the 
> selectedChunk)
> of field 1
>   end if
> end mouseUp
>
> Hope this helps,
>
> Ken Ray
> Sons of Thunder Software
> Email: kray at sonsothunder.com
> Web Site: http://www.sonsothunder.com/
>
>
>
> ----- Original Message -----
> From: "Alan Gayne" <alanIra9 at mac.com>
> To: <use-revolution at lists.runrev.com>
> Sent: Wednesday, October 23, 2002 6:17 PM
> Subject: How do I trap the "text insertion point"?
>
>
>> Hi all!
>>
>> I've been trying to emulate the Quickeys "Type Text" function - i.e. to
>> be able to click on a button and have the text that has been stored 
>> as a
>> custom property inserted at that place in a field where the text
>> insertion iBeam is located.  The only problem with this is that I can't
>> seem to find a way to find out the location of the iBeam so I cn tell
>> rev to put my text there.
>>
>> I would suspect that the iBeam insertion point is a system property
>> since Quickeys is able to insert text into any open application with an
>> editable field and such a basic property must be readily available to
>> every open application, including the RunRev script editor.
>> Nevertheless, after spending hours looking through the transcript
>> dictionary (for which a simple index would be REALLY helpful) I can't
>> seem to locate any function that either reports this property and
>> converts it to a location usable by RunRev.
>>
>> It seems like this has GOT to be something simple but I'll be darned if
>> I can find it.
>>
>> Any help would be greatly appreciated.
>>
>> Thanks in advance.
>>
>> Alan
>>
>> _______________________________________________
>> use-revolution mailing list
>> use-revolution at lists.runrev.com
>> http://lists.runrev.com/mailman/listinfo/use-revolution
>>
>
> _______________________________________________
> use-revolution mailing list
> use-revolution at lists.runrev.com
> http://lists.runrev.com/mailman/listinfo/use-revolution
>




More information about the use-livecode mailing list