Page 1 of 1

Hooks request

Posted: Thu Jul 29, 2010 7:08 am
by wjstarck
In ClassesShared, after line 192, I want to insert the following:

Code: Select all

public static void GotoChart(long patNum){
OnModuleSelected(new ModuleEventArgs(DateTime.MinValue, new List<long>(), 0, 4, 0, patNum, 0));
}

public static void GotoManage(long patNum){
OnModuleSelected(new ModuleEventArgs(DateTime.MinValue, new List<long>(), 0, 6, 0, patNum, 0));
}
(You may decide to just add that snippet since it's similar to what's there and just provides methods for jumping to the Chart and Manage modules).

In ContrAppt, I want to add the following after line 1610:

Code: Select all

menuApt.MenuItems.Add(Lan.g(this, "   Family File"), new EventHandler(menuFamily_Click));
menuApt.MenuItems.Add(Lan.g(this, "   Chart"), new EventHandler(menuChart_Click));
menuApt.MenuItems.Add(Lan.g(this, "   Account"), new EventHandler(menuAccount_Click));
menuApt.MenuItems.Add(Lan.g(this, "   Treatment Plan"), new EventHandler(menuTreatmentPlan_Click));
menuApt.MenuItems.Add(Lan.g(this, "   Images"), new EventHandler(menuImages_Click));
menuApt.MenuItems.Add(Lan.g(this, "   Manage"), new EventHandler(menuManage_Click));
Finally, in ContrAppt, at the bottom, I want to add the following methods:

Code: Select all

private void menuFamily_Click(object sender, EventArgs e){
                        GotoModule.GotoFamily(PatCur.PatNum);
 }
private void menuAccount_Click(object sender, EventArgs e){
	GotoModule.GotoAccount(PatCur.PatNum);
}
private void menuTreatmentPlan_Click(object sender, EventArgs e){
	GotoModule.GotoTreatmentPlan(PatCur.PatNum);
}
private void menuImages_Click(object sender, EventArgs e){
	GotoModule.GotoImage(PatCur.PatNum, 0);
}		}

public void menuChart_Click(object sender, EventArgs e){
	GotoModule.GotoChart(PatCur.PatNum);
}
public void menuManage_Click(object sender, EventArgs e){
	GotoModule.GotoManage(PatCur.PatNum);
}
Thanks,

Re: Hooks request

Posted: Thu Jul 29, 2010 3:51 pm
by jordansparks
I'm not sure without trying, but I think we can put an AddCode hook in the spot where you want more menu items added. And then I think you would put your click events in your own external class.

Re: Hooks request

Posted: Thu Aug 05, 2010 4:43 am
by wjstarck
So I'll still need a hook for those methods at the bottom of ContrAppt, right?

Thanks

Re: Hooks request

Posted: Fri Aug 06, 2010 7:16 am
by jordansparks
Sorry, I don't understand the question. What methods? Are you talking about the click events? Those belong in your own class, like our example.

Re: Hooks request

Posted: Mon Aug 30, 2010 3:24 pm
by alkhaef
Dr. Sparks,

Sorry to jump in, but if I'm understanding correctly, I *almost* had the same request. I think he's referring to adding a HookAddcode (_end) to the end of ContrAppt.InitializeOnStartup (similar to the one in ContrAccount) as you mentioned, so he can add the menu items. Please feel free to correct me if I'm wrong, Dr. Starck.

I said *almost*, because I realized 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,

Re: Hooks request

Posted: Mon Aug 30, 2010 4:00 pm
by wjstarck
Al-

What I was wanting to do was add context menu items that allowed you to jump to any module when right clicking on an appointment.

I honestly can't remember where those should go, it's been a while so I'd have to go back and look at the code.