Path: utzoo!utgpu!jarvis.csri.toronto.edu!rutgers!apple!ames!lll-winken!uunet!wugate!wuibc!beard From: beard@wuibc.UUCP (James Beard MD) Newsgroups: comp.sys.mac.hypercard Subject: Re: using fields with scroll bars Message-ID: <364@wuibc.UUCP> Date: 23 Jun 89 04:50:58 GMT References: <4161@emory.mathcs.emory.edu> Reply-To: beard@wuibc.UUCP (James Beard MD) Organization: Washington University in St. Louis Lines: 42 [in response to a query about how to make a click in the scroll bar of a scrolling field un-highlight a button overlying a line of text in the field.] I can't be certain I understand what you are trying to do, but I would suggest the following: 1) Perhaps you could dispense with the button entirely, if its sole purpose is to highlight the selected line. Version 1.2 allows you to highlight a chunk of a field from within a script. You can first deduce what line of the field was clicked in. Apple gives some examples of this, which requires using the mouseloc at clicking time, the height of a line of text (one of the fld properties), and how far scrolled the field is (a fld property). Assume that you have deduced that the line clicked was line x. Then you could write ... select line x of fld myField ... Besides being faster than moving a button around, this has the advantage that the highlighted line remains highlighted (even during scrolling out of and into view) until you do something to un-highlight it. 2) Version 1.2 has a new operator, Within, that lets you ask whether a given point is within a certain rectangle. An expression of the form " is within " will return a value of either true or false. Thus you could include something like the following in the script of the scrolling field, assuming that you had previously put the rect of the scroll bar into scrollzone: on mousedown global scrollzone get the mouseloc if it is within scrollzone then select empty -- this undoes the highlighting pass mousedown -- this lets the scroll bar do its scrolling work end mousedown (Not having tried the above, I can't guarantee it will work. But I think something very like it will.) James C. Beard (beard@wuibc2.wustl.edu)