
PRO
rz90208
USA
Asked
— Edited

I have went thru the tutorial for the plugin and have successfully created a basic plugin. Now I want to go the next step and create a plugin that has a configuration page that is accessed by clicking the gear icon but can not figure out how to do it.
The plugin I hope to create will allow the user to create a connection to a database using a DSN.
RichardZ
Update: One Step Closer - I found the UCConfigurationButton
Update2: Stumbled upon ptp's testplugin on github and creating a ConfigForm.cs using it as my example.
Thank you DJ, I also think I cannot use the cmd to return my SQL response. And I think I need to use a loop to fill an array if I get more then one hit with the query. i need to slow down and think the process through.
Yeah - wait for ptp's response, he'll know. I'm not in front of visual studio to assist. He'll also need to check for a null if no records match and return a blank string
@ptp, Ok my friend where did I go wrong. (besides trying this in the first place) Here is my code. When I debug from VisualStudio, I get unknown function. I did add my plugin to my project and see the blank form. I get no errors when I build the project.
Didn’t add the event to the ezscript engine. Most likely because form main load and form main closing aren’t actually assigned to their events.
Select the form main. In the event Browser select those events to assign to those methods.
You are going to have to give me more then that. I see FormMain_Load and FormMain_FormClosing but do not understand what you want me to do with them. Sorry this C# is all new to me yet.
@rz90208: you are progressing in the right direction, almost there.
Opening Visual Studio, I'll code the missing logic, give me a couple minutes.
@rz90208: I added a new function QueryData to the Miscellaneous Utility Plugin: https://synthiam.com/redirect/legacy?table=plugin&id=293
Source Code: https://github.com/ppedro74/ezrobot-playground/blob/master/plugins/MiscUtilityPlugin/MiscUtilityPlugin/MainForm.cs
I'm running out time, so minimal documentation, and basic tests no bullet proof code.
Copied from the plugin page*
version 4 : Added: DataQuery function Syntax: DataQuery (connection, query, [limit], [output variable], [query argument 0], [query argument 1], [query argument n]) => Int32 Connection: Provider Name and connection string. Query: SQL Query Limit: Max Number of records to return. Default 100 Output Variable: Name of Array Variable. Default is $data_ . $data_0 array for column 0 values, $data_1 array for column 1 values, etc. Query Argument 0: Value for query Parameter @0, @1, etc. Returns: Number Of Rows Some Examples:
Excel File (Note Excel 97/2003 format) Excel1.zip
SQL 2012 server Query:
ODBC User DSN MyDSN1 Query :
ODBC excel 97/2003 Query:
OLEDB excel 97/2003 Query: Paging the results, using a query parameter @0 for $LastId
Try it and let me know the feedback.
Ptp’s got you covered.
As for learning events, google tutorials are great. If you look at the code which you’ve copy and pasted from my tutorial, there’s a formmain_load and formmain_closing
Those aren’t being executed because they’re not connected to anything. Events in object oriented programming are executed when something else executed them. In those case, by their names, loading the form and closing the form.
You need to tell the form to execute those functions when the form loads and when the form is closing.
Do that in the events list of the properties of the form. Locate the form loading and form closing options and select the appropriate methods from the drop down.
Look at this video. It’s terriblr quality but he shows exactly how to find the events for a form: https://youtu.be/LbgO1lZ6WRI
All graphic objects have events. You can explore what events each object has. For example a button has an OnClick event for when it’s pressed