HookAddCode request - end of LayoutToolbar's in MainModules

This forum is for programmers who have questions about the source code.
Post Reply
alkhaef
Posts: 105
Joined: Fri Jul 02, 2010 10:37 am
Location: Los Angeles, CA

HookAddCode request - end of LayoutToolbar's in MainModules

Post by alkhaef » Thu Sep 02, 2010 10:19 pm

A little bit of explanation is at viewtopic.php?f=3&t=2881
I'd like to request hooks at the end of the LayoutToolbar calls in the modules (just before the call to invalidate), because it would allow toolbar changes that don't get clobbered later (LayoutToolbar is often called from other places besides InitializeOnStartup - yes, I learned this the hard way :P).
Thanks!
Al
Help! I've OD'ed on OD! :)

alkhaef
Posts: 105
Joined: Fri Jul 02, 2010 10:37 am
Location: Los Angeles, CA

Re: HookAddCode request - end of LayoutToolbar's in MainModules

Post by alkhaef » Fri Sep 03, 2010 9:45 am

Just wanted to clarify a bit, so this doesn't look like a dupe request...

I noticed that 7.2 has a hook like the following in each of the main modules, and another respective one in ModuleUnselected:

Code: Select all

Plugins.HookAddCode(this,"ContrChart.ModuleSelected_end",patNum);//Hook added to allow adding buttons to the toolbar.
The comment implies that this hook is already there to achieve what I'm asking for. While still useful (I requested them :P), these hooks serve a different purpose.

I actually tried sticking a hook in that spot myself in 7.0, but found that it hadn't worked for adding toolbar buttons, because LayoutToolbar is called from other places than ModuleSelected (don't remember the details - signal received? updated module data? going to another module and returning?), so the button I added would disappear when adding it that way.

The end of LayoutToolbar was the only place I tried it where it would persist.

Thanks!
Al
Help! I've OD'ed on OD! :)

michael
Posts: 38
Joined: Wed Aug 04, 2010 8:49 am

Re: HookAddCode request - end of LayoutToolbar's in MainModules

Post by michael » Fri Sep 10, 2010 8:06 am

LayoutToolBar_end hooks added to the main modules (except Staff which does not have the LayoutTooldBar function) in version 7.2.39.

michael
Posts: 38
Joined: Wed Aug 04, 2010 8:49 am

Re: HookAddCode request - end of LayoutToolbar's in MainModules

Post by michael » Fri Sep 10, 2010 11:33 am

Small change was made. Instead of passing PatCur.PatNum, PatCur was passed to avoid a null pointer exception. Again, this hook will be released with 7.2.39.

alkhaef
Posts: 105
Joined: Fri Jul 02, 2010 10:37 am
Location: Los Angeles, CA

Re: HookAddCode request - end of LayoutToolbar's in MainModules

Post by alkhaef » Mon Sep 13, 2010 2:08 pm

Thanks Michael.

Great point. Even better.

FYI though - I just looked at head, and noticed that you only made this change to LayoutToolbars, although your concern probably also applies to the ModuleSelected, and ModuleUnselected too. Actually, ModuleUnselected isn't passing anything.

Anyway, I just wanted to give you a heads up, since you probably intended to make the change to its sister hooks too ;).

Best,
Al
Help! I've OD'ed on OD! :)

User avatar
jordansparks
Site Admin
Posts: 5770
Joined: Sun Jun 17, 2007 3:59 pm
Location: Salem, Oregon
Contact:

Re: HookAddCode request - end of LayoutToolbar's in MainModules

Post by jordansparks » Mon Sep 13, 2010 7:59 pm

But patNum is an available variable, and it's impossible for it to be null because it's a value type. As for ModuleUnselected, patNum is irrelevant.
Jordan Sparks, DMD
http://www.opendental.com

alkhaef
Posts: 105
Joined: Fri Jul 02, 2010 10:37 am
Location: Los Angeles, CA

Re: HookAddCode request - end of LayoutToolbar's in MainModules

Post by alkhaef » Tue Sep 14, 2010 3:50 pm

But patNum is an available variable, and it's impossible for it to be null because it's a value type.
Ah. Indeed. Didn't notice it was a passed-in variable, and not PatCur.PatNum.
As for ModuleUnselected, patNum is irrelevant.
Well... I'm not using that parameter yet (in fact, I'm not using it for ModuleSelected yet...). I just figured that if one were to use it in ModuleSelected, one might also need it passed to ModuleUnselected under some odd circumstances for cleanup. I see now that it's not even passed to ModuleUnselected in the first place, though, and sending PatCur would just be weird and inconsistent - so... nevermind ;).

Best,
Al
Help! I've OD'ed on OD! :)

Post Reply