The ClickLine is Not Functioning

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

The ClickLine is Not Functioning

Postby Mia » Thu Jan 28, 2010 9:17 pm

I had to abort an attempt at converting to SuperCard 5 or 6 years ago. Am hoping to be able to carry through this time.

I've just converted a first stack and, with a bit of tweaking, most of it chugs along; however, the "project" has an AddLine and a DeleteLine button neither of which work. The clickLine seems to return empty not only to the two buttons, but also to a "Put the clickLine" command from the msg box. The textfields are locked.

A search of the Forums hasn't solved my dilemma.

Many thanks for any help, Maria
Mia
 
Posts: 47
Joined: Thu Jan 28, 2010 8:43 pm

Re: The ClickLine is Not Functioning

Postby Scott » Fri Jan 29, 2010 10:42 am

It is the clicking of the button that is causing the clickLine() function to return empty. Consider stuffing a global with this info.

field script:
Code: Select all
On mouseUp
global gLastLineClicked
put clickLine() into gLastLineClicked
end mouseUp


button script:
Code: Select all
on mouseUp
global gLastLineClicked
do "delete" && gLastLineClicked
end mouseUp
User avatar
Scott
Site Admin
 
Posts: 1233
Joined: Sat Jul 05, 2008 1:37 pm
Location: Northern Sierra Nevada

Re: The ClickLine is Not Functioning

Postby Mia » Fri Jan 29, 2010 9:53 pm

Thanks. I did as you suggested (I think), but the browse tool morphs into the pointer so there's no mouseUp msg to fetch the clickLine. I also don't understand how the msg would get passed back to the AddLine Button.

Here's what I have:

On mouseUp -- in the window script
global gLastLineClicked
put word 2 of the clickLine into gLastLineClicked
end mouseUp

on mouseUp -- in the AddLine Button
global gLastLineClicked
answer "Click on the line you want blank." with "OK" or "Cancel"
if it is "Cancel" then exit to SuperCard

repeat with y = 1 to the number of cd flds
set the locktext of cd fld y to true
end repeat

wait until the mouseclick
set the lockscreen to true

repeat with y = 1 to the number of cd flds
repeat with x = the number of lines of cd fld y down to gLastLineClicked
put line x of cd fld y into line x + 1 of cd fld y
end repeat
put "" into line gLastLineClicked of cd fld y
end repeat

repeat with y = 1 to the number of cd flds
set the locktext of cd fld y to false
end repeat

end mouseUp
Mia
 
Posts: 47
Joined: Thu Jan 28, 2010 8:43 pm

Re: The ClickLine is Not Functioning

Postby Scott » Sat Jan 30, 2010 2:18 pm

Maria wrote:Thanks. I did as you suggested (I think), but the browse tool morphs into the pointer so there's no mouseUp msg to fetch the clickLine.


The tool is not changing here; only the cursor as you are opening a modal answer dialog. You are then issuing the wait command that is stopping SuperCard in its tracks, preventing the cursor from returning to the "hand".

Forgive me for saying so but this is a dreadful interface. Your putting up a modal dialog and locking all fields and then unlocking them just to get a line number. Why not just let the user select (or place the insertion point in) the line to be acted upon and then click your button?

Code: Select all
on mouseUp  -- in the AddLine Button
put word 2 of the selectedLine into theLineNumber
if theLineNumber is empty then
answer "Please select the line you want blank." with "OK"
exit mouseup
end if
set the lockscreen to true
repeat with y = 1 to the number of cd flds
repeat with x = the number of lines of cd fld y down to theLineNumber
put line x of cd fld y into line x + 1 of cd fld y
end repeat
put "" into line theLineNumber of cd fld y
end repeat
end mouseUp
User avatar
Scott
Site Admin
 
Posts: 1233
Joined: Sat Jul 05, 2008 1:37 pm
Location: Northern Sierra Nevada

Re: The ClickLine is Not Functioning

Postby Mia » Sun Jan 31, 2010 10:45 pm

Thanks. That works well and more efficiently, as you suggest (although, I think it’s a tad awkward to have to select some text rather than just click on the line).

But how do I apply the selectedLine to the DeleteLine button? If I had happened to have a completely empty line, I would have to create text and then select it. Nevertheless, it would be doable if only I could find a way to delete lines.

Before converting HC stacks, I put menuItem scripts into buttons so I could put off figuring out how to create menus in SC. For curiosity, would menuItems obviate a problem such as the one I had where the mouse click didn’t communicate with the AddLine Button?

Many thanks, again, for your help. -Maria
Mia
 
Posts: 47
Joined: Thu Jan 28, 2010 8:43 pm

Re: The ClickLine is Not Functioning

Postby Scott » Mon Feb 01, 2010 10:05 am

Maria wrote:Thanks. That works well and more efficiently, as you suggest (although, I think it’s a tad awkward to have to select some text rather than just click on the line).

But how do I apply the selectedLine to the DeleteLine button? If I had happened to have a completely empty line, I would have to create text and then select it. Nevertheless, it would be doable if only I could find a way to delete lines.

You do not have to select any text. The selectedLine will report the line that has the insertion point in it if there is no selection.

Before converting HC stacks, I put menuItem scripts into buttons so I could put off figuring out how to create menus in SC. For curiosity, would menuItems obviate a problem such as the one I had where the mouse click didn’t communicate with the AddLine Button?

yes
User avatar
Scott
Site Admin
 
Posts: 1233
Joined: Sat Jul 05, 2008 1:37 pm
Location: Northern Sierra Nevada

Re: The ClickLine is Not Functioning

Postby Mia » Mon Feb 01, 2010 1:07 pm

So the selectedline is the clickline in a field where the locktext is false! The "selected" threw me off. All works fine now. The lines weren't deleting before as I had an "x" in the script where a "y" should have been.

A muted thanks, also, for your "yes," which means I'll have to figure out SC menus sooner rather than later.

-Maria
Mia
 
Posts: 47
Joined: Thu Jan 28, 2010 8:43 pm


Return to Upgrading From HyperCard

Who is online

Users browsing this forum: No registered users and 1 guest

cron