Page 1 of 1

Getting short version number within IDE

Posted: Wed Jun 03, 2015 10:47 am
by doobox
Hi there,

I am developing an application for OS X, and would like to get the short version number of the stack in the development environment.
I can and have been doing this using :

Code: Select all

  if "cRevStandaloneSettings" is among the lines of the custompropertysets of this stack then
      put the cRevStandaloneSettings["OSX,shortVersion"] of this stack into tMyVariable
   end if
BUT! This only appears to work if I have manually selected "Livecode UI Elements In Lists" from Livecode's "View" menu.

Is there any way I can get this value, when "Livecode UI Elements In Lists" is not currently selected in the "View" menu..?
Or
Is there any way I can pragmatically select that Livecode "Livecode UI Elements In Lists" menu item, get my value and then deselect the "Livecode UI Elements In Lists" menu item?

Just any way to get the current short version of the stack within the development environment when "Livecode UI Elements In Lists" is not selected?

Re: Getting short version number within IDE

Posted: Wed Jun 03, 2015 4:22 pm
by Klaus
Hi Gary,

just made a quick test, I did NOT check "Livecode UI Elements In Lists" and
created a new stack with one button, saved it, set some of the standalone settings
and put this into the script of my lonely button:

Code: Select all

on mouseUp
   answer the cRevStandaloneSettings["OSX,shortVersion"] of this stack
end mouseUp
and saw "42", what I had entered in that field!?

So this actually works without any restriction, no idea what is going wrong on your side!?


Best

Klaus

Re: Getting short version number within IDE

Posted: Wed Jun 03, 2015 4:30 pm
by doobox
Hi Klaus,

Thank's for that. It means there is still hope :-)
Not sure why I can't get the value without that menu item selected.

Can you tell me a couple of things please?
What version did you test with?
If you look physically look at the custom property sets dropdown for your stack in the inspector, do you see "cRevStandaloneSettings" in that list, even without the menu item selected?

I don't see them in that list without the menu item selected, so assumed that was why.
I am testing in the stable 7.0.5
Very strange, as soon as I select that "Livecode UI Elements In Lists", I get my value back no problem (scratches head) :-)

Re: Getting short version number within IDE

Posted: Wed Jun 03, 2015 4:45 pm
by Klaus
Hi Gary,
What version did you test with?
LC 7.05
If you look physically look at the custom property sets dropdown for your stack in the inspector,
do you see "cRevStandaloneSettings" in that list, even without the menu item selected?
No.

Maybe this is because of your IF THEN clause which I did not use?
Try without it, does not make sense but what the egg :D


Best

Klaus

Re: Getting short version number within IDE

Posted: Wed Jun 03, 2015 4:55 pm
by doobox
That'll be it, of course, as it's not in the list when the menu item is not selected.
I'll have to work out some other logic for that instead. Most importantly, I can still get the value regardless.
Thank's for your help :-)

Re: Getting short version number within IDE

Posted: Wed Jun 03, 2015 7:06 pm
by dave.kilroy
Hi Garry

Just to confirm, code such as the following works successfully for me whether or not "Livecode UI Elements In Lists" is selected

Code: Select all

put the cRevStandaloneSettings["ios,bundle version"] of stack tStack into tVersion

Re: Getting short version number within IDE

Posted: Wed Jun 03, 2015 8:21 pm
by doobox
Thank's Dave,

It did indeed turn out to be the if condition I posted that was to blame, which makes perfect sense really when you read what it says :

Code: Select all

   if "cRevStandaloneSettings" is among the lines of the custompropertysets of this stack then
      // Not run if "Livecode UI Elements In Lists" is not selected
   end if

Re: Getting short version number within IDE

Posted: Wed Jun 03, 2015 8:35 pm
by dave.kilroy
DOH! If I'd read your original 'if' statement properly I would have seen that! :)

Re: Getting short version number within IDE

Posted: Thu Jun 04, 2015 6:32 pm
by jacque
doobox wrote:It did indeed turn out to be the if condition I posted that was to blame
I'm not so sure. When I ask for the customPropertySets of a mainstack, without choosing to show LC IDE elements, I get back a list that includes the rev* sets:

cRevStandaloneSettings
cREVGeometryCache
cREVGeneral

This returns "true":
put "cRevStandaloneSettings" is among the lines of the custompropertysets of this stack

Your test is valid. So there is something odd going on with your setup but I'm not sure what. Those property sets exist in the stack and a script that references them should not be affected by whether or not you've chosen to display them in the IDE. On my machine, there is no problem with it and I've been both getting and setting elements of that set routinely for a long time.

Are you sure that "this stack" is the mainstack when the script runs? What happens if you change your handler to this:

Code: Select all

if "cRevStandaloneSettings" is among the lines of the custompropertysets of stack "myMainstack" then

Re: Getting short version number within IDE

Posted: Thu Jun 04, 2015 7:26 pm
by doobox
Hi Jacque,

It certainly seems from what your saying that I was only partially correct that my if condition was breaking things when the show elements setting was not selected.
However, removing that if condition did solve the issue instantly.
As to "this stack" referring to the correct stack.. hmmmm, maybe something in that, but two things spring to mind.
1) regardless of which stack "this stack" was referring to, from what your saying, that referenced stack should have passed that condition regardless right.
2) I did not change "this stack" in the code inside that condition, after removing the condition, and it does indeed set the property's onto the main stack, so the main stack is and has always been "this stack". (as far as i can tell).

Re: Getting short version number within IDE

Posted: Thu Jun 04, 2015 7:31 pm
by doobox
I don't really remember my thinking in using that condition anyway.
All I was doing in essence was the same as :

Code: Select all

  if the environment is "development" then
At least I think that's what I was thinking :-)

Re: Getting short version number within IDE

Posted: Thu Jun 04, 2015 7:50 pm
by jacque
It's puzzling. The strange part is that your "if" clause was correct and should have worked, so something else is causing the failure. Unless you're morbidly curious though, I'd probably just leave off the "if" and do what you're doing now.

Re: Getting short version number within IDE

Posted: Thu Jun 04, 2015 8:03 pm
by doobox
Year, I'v been 10 hour's trying to solve the revXML question I posted below this one. My head's now hurting to much for curiosity today :-)
replacing it with "if the environment is "development" then" works for me now.