Add Hook for the Plugin
-
- Posts: 6
- Joined: Wed Aug 23, 2023 6:26 am
Add Hook for the Plugin
Hi,
We are working on adding customizations to OpenDental, our hook for one of those features is,
"Plugins.HookAddCode(this, "ContrChart.FillPtInfo_end", Pd.Patient);"
please add it to your latest version at the location "Opendental > ControlChart.cs > FillPtInfo > Before 'gridPtInfo.EndUpdate();' line. (FYI: We are working on 22.4 version)
Let me know if you need anything else.
Thank you!
We are working on adding customizations to OpenDental, our hook for one of those features is,
"Plugins.HookAddCode(this, "ContrChart.FillPtInfo_end", Pd.Patient);"
please add it to your latest version at the location "Opendental > ControlChart.cs > FillPtInfo > Before 'gridPtInfo.EndUpdate();' line. (FYI: We are working on 22.4 version)
Let me know if you need anything else.
Thank you!
Re: Add Hook for the Plugin
I have added this to our list and will update this thread once it is complete. Thank you.
-
- Posts: 3
- Joined: Thu Nov 02, 2023 1:51 pm
Re: Add Hook for the Plugin
Hello!
We were able to add a hook where you requested, the location description was changed to reflect the actual location of the hook:
It will be available in version 23.3.5!
Thank you!
We were able to add a hook where you requested, the location description was changed to reflect the actual location of the hook:
Code: Select all
Plugins.HookAddCode(this, "ContrChart.FillPtInfo_BeforeEndUpdate", Pd.Patient);
Thank you!
-
- Posts: 6
- Joined: Wed Aug 23, 2023 6:26 am
Re: Add Hook for the Plugin
Thanks for the quick update.
But the hook has been added to at a different location due to multiple "gridPtInfo.EndUpdate();" in the page, please add the following hooks at the scripts provided below to the latest version
But the hook has been added to at a different location due to multiple "gridPtInfo.EndUpdate();" in the page, please add the following hooks at the scripts provided below to the latest version
- Please add the hook - Plugins.HookAddCode(this, "ContrChart.FillPtInfo_end", Pd.Patient); 'Module > ControlChart.cs' at
Code: Select all
else { gridPtInfo.ListGridRows.Add(row); } } Plugins.HookAddCode(this, "ContrChart.FillPtInfo_end", Pd.Patient); gridPtInfo.EndUpdate(); }
- Please add the hook - Plugins.HookAddCode(this, "ContrFamily.LayoutToolBar_end", _patCur, _odPictureBoxPat); 'Module > ControlFamily.cs', at two places as shown below
Code: Select all
try { _odPictureBoxPat.Image?.Dispose(); if(_loadData.HasPatPict==YN.Unknown) { Plugins.HookAddCode(this, "ContrFamily.LayoutToolBar_end", _patCur,_odPictureBoxPat); _odPictureBoxPat.Image=Documents.GetPatPict(_patCur.PatNum,ImageStore.GetPatientFolder(_patCur,ImageStore.GetPreferredAtoZpath())); } else { Plugins.HookAddCode(this, "ContrFamily.LayoutToolBar_end", _patCur, _odPictureBoxPat); _odPictureBoxPat.Image=Documents.GetPatPict(_patCur.PatNum,ImageStore.GetPatientFolder(_patCur,ImageStore.GetPreferredAtoZpath()),_loadData.PatPict); } } catch {
- Please add the hook - Plugins.HookAddCode(this, "DisplayField.FillPtInfo_end", new object[2] { _listDisplayFieldsAvail, _listDisplayFieldsShowing }); 'Module = FormDisplayFields.cs' at
Code: Select all
listAvailable.Items.Clear(); listAvailable.Items.AddList(_listDisplayFieldsAvail,x=>x.ToString()); Plugins.HookAddCode(this, "DisplayField.FillPtInfo_end", new object[2] { _listDisplayFieldsAvail, _listDisplayFieldsShowing }); } private void gridMain_CellDoubleClick(object sender,ODGridClickEventArgs e) {
- Please add the hook - Plugins.HookAddCode(this, "SelectPatient.FillPtInfo_end", new object[2] { _tablePats, _listDisplayFields }); 'Module > formpatientselect' at
Code: Select all
if (PIn.Long(_tablePats.Rows[i][0].ToString()) == PatNumInitial) { gridMain.SetSelected(i, true); break; } } Plugins.HookAddCode(this, "SelectPatient.FillPtInfo_end", new object[2] { _tablePats, _listDisplayFields }); this.AcceptButton = butOK;
Re: Add Hook for the Plugin
I have added these additional hooks to our list and we will update this thread once the is complete.
Note that the first of these four was completed in the original job. It was backported to 23.3.5, so the surrounding code will look different than your current version (22.4).
Note that the first of these four was completed in the original job. It was backported to 23.3.5, so the surrounding code will look different than your current version (22.4).
-
- Posts: 6
- Joined: Wed Aug 23, 2023 6:26 am
Re: Add Hook for the Plugin
Understood, Thank you.
Looking forward for the update.
Looking forward for the update.
-
- Posts: 3
- Joined: Thu Nov 02, 2023 1:51 pm
Re: Add Hook for the Plugin
So that we can best approach the implementation of these hooks, could you describe the intended use of the hooks for the Family module and the Patient Select form?
-
- Posts: 6
- Joined: Wed Aug 23, 2023 6:26 am
Re: Add Hook for the Plugin
Sure, Hook in Family module is to display Patient image from our database while the one in patient select form is to add and display additional columns that are not available in the display fields.
-
- Posts: 3
- Joined: Thu Nov 02, 2023 1:51 pm
Re: Add Hook for the Plugin
Thank you for your response! For the sake of maintaining your intended behavior with the hooks, there are some changes that may be worth considering. I'd like to run them by you and see if they might make your goals a little easier.
For the Family Module, there is code immediately following where you requested to put your hook:
This code would cause an overwrite of any changes that were made to pictureBoxPat.Image. If that is a problem, we would like to use the other code hook called HookMethod, which would prevent the code following your hook from running. It would look like this:
Regarding the hook in FormPatientSelect, the addition of new grid columns and entries is considerably complicated after the grid has already been populated. We would like to suggest using HookAddMethod before the grid population. This would allow you to simply rewrite the algorithm that adds columns and entries to the grid, which may be much more straightforward. Here is how it would look:
If these changes work for you, we can get them implemented straight away! Otherwise, please let us know if these changes will cause any difficulty for you, or if you have any questions regarding these changes. Thanks!
For the Family Module, there is code immediately following where you requested to put your hook:
Code: Select all
object[] objectArrayParameters={_patient,pictureBoxPat};
Plugins.HookAddCode(this,"ContrFamily.FillPatientPicture_BeforeImageAssign",objectArrayParameters);
if(_loadData.HasPatPict==YN.Unknown) {
pictureBoxPat.Image=Documents.GetPatPict(_patient.PatNum,patFolder);
}
else {
pictureBoxPat.Image=Documents.GetPatPict(_patient.PatNum,patFolder,_loadData.PatPict);
}
Code: Select all
object[] objectArrayParameters={_patient,pictureBoxPat};
Plugins.HookMethod(this,"ContrFamily.FillPatientPicture_BeforeImageAssign",objectArrayParameters);
if(_loadData.HasPatPict==YN.Unknown) {
pictureBoxPat.Image=Documents.GetPatPict(_patient.PatNum,patFolder);
}
else {
pictureBoxPat.Image=Documents.GetPatPict(_patient.PatNum,patFolder,_loadData.PatPict);
}
Code: Select all
_tablePats=dataView.ToTable();
}
object[] objectArrayParameters={ _tablePats,_listDisplayFields };
Plugins.HookMethod(this,"FormPatientSelect.FillGridFinal_BeforeGridUpdate",objectArrayParameters);
gridMain.BeginUpdate();
gridMain.ListGridRows.Clear();
-
- Posts: 6
- Joined: Wed Aug 23, 2023 6:26 am
Re: Add Hook for the Plugin
Sure, we changed the hooks to hookmethod as you suggested, and they work as intended in the below locations,
For the Family Module
For the FormPatientSelect, adding hook before the grid population results in displaying data twice on the patient select screen, from both the hook and grid population which I believe can only be resolved if you add it after i.e. in the below mentioned location,
Please let us know if there is anything else you would like us to change,
Thank you.
For the Family Module
Code: Select all
private void FillPatientPicture() {
Plugins.HookMethod(this, "ContrFamily.LayoutToolBar_end", _patCur, _odPictureBoxPat);
_odPictureBoxPat.Image?.Dispose();
Code: Select all
gridMain.ListGridRows.Add(row);
}
object[] objectArrayParameters = { _tablePats, _listDisplayFields };
Plugins.HookMethod(this, "FormPatientSelect.FillGridFinal_BeforeGridUpdate", objectArrayParameters);
gridMain.EndUpdate();
Thank you.