Re: TextStyle and Colour

Scott Raney (raney@metacard.com)
Tue, 1 Aug 1995 14:00:37 -0600 (MDT)

>
> I have a question regarding the use of textStyle and textColor.
>
> Scenario:
>
> field "X" containing a word "foo" and "foo" is blue (hey that
> rhymes!).
>
> field "Y".
>
> I want to move "foo" from field "X" to field "Y". That is easy enough.
> (put word 1 of field "X" into field "Y"). However, "put" doesn't
> maintain the textStyle or Colour, so I need to write some additional
> code (set the textColour of word 1 of field "Y" to the textColor of word
> 1 of field "X")
>
> This works, but if there is a large amount of data that I want to move,
> it becomes unwieldy (not to mention slow) to save the textStyle and
> Colour for every word in field "Y" and apply it to field "X".
>
> Is there any other solutions?

The only other possible solution is to use copy/paste:
copy line 3 of field 1
paste

Unfortunately, this probably won't work for you since paste always
pastes into the field with the keyboard focus, and always at the
cursor location. Since list boxes don't have a cursor, this probably
won't work in your application. This technique does preserve
attributes, however.

On the other hand, if it's really just for list boxes, the amount of
data you're moving won't be that big and so there shouldn't be any
performance problems doing it the way you've proposed. Also, you
don't have to save the textStyle/textFont for the choices separately,
just get them from the source list box field itself. For example,
putting the following script in the source list box does everything
you need:
on mouseDoubleUp
put the selectedText & return after field "choices"
set the textStyle of the last line of field "choices"\
to the textStyle of the selectedChunk
set the textColor of the last line of field "choices"\
to the textColor of the selectedChunk
end mouseDoubleUp

> In case you are wondering what type of UI I have for this situation. I
> have two list boxes, one of *possible choices*, and another for
> *current choices*. And the user can select items from the possible and
> move them to the current. The items in the possible actually consist of
> several types of things, so they are designated using different Styles
> (bold,italic) and Colour (although the colour may be dropped). Now this
> may not be the best UI technique, but for the situation it isn't as
> confusing as you may think. It may be best to have 3 separate possible
> and current, but that would take up a fair amount of screen area.

I think a better UI technique would be just to use multiple-selection
list boxes. My guess is that people will have a lot of trouble
remembering which color/font goes with which type of thing.
Maintaining the different things in different boxes and allowing
people to select multiple things in each box would probably be easier
for them.
Regards,
Scott

> Thanks for any help.
>
> -Earle
>
> --
> Earle Lowe
> emlowe@fsa.ca
> FSA Corporation
> Performance and system software for UNIX networks.
>
>

-- 
***********************************************************************
* Scott Raney  303-447-3936            Remember: the better you look, *
* raney@metacard.com                   the more you'll see -- Lidia   *
***********************************************************************