I have two questions for anyone that can answer them or help me. First I need a way to find the location of the ibeam in a field because i have written some script to show some script hints in a field while typing or editing script.
So i need a way to get item -1 before the ibeam returned to me.
And second, is there anyway to set and limit the width of tabs in a tabbed button?
Any help would be appreciated.
Many Thanks,
Christopher
How to find location of ibeam in field
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller
-
- Posts: 52
- Joined: Sun Jan 20, 2008 7:06 am
-
- VIP Livecode Opensource Backer
- Posts: 977
- Joined: Sat Apr 08, 2006 7:47 am
- Contact:
You cannot set the tab width of tab buttons - if it's too narrow for your taste, you can always try and prepend+append the labels of the individual tabs; but if you're looking to give them a fixed width, you'll have to roll your own tabbed buttons control by making a group and sticking buttons in it.
As for your first question: 'the selectedChunk' is your friend.
When the user has selected some text, the selectedChunk will give you the offsets of the selection. For instance: char 4 to 9 of field "MyField"
When there is no selection and the ibeam is blinking between two characters, the selectedChunk can still help, as it will be in a special format. For instance: char 4 to 3 of field "MyField"
So, you can effectively get the last item before the ibeam location and put it in another field, by putting the following script into your field:
Hope this helped,
Jan Schenkel.
As for your first question: 'the selectedChunk' is your friend.
When the user has selected some text, the selectedChunk will give you the offsets of the selection. For instance: char 4 to 9 of field "MyField"
When there is no selection and the ibeam is blinking between two characters, the selectedChunk can still help, as it will be in a special format. For instance: char 4 to 3 of field "MyField"
So, you can effectively get the last item before the ibeam location and put it in another field, by putting the following script into your field:
Code: Select all
on rawKeyUp
local tStart, tEnd
put word 2 of the selectedChunk of me into tStart
put word 4 of the selectedChunk of me into tEnd
if tEnd < tStart then
put item -1 of (char 1 to tEnd of me) into field "PrevItem"
end if
pass rawKeyUp
end rawKeyUp
Jan Schenkel.
Quartam Reports & PDF Library for LiveCode
www.quartam.com
www.quartam.com