Page 1 of 1

User input in a plugin?

Posted: Thu Sep 03, 2009 3:06 pm
by pomalle
Hi,

I would like to write a Dplot "generate" plugin that queries the user for three numerical values. It would seem that this is potentially possible but would require the DLL to spawn a window with controls such as buttons and input fields and all that. Has anyone ever done this? If so, is there an example out there? Or is there an easier way?

Thanks!

Posted: Fri Sep 04, 2009 11:59 am
by DPlotAdmin
Several of the generate plugins distributed with DPlot display dialog boxes and take user input. The "Moving Average" plugin is probably the simplest. If you'd like I'll be happy to post the source where you can get it.

Posted: Fri Sep 04, 2009 12:04 pm
by pomalle
Thanks! I found the moving average plugin source code in another post. It intimidated me :) Maybe I'll give it a try.

Posted: Sat Sep 05, 2009 1:04 pm
by DPlotAdmin
I'll be happy to help if you have a hard time with this. For old-timers using archaic programming languages as I do there really isn't anything magic about it. But if you're accustomed to, for example, VB then the dialog procedure may look like spaghetti.

Other than that, the only real gotcha is explained in the post you've already found: returning with an error due to insufficient array sizes, whereupon DPlot will adjust the arrays and call your plugin again. At that point (in most cases) you wouldn't want to again display your dialog box. The solution is a little convoluted but works.

Again, don't hesitate to ask if you have problems. I'll be happy to help if I can.