views:

41

answers:

2

I'm working on a plugin system. Some plugins need user input. I would like them to be able to report to the main application what input they need and have the main application decide how to get it. It seems like there might be some kind of library designed for specifying options like this. So like the plugin could return some kind of Options object specifying names and types of options which the main application could use to determine what kind of controls to show to get the needed options.

I have no idea if something like this exists, but it seems somewhat likely given that there seem to be a lot of applications to use options like this. I'm thinking of things like Firefox's about:config that just shows a massive list of options and knows how to handle each one. Basically I want to be able to make an about:config page for my main application (it's not a web app or a browser, that's just an example) that sees what options the plugins want and automatically generates a simple interface (like about:config) to get those options.

+2  A: 

If it's a WinForms app, take a look at the PropertyGrid control. You create a class object that contains properties for all of the options you want the user to configure. Then you set the "SelectedObject" property of your PropertyGrid with this object. The control will then create a window that lets your user modify the values of your options object at runtime.

David
Awesome. I'm still up for hearing more answers, but I did not know about PropertyGrid and that would definitely work.
Daniel Straight
A: 

Your request for the functionality is quite a peculiar one. Usually the framework (or some special library) doesn't know about the application's design and requirements, neither does it know when is it an appropriate moment to ask something from the user. Moreover, usually the plugins are loaded on demand, not at the application start, so having any UI logic here triggered by the framework/library may be highly inappropriate.

So, basically it looks like you'll need to write the library yourself.

Vlad
I don't think it's unusual at all. Many, many, many applications with plugin frameworks also provide a standard UI that the plugins utilize to configure themselves.
Nick