3 questions from a newbie

Rob Meijer robmeyer at hetnet.nl
Thu Mar 31 14:10:34 EST 2005


Robert,
Thanks. If now you can find the cause why the line is not hilited
permanently...
I don't see it
Rob

At 17:03 31/3/2005, Robert Brenstein wrote:
>At 17:07 +0200 31.03.2005, Rob Meijer wrote:
>>I am in my second trial period, still trying to
>>complete a application.
>>For this time I cannot find a solution for:
>>
>>1.
>>how to import an icon from elswhere?
>>I cannot find the good one in the build-in iconlist
>
>Import image or copy-paste should do. An icon is just an image of certain 
>size.

OK


>>2.
>>In a listbox-field I want the selectedt line be hilited permanently
>>until a next line is clicked. Now the the line is hilited for the
>>tihe mouse is pressed down.
>
>Make it a list field (lock it and set the autohilite to true).
>However, I suspect that you aleady have that and the hilite disappears on 
>mouseUp because of something in the script.

RIGHT,
THIS IS THE SCRIPT THAT INTERVENES
LIKE YOU THOUGHT, BUT I DON'T SEE IT:

on fillfield
   set the lockscreen to true
   get cardnames of this stack
   put (number of lines of it) into Lastline
   repeat with i = 1 to Lastline
     put quote&char 1 to 32 of line i of it&quote &","after list
   end repeat

   ---    LIST TO ALPHABETIC TEXTLINES
   set the foregroundcolor of field "content" to black
   if last char of list="," then
     clear last char of list ------------komma weg
   end if
   sort items of list -----------------alphabetisch
   repeat with  i = 1 to Lastline
     put item i of list &linefeed after tempfield
   end repeat

   ------        CLEAR QUOTES
   replace quote with "" in tempfield
   set text of field "content" to tempfield
   set the listbehavior of fld "content" to true
end fillfield

>You may set the hilitedLines to restore the selection at the end of the 
>handler (cf script below).

DON"T SEE WHAT YOU MEAN;



>>3.
>>In the same listboxfield I want to choose a line just by pressing down
>>a key: f.i. the R to get the first line beginning with a R.
>>The only way to choose now is with mouse or arrow-keys.
>
>place the following handler on the card (untested but fully commented):
THIS WORKS FOR ME

on keyDown theKey
   set the cursor to watch
   -- transfer fld "content" to var
   get fld "content"
   -- preserve current selection
   put the hilitedlines of field  "content" into h
   -- preset line counter
   put 1 into s
   -- loop through lines
   repeat for each line t in it
     -- increase counter (we are purposefully 1 off)
     add 1 to s
     -- escape if condition met
     if char 1 of t is theKey then exit repeat
   end repeat
   -- check if we found a match
   if s > the number of lines of it then
     -- no match so restore earlier selection
     put h into s
     -- tell user that no match found
     beep
   else
     -- correct line reference
     subtract 1 from s
   end if
   -- update display if a line is selected
   if s is not empty then
     -- set the hilite
     set the hilitedLines of fld "content" to s
     -- scroll the field accordingly (12 is line height)
     set the scroll of fld "content" to (s-1)*12
   end if
end keyDown

>Robert Brenstein

robmeyer at hetnet.nl
www.japrosoft.com
no more spam: Mailwasher Pro
http://www.firetrust.com/products/pro/
and please mention my emailaddress...  


More information about the use-livecode mailing list