[comp.lang.objective-c] Capturing mouse actions

jrscs@uno.edu (03/26/91)

   Does anyone know how I can capture the mouse's selecting a text area
by highlighting.  When the user selects some text, I would like to make
available an option to call up Webster to define the word.  Calling up
Webster is no problem; it's knowing when the Webster option should be
enabled by seeing if the user has highlighted a word with the mouse.  I
think mouseUp, mouseDown, ... might do the trick but not sure how to use
them.  Also, if mouseUp, ... do need to be re-implemented, where should that
be done - as a subclass of Text.  If this is so, can the Text object inside
the ScrollView from the Interface Builder palette have its class changed
to this new subclass via Interface Builder?

Thanks.

jrscs@uno.edu (04/02/91)

   Does anyone know how I can capture the mouse's selecting a text area
by highlighting?  When the user selects some text, I would like to make
available an option to call up Webster to define the word.  Calling  up
Webster is no problem; it's knowing when the Webster option should be
enabled by checking if the user has highlighted a word with the mouse
that I'm not sure about.

Thanks,
John

diamond@jit345.swstokyo.dec.com (Norman Diamond) (04/03/91)

In article <0094684B.EDD0D820@uno.edu> jrscs@uno.edu writes:

>   Does anyone know how I can capture the mouse's selecting a text area
>by highlighting?

Why have we seen several postings on such topics recently in _comp.object_?
I don't think mouse actions have been considered relevant to the design of
object-oriented languages other than Smalltalk (and that one was because of
confusion between the language and the user interface).
--
Norman Diamond       diamond@tkov50.enet.dec.com
If this were the company's opinion, I wouldn't be allowed to post it.

lerman@stpstn.UUCP (Ken Lerman) (04/04/91)

In article <0094684B.EDD0D820@uno.edu> jrscs@uno.edu writes:
>
>   Does anyone know how I can capture the mouse's selecting a text area
>by highlighting?  When the user selects some text, I would like to make
>available an option to call up Webster to define the word.  Calling  up
>Webster is no problem; it's knowing when the Webster option should be
>enabled by checking if the user has highlighted a word with the mouse
>that I'm not sure about.
>
>Thanks,
>John


I think this guy has been watching too much television. :-) Let me see
now.  He wants to capture something about a mouse (Saturday morning
cartoons ?).  Then there is something about a little black kid named
Webster.

Maybe I don't understand.  I've been programming in Objective-C for
seven years now and I don't understand what this question has to do
with Objective-C.

I suggest that questions like this belong in comp.sys.next, NOT
comp.object or comp.lang.objective-c.

There is, of course, a problem that the question might be lost in the
volume of comp.sys.next.  In that case, it might be appropriate to
create comp.sys.next.programming (or some such).

{ NO, I am NOT flaming Mickey Mouse, Webster, John, or television in general. }

As always, this is my opinion, for which I am solely to blame...

Ken

smith@glinda.ctron.com (Larry Smith) (04/05/91)

In article <6745@stpstn.UUCP> lerman@stpstn.UUCP (Ken Lerman) writes:
>In article <0094684B.EDD0D820@uno.edu> jrscs@uno.edu writes:
>>
>>   Does anyone know how I can capture the mouse's selecting a text area
>>by highlighting?  When the user selects some text, I would like to make
>>available an option to call up Webster to define the word.  Calling  up
>>Webster is no problem; it's knowing when the Webster option should be
>>enabled by checking if the user has highlighted a word with the mouse
>>that I'm not sure about.

>I suggest that questions like this belong in comp.sys.next, NOT
>comp.object or comp.lang.objective-c.

Questions belong whereever they can get an answer, and I assume the newsgroups
reflect the posters available choices of hardware.  In any event, the biggest
waste of bandwidth on the net is people complaining about other peoples choice
of venue for postings.

To answer the original question, I'd suggest enabling a popup menu whenever a
piece of text is selected.  It would have the usual things you might want to
do with marked text - cut, copy, etc, and also have "dictionary" which could
define all words in the marked area.  You might also have this entry under your
"File" menu and leave it disabled unless text is selected.  As a general rule,
the user should always be able to reach all major functionality via the top
level menu, popups are handy for experienced users but new users may not think
to look for them.

Popups are usually associated with mouse 2.

Above assumes Motif, Open Look is similar, Next is weird, but above should be
ok from their GUI style, too (not sure what mouse button to associate the
popup with, tho).

Larry Smith
smith@ctron.com