Buttons

Working on making the switch to SuperCard? Many here have done it... ask your questions here.

Buttons

Postby sce47 » Mon Apr 11, 2011 1:45 pm

I have converted a HyperCard stack to SuperCard and having trouble with one card on which there are two buttons. When I use the browser tool on Button #2 there is a script error that shows the script for button #1 on the screen, not the script for button #2. Using the pointer tool on button #2, the appropriate script appears in the screen. What can cause this? Here is the correct script that worked beautifully in HyperCard but not in Supercard

if "SHOW" is in short name of me then
choose LINE tool
set lineSize to 2
set penFore to 256
drag from 500,30 to 433,159
drag from 433,159 to 20,330
drag from 20,330 to 76,261
drag from 76,261 to 500,30
choose browse tool
set name of me to "HIDE LIMITS"
else
choose eraser tool
drag from 500,30 to 433,159
drag from 433,159 to 20,330
drag from 20,330 to 76,261
drag from 76,261 to 500,30
choose browse tool
click at 34,39
set name of me to "SHOW LIMITS"
end if
sce47
 
Posts: 3
Joined: Mon Mar 28, 2011 5:45 am

Re: Buttons

Postby JoeKoomen2011 » Mon Apr 11, 2011 6:44 pm

Just guessing here, but "line tool" implies the paint tool and not the draw tool. It's obvious from your script that you're using the paint tool or the erase script wouldn't work.

I don't really use SuperCard's drawing tools, but I seem to remember that you need to create a bitmap frame for your painting to exist in before you start drawing it.

Check out the "createPaint" property in the SuperTalk Language Guide.
Joe Koomen
>> Random! ...Damn near killed 'em! <<
User avatar
JoeKoomen2011
 
Posts: 464
Joined: Thu Mar 12, 2009 1:38 pm

Re: Buttons

Postby Scott » Tue Apr 12, 2011 9:03 am

Your handler runs here without error… but I don't know what is at 34,39:

"click at 34,39"

So it is possible that is what is taking you to the script of the other button. In any event, when you travel to that script via the error dialog, what line is the insertion point on?

And as Joe hinted… you will find a huge advantage in using SuperCard's draw based tools for plotting lines and other shapes as opposed to using paint tools (which was HyperCard's only option).
User avatar
Scott
Site Admin
 
Posts: 1217
Joined: Sat Jul 05, 2008 1:37 pm
Location: Northern Sierra Nevada

Re: Buttons

Postby sce47 » Wed Apr 13, 2011 4:12 pm

Thanks for the help. As I wrote this program in HyperCard in 1991, for the life of me I cannot remember why I had the cursor click at 34,39, but in that program, it served a good purpose and it worked. I have removed that line from the SuperCard script and you were right, the cursor was clicking on a different button and that is why the wrong script was coming up, and by removing the line, the script works as it was supposed to. Thanks for the insight. In the project are three cards that share a similar graph in the background layer, and lines are drawn on the card layer. On the first card I have a unique problem that does not appear in the other two, even though the script is the same for all three buttons. On the first of these cards, only some of the lines drawn are erased, and some remain on the card, whereas on the other two, all the lines are erased from the card. Here is the script;

choose eraser tool
drag from 500,38 to 20,38
drag from 20,54 to 500,54
drag from 500,70 to 20,70
drag from 20,86 to 500,86
drag from 500,102 to 20,102
drag from 20,118 to 500,118
drag from 500,134 to 20,134
drag from 20,150 to 500,150
drag from 500,166 to 20,166
drag from 20,182 to 500,182
drag from 500,198 to 20,198
drag from 29,214 to 500,214
drag from 500,230 to 20,230
drag from 20,246 to 500,246
drag from 500,262 to 20,262
drag from 20,278 to 500,278
drag from 500,294 to 20,294
drag from 20,310 to 500,310
drag from 500,322 to 20,322
choose browse tool

Any idea why this should not work as the others?
sce47
 
Posts: 3
Joined: Mon Mar 28, 2011 5:45 am

Re: Buttons

Postby sce47 » Thu Apr 14, 2011 2:15 pm

Scott,
I do remember why I had the cursor click on 34,39. On the card are four buttons, "Plot", "Show Limits" , "Clear", and "Ind % Ret" . "Plot" draws a line over a graph in the background that runs from the upper right down to the lower left, and the shape of the line is based on numbers calculated and entered in a previous card field. "Show Limits" draws an irregular polygon surrounding the "Plot" line. "Hide Limits" erases the irregular polygon with the eraser tool and because the "Plot" line often intersects the "Show Limits" polygon, some of it is erased. Clicking on 34,39 restores all the "Plot" line to it's original shape. I am having problems with the current script of "Plot", and that is why it kept coming up when "Hide Limits" was clicked. Again, thanks for the help.
sce47
 
Posts: 3
Joined: Mon Mar 28, 2011 5:45 am


Return to Upgrading From HyperCard

Who is online

Users browsing this forum: No registered users and 1 guest