Choose Language Hide Translation Bar
pjr1121
Community Trekker

Add-in ; User Setting Default values

I've been looking into Add-ins for distributing complex scripts and I was curious if there is a way for the user to set the default values.  Lets say, for example, a Text Edit box is on Module1.  During design time, I can set its initial values, and during run time, i can manipulate it with <<Set Text; or act on its value using <<Get Text.  If I were to add a button named "Save Current Values As Default", can the button script set the Text Edit box's default value for the current user?

 

In the event of a dozen or so input fields, it would be handy for the end user to set default values common to their needs.

0 Kudos
1 ACCEPTED SOLUTION

Accepted Solutions
cwillden
Super User

Re: Add-in ; User Setting Default values

You could have a file bundled in with the add-in that stores default values and have your button update that file.  A simple jmp table would work well there.  For example, if your add-in ID is my_addin, and the table of user preferences for your app was user_prefs.jmp, you could reference that file using this path: "$ADDIN_HOME(my_addin\user_prefs.jmp)". 

 

You would need to set up your application to populate the inputs using the values stored in that data table when the app launches, and program that button to update that file with the current entries to those fields.

-- Cameron Willden

View solution in original post

4 REPLIES 4
cwillden
Super User

Re: Add-in ; User Setting Default values

You could have a file bundled in with the add-in that stores default values and have your button update that file.  A simple jmp table would work well there.  For example, if your add-in ID is my_addin, and the table of user preferences for your app was user_prefs.jmp, you could reference that file using this path: "$ADDIN_HOME(my_addin\user_prefs.jmp)". 

 

You would need to set up your application to populate the inputs using the values stored in that data table when the app launches, and program that button to update that file with the current entries to those fields.

-- Cameron Willden

View solution in original post

txnelson
Super User

Re: Add-in ; User Setting Default values

Much like what @cwillden wrote, I have saved the actual default settings as .jsl files, and then all that had to be done was to do a simple check to see if a default file exists, and then if it does, then just Include() the .jsl file.

Jim
pjr1121
Community Trekker

Re: Add-in ; User Setting Default values

Thanks for the response.  Including a file in the addin directory sounds like a resonable approach.  I'm assuming $ADDIN_HOME is a relative path to account for different install directories, correct?

cwillden
Super User

Re: Add-in ; User Setting Default values

Sorry about the delayed response, but yes it is a relative path which is what makes add-ins completely portable.

-- Cameron Willden
0 Kudos