com.moneydance.apps.md.controller.UserPreferences

John Doll's Avatar

John Doll

14 Jan, 2012 01:45 AM

Hello,

I've been working on a custom interface to the Budget Manager for some time and need to store some user settings to persist across sessions. I came across another extension that demonstrated the usage of UserPreferences.

I successfully implemented a prototype, but have come across an issue I can't seem to resolve.

After calling UserPreferences.setSettings(...), subsequent to retrive information return the current values but I notices that the file config.dict is not getting updated with the current values. I assume the values are buffered in memory.

I found through trial and Error that if I simply open the preferences and select OK, the preferences are then immediately written to disk.

How can I force the write to disk after I change value settings?

-Thanks

  1. 1 Posted by Ben Spencer on 14 Jan, 2012 03:03 AM

    Ben Spencer's Avatar

    com.moneydance.apps.md.controller.Main.savePreferences()

    That should do it.

    Ben Spencer
    Moneydance Support

  2. 2 Posted by John Doll on 14 Jan, 2012 09:09 PM

    John Doll's Avatar

    How do I get an object of that class (com.moneydance.apps.md.controller.Main)?

    The class of the extension is, com.moneydance.apps.md.controller.FeatureModule and I don't see any methods that will get me there?

  3. 3 Posted by johndolljr on 14 Jan, 2012 09:17 PM

    johndolljr's Avatar

    How do I get an object of that class
    (com.moneydance.apps.md.controller.Main)?

    The class of the extension is,
    com.moneydance.apps.md.controller.FeatureModule and I don't see any methods
    that will get me there?

  4. 4 Posted by John Doll on 15 Jan, 2012 08:00 PM

    John Doll's Avatar

    I'll answer my own follow up, I forget that I already new that I could cast the context to the Main class.

    public void setContext(final FeatureModuleContext context) {

        this.mainContext = (com.moneydance.apps.md.controller.Main)
                context;
    }
    

    protected void setPublishDetails(final Hashtable<String, String> hashtable) {

        StreamTable thisTable = null;
        if (hashtable != null) {
            thisTable = new StreamTable();
            thisTable.merge(hashtable);
        }
    
        this.getUserPreferences().setSetting("myextname.publishDetails", thisTable);
        savePreferences();
    

    }

    private void savePreferences(){

        try {
            this.mainContext.savePreferences();
        } catch (Exception e) {
            e.printStackTrace();
        }
    

    }

  5. 5 Posted by john.dempsey on 22 Jan, 2012 12:44 PM

    john.dempsey's Avatar

    The existing budget interface is an area I have a real problem with so I look forward to seeing your custom interface when it is available.

    John

  6. 6 Posted by John Doll on 22 Jan, 2012 12:49 PM

    John Doll's Avatar

    I posted it on my website a few days ago:
    http://www.ragingcoders.com/BudgetManager

    I know it's still a little rough, but if I get enough feedback, I
    think it can turn into something.

  7. 7 Posted by john.dempsey on 22 Jan, 2012 06:29 PM

    john.dempsey's Avatar

    John

    It has got great potential. I really like the spreadsheet interface for budgeting, it is so intuitive.

    As you mentioned, it seems to have some "rough edges' but I really hope you will persevere.

    I have a lot of budget categories set up in MD Budget Manager for the entire year as an amount monthly. In your extension they only indicate an amount for January with zero for the subsequent 11 months but they show correctly in MD budgets.

    I also find sometimes when I use your extension to change one of these zero monthly budget amounts it doesn't "stick" but this may be part of the above problem.

    Let me know if you need any specific info to assist you.

    John

  8. 8 Posted by John Doll on 22 Jan, 2012 07:02 PM

    John Doll's Avatar

    I'll stop this thread and ask to continue via email,
    [email blocked], unless there is a better place for this
    conversation.

    Your right, I have not dealt with repeating monthly budgets. It
    probably won't take much to get them to display properly. Entry of
    such a budget will still have to done through the default interface
    for a while.

    I never came across this since I tend to personally have unique
    monthly values, even when I start with a repeating value I copy it to
    each month due to how I balance and shift money around. This of course
    leads to some tedious setup each January. But I have some ideas on how
    to tackle it.

    Please feel free to send any additional comments, ideas, etc... to my email.

  9. System closed this discussion on 31 Mar, 2015 03:40 PM.

Comments are currently closed for this discussion. You can start a new one.

Keyboard shortcuts

Generic

? Show this help
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac