Source language: Translate to:

Using Check Box for settings type environment

Questions about using NeoBook's scripting language

Moderator: Neosoft Support

Postby smokinbanger » Wed Aug 22, 2012 3:01 pm

This will fix the problem:


-------------------This done on Page Exit-----------------------------
Code: Select all
If "[CheckBox1]" "=" "Checked"
FileWrite "[PubDir]System\Settings.ini" "6" "Checked"
Else
FileWrite "[PubDir]System\Settings.ini" "6" ""
EndIf

---------------------------------------------------------------

When a check box is checked the variable contains "Checked",
when it is unchecked the variable will be empty.

The check box variable will be retained in memory between page changes unless you are explicitly clearing/deleting them somewhere, so if the object is to reload the settings from a previously closed application you could use this at startup/shutdown instead of on page enter/exit. That being the case, would recommend saving the settings in the registry. Just MAKE SURE the the registry entries ARE REMOVED when the application is uninstalled! It's VERY UNETHICAL to leave behind old registry entries after your application is uninstalled.

Also, if I may, I would suggest you use a plugin for writing to any .ini files. This can make it much easier down the road.
smokinbanger
 
Posts: 198
Joined: Mon Jan 16, 2012 9:53 am
Location: United States

Postby Neosoft Support » Thu Aug 23, 2012 10:22 am

This works for me:

SetVar "[CheckBox1]" "True"

SetVar "[CheckBox1]" "False"

Make sure your ini file and the variable [SplashStatus] contain what you think they do.
NeoSoft Support
Neosoft Support
NeoSoft Team
 
Posts: 5602
Joined: Thu Mar 31, 2005 10:48 pm
Location: Oregon, USA

Postby smokinbanger » Thu Aug 23, 2012 3:35 pm

Neosoft Support wrote:This works for me:

SetVar "[CheckBox1]" "True"

SetVar "[CheckBox1]" "False"

Make sure your ini file and the variable [SplashStatus] contain what you think they do.
I have to admit that I didn't know that would work, altough in some instances it would be an undesirable method.

samfourie wrote:1 - I do need the False and True values to be there for other reasons and this works now, as i mentioned but... the second time i return to the page while the value still reflects true in the ini file it reverts back to false. and then it changes the value in the ini file as well.

Try using this as your page enter action:
Code: Select all
Fileread "[PubDir]System\Settings.ini" "6" "[SplashStatus]"
If "[SplashStatus]" "=" "True"
    SetVar "[CheckBox1]" "Checked"
Else
     SetVar "[CheckBox1]" ""
EndIf


samfourie wrote:2 - I am writing little bits of software exclusive for use on USB drives and Stick ( Pen-drives) so using the Registry is not an option for me
I understand. In such a case as a portable application, using the registry is not a good idea.

samfourie wrote:i am posting below the whole the Neobook file and you will understand where Item 1 above faults.
Not sure why but for some reason I get an error "This is not a valid Neobook publication."
smokinbanger
 
Posts: 198
Joined: Mon Jan 16, 2012 9:53 am
Location: United States


Return to NeoBook Action Commands

Who is online

Users browsing this forum: No registered users and 1 guest

cron