Controls from plugin question
Controls from plugin question
Jordan-
I have an animated control that I want to show in FormOpenDental somewhere in the area to the right of the buttons in the ODToolbar (ToolBarMain) when I click on a menuitem in mainMenu. I have the control working from my plugin, but I suspect that I cannot see the animation because it is hidden by the ODToolbar. Is there any way to bring my animation to the forefront?
I have an animated control that I want to show in FormOpenDental somewhere in the area to the right of the buttons in the ODToolbar (ToolBarMain) when I click on a menuitem in mainMenu. I have the control working from my plugin, but I suspect that I cannot see the animation because it is hidden by the ODToolbar. Is there any way to bring my animation to the forefront?
Cheers,
Bill Starck, DDS
Big Idea Software, LLC
Developer, EASy(Electronic Anesthesia System) for Open Dental
817-807-1709
TX, USA
Bill Starck, DDS
Big Idea Software, LLC
Developer, EASy(Electronic Anesthesia System) for Open Dental
817-807-1709
TX, USA
Re: Controls from plugin question
To post a followup - I may be able to do what I want more easily if I can have a hook placed in the constructor of FormOpenDental. Is this possible?
Cheers,
Bill Starck, DDS
Big Idea Software, LLC
Developer, EASy(Electronic Anesthesia System) for Open Dental
817-807-1709
TX, USA
Bill Starck, DDS
Big Idea Software, LLC
Developer, EASy(Electronic Anesthesia System) for Open Dental
817-807-1709
TX, USA
- jordansparks
- Site Admin
- Posts: 5746
- Joined: Sun Jun 17, 2007 3:59 pm
- Location: Salem, Oregon
- Contact:
Re: Controls from plugin question
Look at the last line of the constructor. No plugins have been loaded yet, so there's no way to put a hook there. Why not use the hook at FormOpenDental.Load_end?
Jordan Sparks, DMD
http://www.opendental.com
http://www.opendental.com
Re: Controls from plugin question
OK, I found the problem.
Controls must be added before the FormOpenDental_Load event, or they won't show. Adding the Controls.Add statement to FormOpenDental.Load_end doesn't work. Is there another workaround?
Thanks.
Controls must be added before the FormOpenDental_Load event, or they won't show. Adding the Controls.Add statement to FormOpenDental.Load_end doesn't work. Is there another workaround?
Thanks.
Cheers,
Bill Starck, DDS
Big Idea Software, LLC
Developer, EASy(Electronic Anesthesia System) for Open Dental
817-807-1709
TX, USA
Bill Starck, DDS
Big Idea Software, LLC
Developer, EASy(Electronic Anesthesia System) for Open Dental
817-807-1709
TX, USA
- jordansparks
- Site Admin
- Posts: 5746
- Joined: Sun Jun 17, 2007 3:59 pm
- Location: Salem, Oregon
- Contact:
Re: Controls from plugin question
I disagree. I can add a control anytime, anyplace. I do so regularly. Just run a .BringToFront() on it if it seems to be in the back. Or stick it inside a container control that's known to be in the front already. Also, when you add it, be sure to use Controls.Add() so that it will be disposed of properly later. If you can't do that, then use if(control != null) {control.Dispose();}
Jordan Sparks, DMD
http://www.opendental.com
http://www.opendental.com
Re: Controls from plugin question
Dang, you're right again. Go figure
I had tried BringToFront(), but in FormOpenDental.Load_end, not in the constructor of my plugin's FormOpenDentalA. Once I moved it to the constructor, it worked as expected.
Thanks again.
I had tried BringToFront(), but in FormOpenDental.Load_end, not in the constructor of my plugin's FormOpenDentalA. Once I moved it to the constructor, it worked as expected.
Thanks again.
Cheers,
Bill Starck, DDS
Big Idea Software, LLC
Developer, EASy(Electronic Anesthesia System) for Open Dental
817-807-1709
TX, USA
Bill Starck, DDS
Big Idea Software, LLC
Developer, EASy(Electronic Anesthesia System) for Open Dental
817-807-1709
TX, USA
Re: Controls from plugin question
One more question:
This control is a .NET control that automatically checks for updates and downloads them if an update is available. The control must be initialized in the constructor of the form it's located on in order to automatically check for updates. I want it to show on FormOpenDental so I've made a FormOpenDentalA and added it to the designer of that form. However, plugins load after FormOpenDental is initialized, so the automatic updating portion of the control is not working. Is it possible to make this work on FormOpenDental given these constraints?
This control is a .NET control that automatically checks for updates and downloads them if an update is available. The control must be initialized in the constructor of the form it's located on in order to automatically check for updates. I want it to show on FormOpenDental so I've made a FormOpenDentalA and added it to the designer of that form. However, plugins load after FormOpenDental is initialized, so the automatic updating portion of the control is not working. Is it possible to make this work on FormOpenDental given these constraints?
Cheers,
Bill Starck, DDS
Big Idea Software, LLC
Developer, EASy(Electronic Anesthesia System) for Open Dental
817-807-1709
TX, USA
Bill Starck, DDS
Big Idea Software, LLC
Developer, EASy(Electronic Anesthesia System) for Open Dental
817-807-1709
TX, USA
- jordansparks
- Site Admin
- Posts: 5746
- Joined: Sun Jun 17, 2007 3:59 pm
- Location: Salem, Oregon
- Contact:
Re: Controls from plugin question
Why do you say this?:
I'm not aware of anything that has to be done in the constructor. That's just one handy place out of many to put initialization code. Why on earth can't it be initialized at some later time? Are you trying to initialize it before something else? What other event are you trying to beat?wjstarck wrote:...must be initialized in the constructor...
Jordan Sparks, DMD
http://www.opendental.com
http://www.opendental.com
Re: Controls from plugin question
Here's what the developer of the AutomaticUpdater says:jordansparks wrote:Why do you say this?:I'm not aware of anything that has to be done in the constructor. That's just one handy place out of many to put initialization code. Why on earth can't it be initialized at some later time?wjstarck wrote:...must be initialized in the constructor...
Here's the code block:The UI versions of the AutomaticUpdater use the OnLoad() event of the form. If you add the AutomaticUpdater from within the form's constructor, everything goes fine. If you add the AutomaticUpdater from within the form's OnLoad() event, then the AutomaticUpdater won't know that the OnLoad() event had already been called.
Code: Select all
public void InitializeComponent() {
automaticUpdater1 = new AutomaticUpdater();
((System.ComponentModel.ISupportInitialize)(automaticUpdater1)).BeginInit();
automaticUpdater1.GUID = "49d5d16a-fa8c-4bc6-b59e-ab67622abddc";
automaticUpdater1.ContainerForm = Form.ActiveForm;
automaticUpdater1.Location = new System.Drawing.Point(Form.ActiveForm.ClientSize.Width - 40, 4);
automaticUpdater1.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
automaticUpdater1.UpdateSuccessful += automaticUpdater1_UpdateSuccessful;
automaticUpdater1.UpdateSuccessful += new wyDay.Controls.SuccessHandler(automaticUpdater1_UpdateSuccessful);
automaticUpdater1.Name = "automaticUpdater1";
automaticUpdater1.RightToLeft = System.Windows.Forms.RightToLeft.Yes;
automaticUpdater1.Size = new System.Drawing.Size(16, 16);
automaticUpdater1.TabIndex = 152;
automaticUpdater1.MenuItem = menuItemCheckForUpdates;
automaticUpdater1.DaysBetweenChecks = 0; //default 7
automaticUpdater1.WaitBeforeCheckSecs = 1; //default 10
automaticUpdater1.wyUpdateCommandline = "";
automaticUpdater1.wyUpdateLocation = Application.StartupPath + "\\wyUpdate.exe";
automaticUpdater1.ClosingAborted += new System.EventHandler(automaticUpdater1_ClosingAborted);
((System.ComponentModel.ISupportInitialize)(automaticUpdater1)).EndInit();
Form.ActiveForm.Controls.Add(automaticUpdater1);
automaticUpdater1.BringToFront();
}
Code: Select all
automaticUpdater1.GUID = "49d5d16a-fa8c-4bc6-b59e-ab67622abddc";
automaticUpdater1.ContainerForm = Form.ActiveForm;
automaticUpdater1.Location = new System.Drawing.Point(Form.ActiveForm.ClientSize.Width - 40, 4);
A couple more questions might help me wrap my brain around this:
1) I have made a FormOpenDentalA to modify FormOpenDental. All I'm adding is menuItems and this control. I should be declaring FormOpenDentalA as a UserControl, right? When (if ever) should/would I declare it as a Form?
2) What happens to the code I declare in the constructor of FormOpenDentalA? Does it get merged with the constructor of FormOpenDental somehow or where/how/when does it get run if I'm using HookAddCode with FormOpenDental.Load_end?
I think that's it. Thanks.
Cheers,
Bill Starck, DDS
Big Idea Software, LLC
Developer, EASy(Electronic Anesthesia System) for Open Dental
817-807-1709
TX, USA
Bill Starck, DDS
Big Idea Software, LLC
Developer, EASy(Electronic Anesthesia System) for Open Dental
817-807-1709
TX, USA
- jordansparks
- Site Admin
- Posts: 5746
- Joined: Sun Jun 17, 2007 3:59 pm
- Location: Salem, Oregon
- Contact:
Re: Controls from plugin question
I just fixed the posted example code which had been neglected for a while, so it's fresh in my mind again.
1) FormOpenDentalA contains your static methods that act on a reference to FormOpenDental. The only reason it's a UserControl is so that you can use the Visual Studio design environment to build useful objects. The only reason it would ever be a form is if you wanted to entirely replace the existing form or add a new supplemental form. I can't think of a good reason to do that for FormOpenDental.
2) Well nothing unless you create an instance of FormOpenDentalA. There is an example of where we created an instance of ContrAccountP, and you can see that ContrAccountP contains a private static instance of ContrAccountP. That's the singleton pattern. Unless you do that, your constructor won't be called. And the code that does get called in that constructor does NOT get "merged" with the constructor of the form in OD. It is only initializing components that it contains.
I can't see enough of your code. I'm going to assume that AutomaticUpdater.cs is a UserControl where the posted code is contained. If that is the case, and if you are trying to add AutomaticUpdater itself to FormOpenDental, that could explain the problem. You would never do that. You can see that that's not one of our example patterns. AutomaticUpdater would be a container only. There would be a control inside of it which you would add to FormOpenDental at the appropriate time.
1) FormOpenDentalA contains your static methods that act on a reference to FormOpenDental. The only reason it's a UserControl is so that you can use the Visual Studio design environment to build useful objects. The only reason it would ever be a form is if you wanted to entirely replace the existing form or add a new supplemental form. I can't think of a good reason to do that for FormOpenDental.
2) Well nothing unless you create an instance of FormOpenDentalA. There is an example of where we created an instance of ContrAccountP, and you can see that ContrAccountP contains a private static instance of ContrAccountP. That's the singleton pattern. Unless you do that, your constructor won't be called. And the code that does get called in that constructor does NOT get "merged" with the constructor of the form in OD. It is only initializing components that it contains.
I can't see enough of your code. I'm going to assume that AutomaticUpdater.cs is a UserControl where the posted code is contained. If that is the case, and if you are trying to add AutomaticUpdater itself to FormOpenDental, that could explain the problem. You would never do that. You can see that that's not one of our example patterns. AutomaticUpdater would be a container only. There would be a control inside of it which you would add to FormOpenDental at the appropriate time.
Jordan Sparks, DMD
http://www.opendental.com
http://www.opendental.com