Path: utzoo!attcan!uunet!deimos!ux1.cso.uiuc.edu!brutus.cs.uiuc.edu!apple!jdevoto From: jdevoto@Apple.COM (Jeanne A. E. DeVoto) Newsgroups: comp.sys.mac.hypercard Subject: Re: Making areas of field text clickable? Message-ID: <38623@apple.Apple.COM> Date: 14 Feb 90 00:33:32 GMT References: <3811@accuvax.nwu.edu> Organization: Apple Computer Inc, Cupertino, CA Lines: 41 In article <3811@accuvax.nwu.edu> neves@aristotle.ils.nwu.edu (David Neves) writes: >I have many field texts. I want to make most of the text in these >fields sensitive to clicks. The 2 ways of doing this are: >1. [compute pixel widths, taking word wrap into account] >2. [put buttons over the text] Why on earth would you want to go to all this trouble? Recall that a double-click selects a word. If the field is locked, it gets mouseDown messages. So the following will get you the word clicked on: on mouseDown set the lockText of the target to false -- so we can click w/o recursing click at the clickLoc click at the clickLoc -- double-click put the selection into clickedWord -- do whatever you're going to do, e.g. go to a card with that name end mouseDown You can put certain bells and whistles on this to e.g. refuse to do anything if the word is not in a certain list of key words. But that's the basic idea. If the field is not locked, you'll need to use a mouseWithin handler: on mouseWithin if the selectedChunk is not empty then -- user clicked if the selection is not empty then -- double click -- do double-click action; "the selection" is word clicked on else -- do single-click action, if any end if end if end mouseWithin -- ====== jeanne a. e. devoto ======================================== jdevoto@apple.com | You may not distribute this article under a jdevoto@well.UUCP | compilation copyright without my permission. ___________________________________________________________________ Apple Computer and I are not authorized | CI$: 72411,165 to speak for each other. | AppleLink: SQA.TEST