Datagrid column template stack is calling main stack script.

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

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
Paul D
Posts: 116
Joined: Mon May 21, 2007 6:58 pm

Datagrid column template stack is calling main stack script.

Post by Paul D » Wed Aug 05, 2009 7:42 pm

When I click on the + button (next to column behavior) to create a template, revolution errors out because the datagrid row template stack is calling my preopenstack script on my main stack. And now everytime I click column behavior, nothing happens. I can not edit my column behavior script for the column that revolution gave me an error for. How do I get to my behavior script if it has errored out?

Janschenkel
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 977
Joined: Sat Apr 08, 2006 7:47 am
Contact:

Post by Janschenkel » Wed Aug 05, 2009 8:28 pm

Well, this is normal as the preOpenStack message travels from substacks to the mainstack if not trapped. Since this is the case for all substacks, you may want to 'protect' your preOpenStack in the mainstack script, like this

Code: Select all

on preOpenStack
  if the target is not me then pass preOpenStack
  -- otherwise do your normal stuff
  ...
  -- finally pass so others can handle it
  pass preOpenStack
end preOpenStack
It is considered good form to pass the event along the message path, in case you want to use backscripts or other generic handlers along the message path.

HTH,

Jan Schenkel.
Quartam Reports & PDF Library for LiveCode
www.quartam.com

Paul D
Posts: 116
Joined: Mon May 21, 2007 6:58 pm

Post by Paul D » Wed Aug 05, 2009 9:25 pm

I didnt have a problem with it before this random error. I had a preOpenStack script all day on my main stack but as soon as I made a 13th column and tried to create a template, the template stack decided to error out due to the preOpenStack script on my main stack. I went and added empty scripts to the template stack after that but the problem now is that the behavior button is now useless for the column that error-ed out on me. Ive already tried deleting and re-creating a new 13th column and that doesnt work. I REALLY do not want to have to delete my datagrid and re-make it. :cry:

trevordevore
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 1005
Joined: Sat Apr 08, 2006 3:06 pm
Contact:

Post by trevordevore » Wed Aug 05, 2009 11:14 pm

I'm guessing here but if the error was in preopenstack then here is what I think happened:

When you tried to create the custom template for your column the Property Inspector opened the data grid substack because it was closed. The PI did this in order to create the custom template.

Your code in the preopenstack handler of your mainstack has an error in it because it isn't expecting a substack to generate the preopenstack message but rather the mainstack. When the error occurred it halted execution of the PI code that generates the custom template so no custom template exists.

If you weren't seeing the preopenstack earlier it could have been because you had the data grid template stack already open so the PI didn't have to open it, thus no preopenstack message was generated.

Like I said, just a guess. I would follow Jan's advice regarding the preopenstack since it is good defensive coding. If the above doesn't sound like the problem maybe you could upload your stack somewhere so I could take a look?
Trevor DeVore
ScreenSteps - https://www.screensteps.com

LiveCode Repos - https://github.com/search?q=user%3Atrevordevore+topic:livecode
LiveCode Builder Repos - https://github.com/search?q=user%3Atrevordevore+topic:livecode-builder

Paul D
Posts: 116
Joined: Mon May 21, 2007 6:58 pm

Post by Paul D » Thu Aug 06, 2009 1:20 pm

Sounds about right. I went in the row template stack and found the hidden behavior buttons to open the script for the column I need. Thanks for the advice.

Post Reply