[comp.sys.mac.hypercard] FAQ: miniature card picture?

ralphm@portia.Stanford.EDU (Ralph Melton) (12/19/90)

I know that there exists a procedure for getting a miniature picture of a
card, like the pictures used by the "Recent" command in the "Go" menu.
It is my strong belief that I have actually read about this procedure in
one of the help stacks of Hypercard 2.0.  Unfortunately, though, two days
of searching through the stacks again have not resulted in any success.
Could someone please tell me how to generate the miniature card picture?

Thanks in advance,
Ralph Melton


-- 
Ralph Melton	The White Rabbit	ralphm@portia.stanford.edu

"When you hear of a storybook romance, you don't think of the storybook
as being _Alice in Wonderland_ . . ."

jdevoto@Apple.COM (Jeanne A. E. DeVoto) (12/20/90)

In article <1990Dec19.003310.12043@portia.Stanford.EDU>
ralphm@portia.Stanford.EDU (Ralph Melton) writes:
>Could someone please tell me how to generate the miniature card picture?

To get a miniature card picture, first copy the card using the 
Copy Card menu item (or "doMenu Copy Card"), then hold down the
shift key while pasting (if you want to do this in a script, use
 
      type "v" with commandKey,shiftKey

-- 
========= 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.                     |

ralphm@portia.Stanford.EDU (Ralph Melton) (12/21/90)

In article <47512@apple.Apple.COM> jdevoto@Apple.COM (Jeanne A. E. DeVoto) writes:
>In article <1990Dec19.003310.12043@portia.Stanford.EDU>
>ralphm@portia.Stanford.EDU (Ralph Melton) writes:
>>Could someone please tell me how to generate the miniature card picture?
>
>To get a miniature card picture, first copy the card using the 
>Copy Card menu item (or "doMenu Copy Card"), then hold down the
>shift key while pasting (if you want to do this in a script, use
> 
>      type "v" with commandKey,shiftKey

This works.  I thank you and the other net.people who have provided me with
this answer.

I am indeed doing this in a script.  It seems to me very unfriendly to
heedlessly overwrite the clipboard.  Is there any way I can either a)
generate the miniature picture without clobbering the clipboard, or b)
save the contents of the clipboard, no matter what the nature of those
contents, and restore them after my finagling?

And in a barely related question, is it possible for me to tell from within
a script whether there is a button at a particular point?

Come to think of it, it's very possible that I'm trying to solve this
problem the wrong way.  Therefore, I'll throw it out to the general
HyperCard community for suggestions.

I am trying to create a background each of whose cards serves as a map
to a portion of my stack. This "map" represents a tree-like structure
of several cards; clicking on any representation of a card should take
the user to the corresponding card.  The linkages between the cards
represented in the map need to be dynamically determined, so I need to 
make and maintainthe map from within the script. I am currently approaching
this problem with an idea of creating the miniature card pictures and
overlaying them with transparent buttons whose names are the names of
the corresponding cards to go to, and then handling the mouse clicks from
a background MouseUp handler.

One of the rules that I wish to institute is that no cards may be linked
in such a way that they would overlap if they were paper cards laid out
according to the linkages on a flat surface.  My best idea had been to,
when adding a new link, go to the "map" card, and check whether there
is already a button in the place that the new button should go.  I am
unable, though, to figure out how to do this.

Do I have basically the right idea?  Is there a simpler way that I can
achieve my goals?

Again, many thanks for help already given and to be given.

Ralph Melton


-- 
Ralph Melton	The White Rabbit	ralphm@portia.stanford.edu

"When you hear of a storybook romance, you don't think of the storybook
as being _Alice in Wonderland_ . . ."

jdevoto@Apple.COM (Jeanne A. E. DeVoto) (12/24/90)

In article <1990Dec21.080810.27139@portia.Stanford.EDU> 
ralphm@portia.Stanford.EDU (Ralph Melton) writes further
concerning miniature card pictures:
>I am indeed doing this in a script.  It seems to me very unfriendly to
>heedlessly overwrite the clipboard.  Is there any way I can either a)
>generate the miniature picture without clobbering the clipboard, or b)
>save the contents of the clipboard, no matter what the nature of those
>contents, and restore them after my finagling?

Not easily, not without an XCMD (and I have not seen an XCMD that will
do this, although it seems as though it would be possible to write a
SaveScrap/RestoreScrap pair). You can check which of HyperCard's scrap
types is on the clipboard, if any, by checking the wording of the "Paste"
menu item:

  if menu "Edit" contains "Paste Text" then
    -- paste the text into a field
  else if menu "Edit" contains "Paste Picture" then
    -- paste the graphic onto a convenient card set aside for the purpose
  else if menu "Edit" contains "Paste Card" then
    -- paste the card where you can grab it later
  end if
  doMenu "Copy card"
  go card "Map"
  type "v" with shiftKey,commandKey
  -- now restore whatever you moved off the clipboard

As you can see, this is a pretty ugly solution; it requires setting aside a
card with an empty picture and an empty field to accept pictures or text.
It has several failure modes: for instance, the clipboard might contain more
than 29000 characters of text, in which case you'll get an error when you
try to paste it in to a field; the graphic on the clipboard might be too
large for the card you try to paste it into, resulting in unexpected clipping;
and so on. The above method is OK if you're trying to whip out a prototype,
or if your stack will be used in a controlled environment and you can ensure
that the clipboard contents will always be OK, but I wouldn't use it for
production work.

>And in a barely related question, is it possible for me to tell from within
>a script whether there is a button at a particular point?

Basically, you need to write a loop that will check all the buttons and
see whether your point is in any of them:

  on mouseUp
    put "Click at the point you want..."
    wait until the mouseClick
    if pointIsOccupied(the clickLoc) then
      beep
      answer "Sorry; there is already a button at that point."
      exit mouseUp
    end if
    -- create the button
  end mouseUp

  function pointIsOccupied thePoint
    repeat with x = 1 to the number of card buttons
      if thePoint is within the rect of card button x then return "true"
    end repeat
    repeat with x = 1 to the number of background buttons
      if thePoint is within the rect of background button x then return "true"
    end repeat
    return "false"  -- none of the buttons overlap the point
  end pointIsOccupied
-- 
========= 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.                     |