Norval Bard wrote:
> 
>  A while back I asked this question, and when I recently encountered the
> problem again, I returned to the archives to see what answers were
> provided, but I couldn't locate the query, so here goes (again)...
> 
> Using a find command to locate the clickText in a given field returns
> the string with a thin, black box around it.  What can I do to elimate
> (render invisible, etc.) that box?

I ran into the same problem and had the assistance of a lot of helpful
and knowledgeable folks on the list. I'm appending the scripts I'm using
for this problem...finding and highlighting with a color while changing
the font style. When you click some place else, either in the field or
elsewhere, the appearance changes back. It may not be exactly what you
need, and I may have documented it poorly, but it may give you a start.
Don't hesitate to e-mail me with any questions. BTW, I'm sure the real
wizards on the list can clean it up, but this works for me in several
different functions - both for searches initiated from within the stack
and from other stacks.

Mary Bull
[EMAIL PROTECTED]

-----

THIS IS IN THE STACK SCRIPT:

on resetFoundText
  global gChunk,gTextChunk,gOldStyle,gOldColor,gOldBack
  -- the info stored in gOldStyle, gOldColor, gOldBack is put there in
the "find" script
  if gChunk<> empty then    -- this find comes from another stack
    lock screen
    set the backColor of gChunk to gOldBack
    set the textStyle of gChunk to gOldStyle
    set the textColor of gChunk to gOldColor
    unlock screen
  end if
  put empty into gChunk
end resetFoundText


THIS IS IN THE SEARCHABLE FIELD'S SCRIPT:

on selectionChanged
  resetFoundText
end selectionChanged


THIS IS IN THE CARD SCRIPT:

on selectionChanged
  resetFoundText
end selectionChanged


THIS IS IN THE FIND BUTTON:

on mouseUp
  global gTextToFind,gChunk,gTextToSkip
  global gOldBack,gOldStyle,gOldColor
  global gFoundBack,gFoundStyle,gFoundColor
  -- gFoundBack is the background color of the highlighted text;
  -- gFoundStyle is the text style of the highlighted text;
  -- gFoundColor is the color of the highlighted text;
  -- these are all set in the openStack handler of the stack script
  
  ask "What text do you want to find?"
  if the result is "Cancel" then
    exit mouseUp
  else
    put it into gTextToFind  -- I store this for use in a "Find Again"
button script
    put offset(gTextToFind, fld "storyText") into tTextOffset
    if tTextOffset = 0 then
      answer "Sorry, the text was not found"
      exit mouseUp
    else
      put "char" && tTextOffset && "to" && tTextOffset +
length(gTextToFind) \
       -1 && "of fld 1" into gChunk
      put tTextOffset + length(gTextToFind) - 1 into gTextToSkip
      # begin colorizing here
      put the backColor of gChunk into gOldBack
      put the textStyle of gChunk into gOldStyle
      put the textColor of gChunk into gOldColor
      set the backColor of gChunk to gFoundBack
      set the textStyle of gChunk to gFoundStyle
      set the textColor of gChunk to gFoundColor
      # scroll the field
      set the scroll of fld 1 to the formattedTop of gChunk - the top of \
       fld 1 + the scroll of fld 1 - 15
    end if
  end if
end mouseUp

This is the MetaCard mailing list.
Archives: http://www.mail-archive.com/metacard%40lists.best.com/
Info: http://www.xworlds.com/metacard/mailinglist.htm

Reply via email to