Merging Stacks?

Anything beyond the basics in using the LiveCode language. Share your handlers, functions and magic here.

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Ralph Forehand
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 42
Joined: Thu Jan 04, 2007 8:05 pm

Re: Merging Stacks?

Post by Ralph Forehand » Wed Dec 09, 2009 6:31 pm

Klaus wrote:Hi Ralph,

looks like the script cannot find the desired button, but will, if you add a long descriptor!
Note that, when the script executes, the current card might not contain the button "Quarter"!
...
put the icon of btn "Quarter" OF CD "Name of Card with the button on it" OF STACK "Name of stack with the card with the button on it"...
...

Hope that helps!


Best

Klaus
Yes, Klaus that did help.

But now I have a new Problem/s?

On card #3 I can't execute handlers that are in the main stack script. This wasn't a problem before.
"Do the right thing and everything else will take care of it's self."

Klaus
Posts: 14208
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Re: Merging Stacks?

Post by Klaus » Thu Dec 10, 2009 12:58 pm

Hi Ralph,

??? what is the error text, when you try it?

Ralph Forehand
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 42
Joined: Thu Jan 04, 2007 8:05 pm

Re: Merging Stacks?

Post by Ralph Forehand » Fri Dec 11, 2009 2:07 pm

Kaus,

Sorry for delay in getting back to you - Christmas Season shopping etc.

I found myself in trapped a series of errors that all seemed to do with the muoseUp being on the wrong card. Problems that were no problems with the H/C converted stack before I started using the substack.

Anyway, I'm back-tracking to the working converted H/C stack and trying again.

At this point the modal substack produces the the dialogData string properly (I put it into myString and that into dialogData and that in the message box). But then when I exit the SubStack, I'm unable to output the dialogData string to the message box - and weird things start happening.

My set-up is.
Card #3 on my main stack has a button that call the modal substack, I collect data from a field, 3 Radio buttons, and 3 Check Boxes (seven items in all) into myString per above.

The dataDialog items upon returning to card #3 are manipulated using globals, and calls to handlers in the Card #3 and Main stack scripts. This all worked fine in the H/C version (there I used a Show Dialog XCMD to do my Dialog Box).

I suspect my problem is with the way my button, card# #3, and Main tack scripts/card set-ups are handling the button and Dialog Box "OK" button mouseUps .

I can, and might end-up, use a work-around with rev's standard Ask and Answer Dialog Boxes but that's not as neat as a custom dialog box.

Thanks for any suggestion Suggestion?
"Do the right thing and everything else will take care of it's self."

Klaus
Posts: 14208
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Re: Merging Stacks?

Post by Klaus » Fri Dec 11, 2009 3:35 pm

Hi Ralph,

could you please post the "offending" script of btn #3?

Ralph Forehand
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 42
Joined: Thu Jan 04, 2007 8:05 pm

Re: Merging Stacks?

Post by Ralph Forehand » Fri Dec 11, 2009 5:28 pm

Klaus wrote:Hi Ralph,

could you please post the "offending" script of btn #3?
My Button script on card #3
-----
on mouseUp -- 8/26/93 - Rev. 05/06/05
global ydLine, ydsChange, downYds, BallLoc, posStart, ydsToGo

put char 1 of posStart into downStart
if char 3 of posStart <> "G" then
put char 3 to 4 of posStart into YdsToGoStart
else
put char 14 to 15 of posStart into YdsToGoStart -- 8/18/93
end if
-- Put "Got Here" message -- OK √

modal stack "AssessPnlty"

-- Do NOT get "Got Here #2" OK message -- X[/b}

put the dialogData into myString
put "The dataDialog =" && myString into message
Put "MyString =" && myString && "ouyt of DualogBox"

if the myString = "Cancel" i then -- clicked the “Cancel” button
exit mouseUp
else
put item 1 of myString into PenaltyYds
-- 10/25/95 ••
if item 5 of myString is "TRUE" then -- add penalty to Gain/Loss
if item 4 of myString is "TRUE" then -- against defense
put ydLine + PenaltyYds into ydLine
put YdsToGoStart - ydsChange - PenaltyYds into ydsToGo
else
if item 2 of myString is "TRUE" then -- against offense
put ydLine - PenaltyYds into ydLine
put YdsToGoStart - ydsChange + PenaltyYds into ydsToGo
else
put "Incomplete Penalty Definition"
exit mouseUp
end if
end if
put downStart+1 into downStart
put downStart &"/"& ydsToGo into downYds
else
if item 2 of myString is "TRUE" then -- against offense
put ydLine - ydsChange - PenaltyYds into ydLine
put YdsToGoStart + PenaltyYds into ydsToGo
else
if item 3 of myString is "TRUE" then
put "; Penalty Declined" after \ -- ∆∆∆
last line of cd fld "Play Result"
set hilite of me to false
exit mouseUp
else
if item 4 of myString is "TRUE" then -- against defense
put ydLine - ydsChange + PenaltyYds into ydLine
put YdsToGoStart - PenaltyYds into ydsToGo
end if
end if
end if
end if
end if

