This is a question for Dezsoe, Balazs, or any other plugin writer, I seek help on something that shouldn't be hard
I've been messing around with how to setup a plugin to fire off of a button code that isn't hard coded, but is user configurable. The attached is a demo plugin that allows the user to setup the user assigned button code using the 'config plugin' button in the plugins menu. I've included the whole 'project' file as well as the compiled .dll so it is apparent what I'm doing, using 'my.settings' to hold the user assigned button code.
The basic functionality of using a user saved number and firing off the plugin works fine, but I'm having a weird issue I can't figure out.
When ever I 'show' a plugin using the button code (either from a screenset button, or from assigned hotkey), the plugin show up event obviously triggers, but as soon as the form appears, it disappears like UCCNC hid the window. If I'm in the plugin menu and use the 'show' button (showup_event), I can open/close the plugin repeatedly without issue. But as soon as I go back to using a buttoncode to open the plugin, it disappears and I can't get it back until I restart UCCNC.
While troubleshooting this on one of my real plugins, I put msgboxes all over the initial 'form_load' proceedure. When I open the plugin using the button code, it fully loads, and returns back to the main plugin 'Buttonpress_event' (based on all message boxes I set for trouble shooting firing off), and then after that the form window disappears as soon as the 'buttonpress_event' routine completes. I know the plugin is running, because I can call up the 'config' form, and also because it has multiple forms, and sometimes one of the other forms will remain open, but the main form has disappeared with no way to get it back... I've tried adding myform.visible=true, myform.bringtofront... nothing works
I have identical simple 'form.show' code in both 'showup_event' and in 'buttonpress_event'... so what is UCCNC doing different between those two methods that's making the main/initial form disappear after a 'buttonpress_event' complets? I've played with this on V 1.2009 and 1.2112 and 1.2113...and two computers, and am losing my mind. (not that I had much to start with... )
I've not used the 'button press' method of opening plugins previously, and I have a goal to cleanup some of the rough edges on some of my plugins so that 'load on startup' doesn't need to be checked, but I've not liked the thought of hard coded 'button codes' that could conflict with other user settings
Would greatly appreciate any thoughts or ideas on what is going on...
regards
Eric