Stackfiles followup

2011-02-14 Thread Peter Haworth
My front scripts are now working OK after I addedd "of stack "xyz" to my insert 
commands as Jacqueline suggested.

However, it looks like I have some wholesale changes to make to get my 
stackFiles working correctly with regard to my behavior scripts.  The buttons 
that hold the behavior scripts are in a substack.  I've included the name of 
the behaviors substack and it's main stack in the stackfiles, both pointing to 
the same file path but the behaviors still aren't recognised by the controls 
that point to them.  I tried putting just the main stack into stackFiles and 
adding the statement "open stack "xyzsub of stack "xyz"  - the behaviors still 
aren't recognised.

The behaviors are specified in the form "button id 1234 of stack "xyzSub".  I 
tried adding "of stack "xyz" after the behavior specifications but the IDE 
simply removes that text.

At this point, it feels like I will have to put the behaviors onto a card in 
its own mainstack.  The problem with that, I think, is that all the behavior 
buttons will end up with new IDs and I'll be left with hundreds of controls 
that point to a non-existant button ID.  I guess I could write a script to go 
through all the controls that have behaviors and put the correct button IDs 
into them but looking for other suggestions before I do that.

I guess I'm OK with not using stackfiles as long as the alternative deals with 
standalone applications OK and ti doesn't result in duplicated behavior code.

Pete Haworth







http://www.mollysrevenge.com
http://www.sonicbids.com/MollysRevenge
http://www.myspace.com/mollysrevengeband








___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode

Re: Stackfiles followup

2011-02-14 Thread Monte Goulding

On 15/02/2011, at 7:01 AM, Peter Haworth wrote:

> My front scripts are now working OK after I addedd "of stack "xyz" to my 
> insert commands as Jacqueline suggested.
> 
> However, it looks like I have some wholesale changes to make to get my 
> stackFiles working correctly with regard to my behavior scripts.  The buttons 
> that hold the behavior scripts are in a substack.  I've included the name of 
> the behaviors substack and it's main stack in the stackfiles, both pointing 
> to the same file path but the behaviors still aren't recognised by the 
> controls that point to them.  I tried putting just the main stack into 
> stackFiles and adding the statement "open stack "xyzsub of stack "xyz"  - the 
> behaviors still aren't recognised.
> 
> The behaviors are specified in the form "button id 1234 of stack "xyzSub".  I 
> tried adding "of stack "xyz" after the behavior specifications but the IDE 
> simply removes that text.
> 
> At this point, it feels like I will have to put the behaviors onto a card in 
> its own mainstack.  The problem with that, I think, is that all the behavior 
> buttons will end up with new IDs and I'll be left with hundreds of controls 
> that point to a non-existant button ID.  I guess I could write a script to go 
> through all the controls that have behaviors and put the correct button IDs 
> into them but looking for other suggestions before I do that.

If you set the mainstack of the behaviors substack to itself and save it the 
ids won't change so that's a possibility. Probably the simplest thing to do is 
to leave everything as is and load the stackfile into memory at startup. From 
then on you can refer to all the stacks by name. You could hard code a relative 
path here and forget about stackfiles completely. Even better is to have a 
components folder that you parse the files of and load all stacks into memory. 
For added simplicity you could start using any stacks that have lib as the 
first 3 chars of their name. But to get you out of this hole just using 
something like this will load the stackfile:

on startup
   get the short name of stack whatever
end startup

It sounds like there's an issue with the loading of behaviors via the 
stackfiles property if it's not doing what the docs say it should.

Probably one last point to make is Trevor's excellent GLX application framework 
will handle all this stuff for you.

Cheers

Monte
___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: Stackfiles followup

2011-02-14 Thread Peter Haworth
Thanks Monte, I'll give all of that a whirl.

Pete Haworth







http://www.mollysrevenge.com
http://www.sonicbids.com/MollysRevenge
http://www.myspace.com/mollysrevengeband








On Feb 14, 2011, at 1:59 PM, Monte Goulding wrote:

