Shift-tab

BNig bernd.niggemann at uni-wh.de
Tue Aug 5 06:02:56 EDT 2014


Pete,

in a scrolling editable field with columnar data delimited by tabs of the
form

data tab data return
data tab data return

i.e. no additional tab before the return

the following code works for me for the tab key and shit-tab key to move
from one item to the other (tested in 6.6.2, 6.7DP7 and 7.0DP8)

-------------------------------------------------
on tabKey
   set the itemDelimiter to tab
   put the selectedChunk into tSelect
   put word 2 of tSelect into tIndex
   put the number of lines of char 1 to tIndex of me into tCurrLine
   put (the number of chars of line 1 to tCurrLine - 1 of me) + 1 into
tChars
   put tIndex - tChars into tLineChar
   put the number of items of line tCurrLine of me into tNoItemsInLine
   put the number of items of char 1 to tLineChar of Line tCurrLine of me
into tCurrItem
   
   if the shiftKey is down then
      if tCurrItem = 1 then
         if tCurrLine > 1 then
            select after item (the number of items of line tCurrLine - 1 of
me) of line tCurrLine - 1 of me
         end if
      else
         select after item tCurrItem-1 of line tCurrLine of me
      end if
   else
      if tCurrItem = tNoItemsInLine then
         select after item 1 of line tCurrLine + 1 of me
      else
         select after item tCurrItem + 1 of line tCurrLine of me
      end if
   end if
end tabKey
--------------------------------------------
the difference of the two scripts has to do with how LC counts items across
lines and within a line.

I would rather not like to start a discussion about how items are counted... 

Kind regards
Bernd



--
View this message in context: http://runtime-revolution.278305.n4.nabble.com/Shift-tab-tp4681722p4681744.html
Sent from the Revolution - User mailing list archive at Nabble.com.




More information about the use-livecode mailing list