Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!usc!apple!jdevoto From: jdevoto@Apple.COM (Jeanne A. E. DeVoto) Newsgroups: comp.sys.mac.hypercard Subject: Re: HyperCard, Insertion Point, Scripts etc. Message-ID: <46195@apple.Apple.COM> Date: 1 Nov 90 04:50:30 GMT References: <1125@wcc.oz> Organization: Apple Computer Inc., Cupertino, CA Lines: 52 [Mail went "boing!".] In article <1125@wcc.oz> tom@wcc.oz (Tom Evans) writes: [that he wants to know how to preserve the location of the insertion point when a button is hilited.] The workaround is to check and restore the selection after you hilite the button. An example: on idle get the selectedChunk -- store the insertion point location set the hilite of card button "Reminder" to true wait 10 ticks set the hilite of card button "Reminder" to false select it -- restore the insertion point end idle This puts the insertion point back where it belongs after you're finished hiliting. Actually, the most common problem of this type is seen when a user clicks an autohiliting button. A solution for this more common case is on mouseDown -- in button's script put the selectedChunk in to mySelection repeat while the mouse is down -- emulate autohiliting behavior if the mouseLoc is within the rect of the target then set the hilite of the target to true else set the hilite of the target to false end if end repeat if the mouseLoc is within the rect of the target then -- mouse was released within the button -- do whatever you want to do on a button press -- this may include doing something to mySelection, such -- as boldfacing it, etc. end if select mySelection end mouseDown This handler can also be used to make other types of button hiliting -- for instance, changing the icon or button style rather than the hilite to show that a button is being clicked -- behave like autohiliting, with the state changing as you move the mouse on or off the button. -- ========= jeanne a. e. devoto ======================================== jdevoto@apple.com | You may not distribute this article under a jdevoto@well.sf.ca.us | compilation copyright without my permission. ______________________________________________________________________ Apple Computer and I are not authorized | CI$: 72411,165 to speak for each other. |