Updating textNotes from a Plugin
Updating textNotes from a Plugin
I have a need to update textNotes on FormProcEdit via a plugin.
Right now, I have it all working by making FillControlsOnStartup() method public and then calling it from my plugin after FormProcEdit has loaded but before it is clsoed.
Any way of getting a public FillTextNotes method added to FormProcEdit? If not, what other way could I use the subscribe textNotes control to the output of my plugin?
Right now, I have it all working by making FillControlsOnStartup() method public and then calling it from my plugin after FormProcEdit has loaded but before it is clsoed.
Any way of getting a public FillTextNotes method added to FormProcEdit? If not, what other way could I use the subscribe textNotes control to the output of my plugin?
Last edited by wjstarck on Sun Nov 08, 2020 11:50 am, edited 1 time in total.
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: 5770
- Joined: Sun Jun 17, 2007 3:59 pm
- Location: Salem, Oregon
- Contact:
Re: Updating textNotes from a Plugin
How about a hook at the end of FillControlsOnStartup()?
Jordan Sparks, DMD
http://www.opendental.com
http://www.opendental.com
Re: Updating textNotes from a Plugin
Can't seem to get that to work.
Here's what I'm doing:
1) Placing a hook for a button on FormProcEdit at the bottom of FormLoad or FillControlsOnStartup()
2) Clicking the button launches a window where the user can select item(s) from a list of strings
3) Building a note based on the selection
4) Inserting the note from Step #3 into textNotes before form close.
if I add my hook at the bottom of FillControlsOnStartup, textNotes doesn't refresh with the newly built note.
Here's what I'm doing:
1) Placing a hook for a button on FormProcEdit at the bottom of FormLoad or FillControlsOnStartup()
2) Clicking the button launches a window where the user can select item(s) from a list of strings
3) Building a note based on the selection
4) Inserting the note from Step #3 into textNotes before form close.
if I add my hook at the bottom of FillControlsOnStartup, textNotes doesn't refresh with the newly built note.
Last edited by wjstarck on Sun Nov 08, 2020 3:47 pm, edited 2 times in total.
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: Updating textNotes from a Plugin
This is where I was adding FillControlsOnStartup():
Code: Select all
public static void butLocal_Click(object sender, EventArgs e) {
FormAddNotes formAN = new FormAddNotes(0, sender, _procCur, textNotes);
formAN.ShowDialog();
if (formAN.DialogResult == DialogResult.OK) {
_procCur.Note = formAN.localNote;
textNotes.Text = _procCur.Note;
formPE.FillControlsOnStartup(); <-----------------------------------
}
}
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: Updating textNotes from a Plugin
If I am correctly understanding your configuration, I think that you can add the button to the form with the hook at the end of FillControlsOnStartup() that Jordan suggested, then you could assign the string from your form to textNotes by accessing it through the parent form that it shares with the button you added. The code would look something like this:
Edit: I realized that the code suggested above is not the best solution. A hook will give access to the instance of FormProcEdit which can be used to get and set all of its controls. This makes the call to FindForm() unnecessary. Assuming that _procCur and textNotes in the butLocal_Click() method are references to the same objects in FormProcEdit, setting _procCur.Note and textNotes.Text should be all that is needed.
Code: Select all
public static void butLocal_Click(object sender, EventArgs e) {
FormAddNotes formAN = new FormAddNotes(0, sender, _procCur, textNotes);
formAN.ShowDialog();
if (formAN.DialogResult == DialogResult.OK) {
Form parentForm = ((Control)sender).FindForm();
Control[] arrayControls = parentForm.Controls.Find("textNotes",true);
arrayControls[0].Text = formAN.localNote;
}
}
Last edited by joes on Wed Nov 11, 2020 1:23 pm, edited 1 time in total.
- jordansparks
- Site Admin
- Posts: 5770
- Joined: Sun Jun 17, 2007 3:59 pm
- Location: Salem, Oregon
- Contact:
Re: Updating textNotes from a Plugin
I can't figure out why you need to call FillControlsOnStartup again. It was already called once, and it's only designed to be called once. It looks like you've set textNotes.text in the line above, so why are you saying textNotes isn't refreshing? That makes no sense. You've clearly set it.
Jordan Sparks, DMD
http://www.opendental.com
http://www.opendental.com
Re: Updating textNotes from a Plugin
Yes, that's it.
Thanks
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