if YdsToGo < 1 or (item 6 of myString is "TRUE") then -- & 1st Down
put "1/10" into downYds
else
if item 7 of myString is "TRUE" then \ -- & Loss of Down
put downStart+1 into downStart
put downStart &"/"& ydsToGo into downYds
end if
if ydLine + YdsToGo >= 100 then put "1/Goal" into downYds -- 8/18/93
DecodeYards -- ∆∆∆ 1/15/93
put downYds && "from" && BallLoc into cd fld "BallLocation"
put cd fld "BallLocation" into posStart
set hilite of me to false

end mouseUp
-----
"Do the right thing and everything else will take care of it's self."

Klaus
Posts: 14208
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Re: Merging Stacks?

Post by Klaus » Fri Dec 11, 2009 7:01 pm

Hi Ralph,

hm, nothing offending at first glance...

What error do you get?
What is the script in your modal dialog stack?

Maybe your script "loses" the connection to its stack?
Try to add this line after "modal..."
...
modal stack "AssessPnlty"
set the defaultstack to "name of the stack that OWNS your button #3"
...

Maybe that helps?
I am just wildly guessing... :)


Best

Klaus

Ralph Forehand
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 42
Joined: Thu Jan 04, 2007 8:05 pm

Re: Merging Stacks?

Post by Ralph Forehand » Sat Dec 12, 2009 5:57 pm

Klaus wrote:Hi Ralph,

hm, nothing offending at first glance...

What error do you get?
What is the script in your modal dialog stack?

Maybe your script "loses" the connection to its stack?
Try to add this line after "modal..."
...
modal stack "AssessPnlty"
set the defaultstack to "name of the stack that OWNS your button #3"
...

Maybe that helps?
I am just wildly guessing... :)

Best

Klaus
Klaus,

I tried your suggestion and it did help get rid of the error messages I was getting with my main stack.

Now the main stack opens correctly but now
the Assess Penalty button brings up the following Error :

executing at 11:41:55 AM
Type Chunk: source is not a container
Object Assess Pnlty
Line model stack "AssessPenaltyNew"
Hint mouseUp

I've double checked and the "AssessPenaltyNew" IS a subStack of my main stack.

I've started doing on my work-around as I'm spending way too much time on this problem.

I do Thank You and others who have offered suggestions to help.

Happy Holiday Season and TAKE CARE.
"Do the right thing and everything else will take care of it's self."

bn
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 4174
Joined: Sun Jan 07, 2007 9:12 pm

Re: Merging Stacks?

Post by bn » Sat Dec 12, 2009 6:02 pm

Ralph,
Line model stack "AssessPenaltyNew"
is model in the original code? shouldn't it be modal
regards
Bernd

Ralph Forehand
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 42
Joined: Thu Jan 04, 2007 8:05 pm

Re: Merging Stacks?

Post by Ralph Forehand » Sat Dec 12, 2009 7:21 pm

Klaus,

My spelling error was the problem!! - I must have taken an idiot pill today!!!

I'm sure your previous suggestion (resetting the defaulSstack) corrected the problem with my mouseUp getting lost. And of course, it is very logical and should have been obvious to me - now that I know the answer of course.<BIG Grin>

Anyway, Thank You VERY MUCH again, Happy Holidays, and TAKE CARE.
"Do the right thing and everything else will take care of it's self."

bn
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 4174
Joined: Sun Jan 07, 2007 9:12 pm

Re: Merging Stacks?

Post by bn » Sat Dec 12, 2009 7:26 pm

bn wrote:Ralph,
Line model stack "AssessPenaltyNew"
is model in the original code? shouldn't it be modal
regards
Bernd
Ralph,
maybe it is just the glasses, not the pill afterall :)
regards
BERND

Post Reply