Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Can buttons be created on the fly?

17 views
Skip to first unread message

John Miller

unread,
Jan 11, 1991, 8:45:44 AM1/11/91
to
> I'd like to create buttons dynamically within a script, but I
> haven't found a way to do this.

A new button can be created using the command
domenu "New Button"

The trick is gaining access to this button so that you can set the
name and location. The button is added to the "end of the list."

-- Create the button
domenu "New Button"
-- Figure out the button number
put the number of buttons into btnNumb
-- Make it look right
set the name of button btnNumb to "Bob"
set the rect of button btnNumb to 10,40,80,60
set the style of button btnNumb to "shadow"
-- Be sure to go back to browse tool after creating
-- all the buttons
choose browse tool

You might want to use "lock screen" and "unlock screen" around these
statements so that the user doesn't see the button until the
script has finished building it.

----------------------------------------------------------------------
John Miller (604) 433-1795
Symplex Systems AppleLink (rarely) CDA0461
Burnaby, British Columbia Fax: (604) 430-8516
Canada usenet: john_...@mindlink.uucp
----------------------------------------------------------------------

Jamii K. Corley

unread,
Jan 11, 1991, 2:42:13 PM1/11/91
to

I'm new to HyperCard programming and have an application that I think should
be fairly easy to create, but I can't seem to find a way of doing it. I have
a file that contains some subject headers and articles. I'd like to read it
with Hyper Card and create a page of buttons one for each subject. Since I
don't know what these subjects will be a head of time, I'd like to create

buttons dynamically within a script, but I haven't found a way to do this.
Any suggestions are welcomed.
Thanks,
Jamii Corley

-----------ja...@edsr.eds.com or ....uunet!edsr!jamii------------------
"Everyday, once a day, give yourself a present. Don't plan it, don't wait for it
just let it happen. It could be a new shirt from the men's store, a cat nap in
your office chair, or two cups of hot black coffee." - Agent Dale Cooper, TP

Eric Kofoid

unread,
Jan 12, 1991, 5:40:39 PM1/12/91
to
In article <44...@mindlink.UUCP> a3...@mindlink.UUCP (John Miller) writes:
> > I'd like to create buttons dynamically within a script, but I
> > haven't found a way to do this.
>
> A new button can be created using the command
> domenu "New Button"
>
> The trick is gaining access to this button so that you can set the
> name and location. The button is added to the "end of the list."
>
> -- Create the button
> domenu "New Button"
> -- Figure out the button number
> put the number of buttons into btnNumb
> -- Make it look right
> set the name of button btnNumb to "Bob"
> set the rect of button btnNumb to 10,40,80,60
> set the style of button btnNumb to "shadow"
> -- Be sure to go back to browse tool after creating
> -- all the buttons
> choose browse tool
<etc.>

An even simpler solution:

domenu "New Button"
set name of last btn to "Bob"
set rect of last btn to 10,40,80,60
set style of last btn to "shadow"
choose browse tool

Cheers,

Eric.

__________________________________________________________________
| Eric Kofoid; Dept. Biology, U. of Utah; SLC, UT 84112 |
| (801) 581-3592 |
| kof...@bioscience.utah.edu |
| |
| -- The University of Utah is blameless for anything I've said -- |
|__________________________________________________________________|

Joe Paydarfar

unread,
Jan 23, 1991, 12:23:59 PM1/23/91
to

I have a problem trying to create a stack that makes use of
backgrounds that I have already created in a previous stack. From
what I understand, HyperCard has a command called 'create stack' in which
you can specify one background from another stack
but what should you do if there is more than one background that
you want to use from the other stack? Any info on this would be greatly
appreciated!!

Jeff E Mandel MD MS

unread,
Jan 24, 1991, 8:41:20 AM1/24/91
to
In article <7...@borg.cs.unc.edu> payd...@hatteras.cs.unc.edu (Joe Paydarfar)
writes:
I have this problem in a project of mine, in which I need to clone an empty
stack which is then populated (by CL/1). My solution is an XCMD which copies
the entire stack using the file manager. It is reasonably fast, opens the
source file readOnly, so it can work with an open stack or one on a
write-locked volume, and I have not encountered any bugs in the last 2 weeks of
using it. I will eventually post it, but anyone who needs it desperately, mail
me for a beta copy. Of note to the busy HyperCard team, I would much prefer
that the command doMenu "Save a copy..." without dialog did just that.

Jeff E Mandel MD MS
Asst. Professor of Anesthesiology
Tulane University School of Medicine
New Orleans, LA

John Kevin Calhoun

unread,
Jan 24, 1991, 3:31:56 PM1/24/91
to

>I have this problem in a project of mine, in which I need to clone an empty
>stack which is then populated (by CL/1). My solution is an XCMD which copies
>the entire stack using the file manager. It is reasonably fast, opens the
>source file readOnly, so it can work with an open stack or one on a
>write-locked volume, and I have not encountered any bugs in the last 2 weeks
>of using it. [...] Of note to the busy HyperCard team, I would much prefer

>that the command doMenu "Save a copy..." without dialog did just that.

The "save" command in HyperCard 2.0 does what you want. Examples:

save this stack as "Fred"
save stack "Template" as "The stack I'm going to work with"

Kevin Calhoun
HyperCard Team
Apple Computer, Inc.

John Kevin Calhoun

unread,
Jan 24, 1991, 4:43:36 PM1/24/91
to

In article <7...@borg.cs.unc.edu> payd...@hatteras.cs.unc.edu (Joe Paydarfar)
writes:
>

When you use the "create stack" command, you can specify which background
you want the new stack to have. Some examples:

create stack "New Stack" with background 3
create stack "Magyar" with this background
create stack "Slogans" with background "Fahrvergnugen"

The stack will be created and then opened. If you want it to be opened
in a new window, add the phrase "in a new window" to the command.

create stack "Berenstein Bears" with background 1 in a new window

If you don't specify a background, "create stack" creates a new stack
with a blank background.

The create stack command is new in HyperCard 2.0. It doesn't exist in
HyperCard 1.x.

If you want to create a stack with several cards, each with a different
background from the same source stack, you can create the stack first
and then copy additional cards into it. Suppose a stack has four
backgrounds, and you want to create a new stack with four cards, one
for each of the backgrounds of the source stack. You could do it this
way:

push card
create stack "My New Stack" with this background
pop card
set lockMessages to true
repeat 3 times
go next background
doMenu "Copy Card"
push card
go last card of stack "My New Stack"
doMenu "Paste Card"
pop card
end repeat

Of course, when you copy cards over to the new stack, they will retain
all of their card objects as well as their background objects.
Unfortunately, there still isn't a good way to copy just a background
from one stack into another already existing stack.

0 new messages