preferences stack
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller
preferences stack
Hi,
I created a separate stack in the specialFolderPath to save and to retrieve preferences of standalone apps.
When I start the main app the pref stack gets opened automatically and is visible in the Project Browser.
Is that how it should be?
keram
I created a separate stack in the specialFolderPath to save and to retrieve preferences of standalone apps.
When I start the main app the pref stack gets opened automatically and is visible in the Project Browser.
Is that how it should be?
keram
Using the latest stable version of LC Community 6.7.x on Win 7 Home Premium, 64bit
Re: preferences stack
Hi keram,
Can't believe it
General hint: You do not need to actuially OPEN or GO to a stack if you want to store something in its custom properties!
This will do:
...
put specialfolderpath("desktop") & "/a stack.rev" into tPrefsFile
set the cAnyStoredValue of stack tPrefsFile to the hilite of btn 1
save stack tPrefsFile
close stack tPrefsFile
...
This way the stack will be "opened" invisibly and without any messages, so you can manipulate it,
but need to SAVE and CLOSE after you are done.
Best
Klaus
WHAT specialfolderpath?keram wrote:I created a separate stack in the specialFolderPath...
Automatically? And you did not script to open that stack?keram wrote:When I start the main app the pref stack gets opened automatically and is visible in the Project Browser.
Can't believe it

What "should" be in your opinion?keram wrote:Is that how it should be?
General hint: You do not need to actuially OPEN or GO to a stack if you want to store something in its custom properties!
This will do:
...
put specialfolderpath("desktop") & "/a stack.rev" into tPrefsFile
set the cAnyStoredValue of stack tPrefsFile to the hilite of btn 1
save stack tPrefsFile
close stack tPrefsFile
...
This way the stack will be "opened" invisibly and without any messages, so you can manipulate it,
but need to SAVE and CLOSE after you are done.
Best
Klaus
Re: preferences stack
Hi Klaus,
with this code:
I wasn't using this line put gSFPath &"/prefs.rev" into gPrefsFile before; was using ("file:" & gSFPath &"/prefs.rev") which wasn't really right and created another problem; now saving and retrieving the data works OK.
I'll keep searching through the code and try to find why it opens automatically.
keram
Sorry for not being more specific right from the start.Klaus wrote:WHAT specialfolderpath?
with this code:
Code: Select all
switch platform()
case "android"
## Android
put specialFolderPath("documents") into gSFPath
break
case "Win32"
## Everything >= Win2000
if the systemversion contains "NT" then put specialFolderPath(26) into gSFPath
break
case "MacOS"
## MacOS X
put specialFolderPath("preferences") into gSFPath
break
end switch
put gSFPath &"/MQdata" into gSFPath
if there is not a folder gSFPath then new folder gSFPath --new folder
if result() <> empty then answer "Sorry, but there was a problem writing to a .rev file." with "OK"
-----
if there is no file (gSFPath &"/prefs.rev") then
createDataStack
-----
on createDataStack
clone invisible stack "prefs" --- this is a substack with default preferences
set the name of stack "Copy of prefs" to "preferences"
set the fileName of stack "preferences" to gSFPath &"/prefs.rev"
put gSFPath &"/prefs.rev" into gPrefsFile
save stack gPrefsFile
close stack gPrefsFile
end createDataStack
on closeStack
save stack gPrefsFile
close stack gPrefsFile
end closeStack
I wasn't using this line put gSFPath &"/prefs.rev" into gPrefsFile before; was using ("file:" & gSFPath &"/prefs.rev") which wasn't really right and created another problem; now saving and retrieving the data works OK.
Yes, when I open the main stack i see this: and then once I make some changes to the settings and they get saved I see this: No I don't script to open that prefs stack; also when I open couple of cards then that prefs stack pops up again in the Project Browser.Klaus wrote:Automatically? And you did not script to open that stack?
Can't believe it
I think that prefs stack should not pop up automatically in Project Browser. Doesn't it mean that it's open? It should not open by itself.Klaus wrote:What "should" be in your opinion?
I'll keep searching through the code and try to find why it opens automatically.
keram
Using the latest stable version of LC Community 6.7.x on Win 7 Home Premium, 64bit
Re: preferences stack
Hi Keram,
yes, I see, and no, it should not open automatically!
Maybe somewhere in your scripts you refer to that stack and it opens?
Best
Klaus
yes, I see, and no, it should not open automatically!
Maybe somewhere in your scripts you refer to that stack and it opens?
Best
Klaus
Re: preferences stack
On couple of places this line was there:Klaus wrote:Maybe somewhere in your scripts you refer to that stack and it opens?
set the cMySelection of stack gPrefsFile to gMySelection
so I added:
save stack gPrefsFile
close stack gPrefsFile
Now it opens only when when the main stack opens, but it's not visible, I only see it in the Project Browser.Klaus wrote:This way the stack will be "opened" invisibly and without any messages, so you can manipulate it,
Could it be that it does so because the preferences are loaded from the prefs stack?
keram
Using the latest stable version of LC Community 6.7.x on Win 7 Home Premium, 64bit
Re: preferences stack
Hi Keram,
not sure, and definitively no idea what the project browser is doing anyway
Best
Klaus
not sure, and definitively no idea what the project browser is doing anyway

Best
Klaus
Re: preferences stack
Hi Klaus,
I figured it out.
When the main stack opens then 2 preferences are read from the prefs stack:
put the cMySelection of stack gPrefsFile into gMySelection
put the cMyCategories of stack gPrefsFile into gMyCategories
this makes the prefs stack appear in Project Browser.
Then I added close stack gPrefsFile after the above 2 lines and all is OK, I hope.
Thanks for your help
keram
I figured it out.
When the main stack opens then 2 preferences are read from the prefs stack:
put the cMySelection of stack gPrefsFile into gMySelection
put the cMyCategories of stack gPrefsFile into gMyCategories
this makes the prefs stack appear in Project Browser.
Then I added close stack gPrefsFile after the above 2 lines and all is OK, I hope.
Thanks for your help

keram
Using the latest stable version of LC Community 6.7.x on Win 7 Home Premium, 64bit