> 
> On 15/02/2011, at 7:01 AM, Peter Haworth wrote:
> 
>> My front scripts are now working OK after I addedd "of stack "xyz" to my 
>> insert commands as Jacqueline suggested.
>> 
>> However, it looks like I have some wholesale changes to make to get my 
>> stackFiles working correctly with regard to my behavior scripts.  The 
>> buttons that hold the behavior scripts are in a substack.  I've included the 
>> name of the behaviors substack and it's main stack in the stackfiles, both 
>> pointing to the same file path but the behaviors still aren't recognised by 
>> the controls that point to them.  I tried putting just the main stack into 
>> stackFiles and adding the statement "open stack "xyzsub of stack "xyz"  - 
>> the behaviors still aren't recognised.
>> 
>> The behaviors are specified in the form "button id 1234 of stack "xyzSub".  
>> I tried adding "of stack "xyz" after the behavior specifications but the IDE 
>> simply removes that text.
>> 
>> At this point, it feels like I will have to put the behaviors onto a card in 
>> its own mainstack.  The problem with that, I think, is that all the behavior 
>> buttons will end up with new IDs and I'll be left with hundreds of controls 
>> that point to a non-existant button ID.  I guess I could write a script to 
>> go through all the controls that have behaviors and put the correct button 
>> IDs into them but looking for other suggestions before I do that.
> 
> If you set the mainstack of the behaviors substack to itself and save it the 
> ids won't change so that's a possibility. Probably the simplest thing to do 
> is to leave everything as is and load the stackfile into memory at startup. 
> From then on you can refer to all the stacks by name. You could hard code a 
> relative path here and forget about stackfiles completely. Even better is to 
> have a components folder that you parse the files of and load all stacks into 
> memory. For added simplicity you could start using any stacks that have lib 
> as the first 3 chars of their name. But to get you out of this hole just 
> using something like this will load the stackfile:
> 
> on startup
>   get the short name of stack whatever
> end startup
> 
> It sounds like there's an issue with the loading of behaviors via the 
> stackfiles property if it's not doing what the docs say it should.
> 
> Probably one last point to make is Trevor's excellent GLX application 
> framework will handle all this stuff for you.
> 
> Cheers
> 
> Monte
> ___
> use-livecode mailing list
> use-livecode@lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your subscription 
> preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode
> 

___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode

Re: Stackfiles followup

2011-02-14 Thread Monte Goulding
>>> However, it looks like I have some wholesale changes to make to get my 
>>> stackFiles working correctly with regard to my behavior scripts.  The 
>>> buttons that hold the behavior scripts are in a substack.  I've included 
>>> the name of the behaviors substack and it's main stack in the stackfiles, 
>>> both pointing to the same file path but the behaviors still aren't 
>>> recognised by the controls that point to them.  I tried putting just the 
>>> main stack into stackFiles and adding the statement "open stack "xyzsub of 
>>> stack "xyz"  - the behaviors still aren't recognised.

Hi Peter

I just tested using the stackfiles property as the sole reference for behaviors 
(both those on a substack of a separate stackfile and on a mainstack of a 
separate stackfile) and it worked perfectly so there must be something else 
going on. Both stackfiles were in a stackfiles subdirectory where the engine 
wouldn't normally find them. One important thing about behaviors is the engine 
has to find them before opening the stack they are used on.

Cheers

Monte


___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: Stackfiles followup

2011-02-15 Thread Peter Brigham MD

On Feb 14, 2011, at 3:01 PM, Peter Haworth wrote:

The behaviors are specified in the form "button id 1234 of stack  
"xyzSub".  I tried adding "of stack "xyz" after the behavior  
specifications but the IDE simply removes that text.


Behavior references have to be in the form of a long id:

   set the behavior of btn "testBtn" to the long id of (button id  
1234 of stack "xyzSub")


Is that the problem?

-- Peter

Peter M. Brigham
pmb...@gmail.com
http://home.comcast.net/~pmbrig



___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: Stackfiles followup

2011-02-15 Thread Peter Haworth
Monte, Thanks for the update.  I just changed all my code back to using the 
stackFiles property instead of using the code you suggested in the Startup 
event and now everything works!  I have changed this code so many times now 
that I honestly can't remember what is different about it now that when it 
didn;t work.  In any case, I'm happy it is now working and I can move on.

Thanks to all who helped out with this.

Pete Haworth







http://www.mollysrevenge.com
http://www.sonicbids.com/MollysRevenge
http://www.myspace.com/mollysrevengeband








On Feb 14, 2011, at 7:57 PM, Monte Goulding wrote:

 However, it looks like I have some wholesale changes to make to get my 
 stackFiles working correctly with regard to my behavior scripts.  The 
 buttons that hold the behavior scripts are in a substack.  I've included 
 the name of the behaviors substack and it's main stack in the stackfiles, 
 both pointing to the same file path but the behaviors still aren't 
 recognised by the controls that point to them.  I tried putting just the 
 main stack into stackFiles and adding the statement "open stack "xyzsub of 
 stack "xyz"  - the behaviors still aren't recognised.
> 
> Hi Peter
> 
> I just tested using the stackfiles property as the sole reference for 
> behaviors (both those on a substack of a separate stackfile and on a 
> mainstack of a separate stackfile) and it worked perfectly so there must be 
> something else going on. Both stackfiles were in a stackfiles subdirectory 
> where the engine wouldn't normally find them. One important thing about 
> behaviors is the engine has to find them before opening the stack they are 
> used on.
> 
> Cheers
> 
> Monte
> 
> 
> ___
> use-livecode mailing list
> use-livecode@lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your subscription 
> preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode
> 

___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode