francis@daisy.uchicago.edu (Francis Stracke) (10/13/90)
In article <Qb2YKgy00Uh_I2T2V2@andrew.cmu.edu> ch2i+@andrew.cmu.edu (Charles A. Hill) writes: >I want to use the outlines of a picture to define the parameters of a >button. In other words, if someone clicks anywhere within the outlines >of a picture (no matter what shape the picture is), the button will be >activated. I've been trying to improvise by filling all the nooks and [...] >I don't know any languages but Hypertalk, but I'm told that making an >irregularly shaped picture "hot" is no sweat in a language such as C. It's not incredibly easy. You'd have to have some way of getting the region from the bitmap (is this supported by the Toolbox?), then check, for each click, if the mouse is inside the region. In HC, this would take a XFCN returning a handle to the region, and another to check if a given point is in a given region. The card script would catch the mouseUp event, then act on it as necessary. Anybody in comp.sys.mac.programmer got any better ideas? | Francis Stracke | My opinions are my own. I don't steal them.| | Department of Mathematics |=============================================| | University of Chicago | A mathematician is a professional | | francis@zaphod.uchicago.edu | schizophrenic.--Me. |
linde@embezzle.stanford.edu (Andrei Linde) (10/13/90)
francis@daisy.uchicago.edu (Francis Stracke) writes: >In article <Qb2YKgy00Uh_I2T2V2@andrew.cmu.edu> ch2i+@andrew.cmu.edu (Charles A. Hill) writes: >>I want to use the outlines of a picture to define the parameters of a >>button. In other words, if someone clicks anywhere within the outlines >>of a picture (no matter what shape the picture is), the button will be >>activated. I've been trying to improvise by filling all the nooks and >[...] >>I don't know any languages but Hypertalk, but I'm told that making an >>irregularly shaped picture "hot" is no sweat in a language such as C. >It's not incredibly easy. You'd have to have some way of getting the >region from the bitmap (is this supported by the Toolbox?), then check, >for each click, if the mouse is inside the region. >In HC, this would take a XFCN returning a handle to the region, and >another to check if a given point is in a given region. The card script >would catch the mouseUp event, then act on it as necessary. >Anybody in comp.sys.mac.programmer got any better ideas? >| Francis Stracke | My opinions are my own. I don't steal them.| >| Department of Mathematics |=============================================| >| University of Chicago | A mathematician is a professional | >| francis@zaphod.uchicago.edu | schizophrenic.--Me. | If picture is not too complex then just make several buttons on it which would countain script: on mouseUp click at loc of card button "MyPicture" end mouseUp and call one of the buttons on this picture "MyPicture" and give it a script that you want to be executed. Again if the picture is not too complex you will beable to aproximate it with rectangular buttons preety well. This is not the only choice, so if you don't like it try something else. - Dmitri Linde
aslakson@cs.umn.edu (Brian Aslakson) (10/15/90)
linde@embezzle.stanford.edu (Andrei Linde) quotes every damn word that: >francis@daisy.uchicago.edu (Francis Stracke) writes: and which I mostly delete. >>In article <Qb2YKgy00Uh_I2T2V2@andrew.cmu.edu> ch2i+@andrew.cmu.edu (Charles A. Hill) writes: >>>I want to use the outlines of a picture to define the parameters of a >>>button. In other words, if someone clicks anywhere within the outlines >>>of a picture (no matter what shape the picture is), the button will be >>>activated. I've been trying to improvise by filling all the nooks and >>Anybody in comp.sys.mac.programmer got any better ideas? Why yes. Not me though. A certain Apple gentleman very recently posted that he had and would send to requesters a stack he wrote that does just that. His name and address is: Greg L. Anderson, greggor@apple.com. I will forward what I received from Greg to ch2i+@andrew.cmu.edu but other people should request from Greg, please not from me!! Please notice how well adjusted this paragraph is. Oh, the stack's name? Ah, ask him for his polybutton stack. -- Brian Aslakson aslakson@cs.umn.edu mac-admin@cs.umn.edu <-= Macintosh related
np@doc.ic.ac.uk (Nigel Perry) (10/16/90)
Outline of problem (I can't include the previous article): Needed a button the shape of an arbitrary picture. Ok, I have written a WDEF which displays a PICT (B/W only), it either masks the given PICT or takes another to act as the mask, it then constructs an arbitrary shaped window (complete with holes, non-contiguous areas etc.). I've been waiting for HC 2.0 before writing some XCMDs to interface to this WDEF. With these XCMDs you'll be able to construct arbitrary shaped buttons. I've just got HC 2.0, now all I need is the time to finish the project... I'll post to sumex when(if) its finished. --- Nigel Perry Department of Computing Imperial College Janet: np@uk.ac.ic.doc London ARPA: np%uk.ac.ic.doc@ucl-cs SW7 Uucp: np@icdoc.UUCP, ukc!icdoc!np England
bkuo@aludra.usc.edu (Benjamin Kuo) (10/17/90)
Exactly. I've done it with my own (bomb-prone) XFCN, but basically what I did was write an XFCN which took the locations of a mouseDown on the card, check the coordinates (in form x,y) with a region (x1,y1,x2,y2,x3,y3,etc) and returned a "1" if it was in the region, and a "0" if it wasn't. I used another XCMD to hilight that region. There's a lot of overhead involved, though, if you have more than two or three regions to check (card scripting from hell....) I assume you could do it via scripts, but that's SLOW... (Of course, I haven't even seen HC2.0 yet, so I can't make any guarantees that there isn't something already there to do this...) Benjamin Kuo bkuo@usc.edu
greggor@Apple.COM (Greg L. Anderson) (10/18/90)
In article <2364@gould.doc.ic.ac.uk> np@doc.ic.ac.uk (Nigel Perry) writes: >Needed a button the shape of an arbitrary picture. > >Ok, I have written a WDEF which displays a PICT (B/W only), it either >masks the given PICT or takes another to act as the mask, it then >constructs an arbitrary shaped window (complete with holes, non-contiguous >areas etc.). My polybutton XFCNs (which work with HyperCard 2) use regions to identify button shapes. At the moment, said regions can only be defined as polygons. If you had a PICT->Region conversion routine, you could probably merge your code with mine & end up with a pretty nifty irregular-button XFCN. ___\ /___ Greg Anderson (6 kyu) ___\ /___ . O . "Pon Nuki \ \ / / Advanced Technology Group \ \ / / O . O is ideal \ /\/\ / Apple Computer, Inc. \ /\/\ / . O . shape." \/ \/ greggor@apple.com \/ \/ -- ___\ /___ Greg Anderson (6 kyu) ___\ /___ . O . "Pon Nuki \ \ / / Advanced Technology Group \ \ / / O . O is ideal \ /\/\ / Apple Computer, Inc. \ /\/\ / . O . shape." \/ \/ greggor@apple.com \/ \/
geoff@pmafire.UUCP (Geoff Allen) (10/20/90)
linde@embezzle.stanford.edu (Andrei Linde) writes: >If picture is not too complex then just make several buttons on it which >would countain script: >on mouseUp > click at loc of card button "MyPicture" >end mouseUp > >and call one of the buttons on this picture "MyPicture" and give it a >script that you want to be executed. Another alternative: put in each of your buttons... on mouseUp doWhatIWant end mouseUp and in your card, background, or stack script... on doWhatIWant -- Whatever you want to do when the user clicks in the irregular -- area end doWhatIWant -- Geoff Allen \ Computers are useless. uunet!pmafire!geoff \ They can only give you answers. bigtex!pmafire!geoff \ -- Pablo Picasso