Hello,
I need to support multiple types of tasks and ideally, when an operator enters them as a Gantt Chart item, a Task Information form that is specifically extended for that task type is opened.
For example, I need to represent 3 types of tasks that further extend the data in the Infragistics.Win.Tasks fields in unique ways:
Exposition ( additional fields expositionAuthority, fundedBudget )
Phase ( additional field phaseSponsor )
Task ( additional fields authorizationObtained, estimatedCost )
Expositions have many phases, phases have many tasks, so I'd need to manipulate the parentIDs to show ownership.
Is it feasible to do this? My vague idea is that I would need to handle the GanttView's taskAdded property change event, and use that to have my custom forms come up. From there, I'd populate populate all the data in the tables that I have bound to the gantt view. Would this approach work?
If so, that leads me to this question -- am I able to change the line items on the GanttView's right click menu? For example, can I change the line items from "Add Task" to "Add Exposition", "Add Phase", and "Add Task"?
Thanks, Myca
Myca,
You can change the GanttView's right click menu by using the ultraGanttView1_ContextMenuInitializing event, using code similar to the following snippet:
if(e.Area == Infragistics.Win.UltraWinGanttView.ContextMenuArea.Grid)
e.ContextMenu = customMenu;
Please let me know if you need more information.
Thank you Mike. That seems reasonable. So if I want to add additional controls to the TaskDialog, how do I do that? So far, I've got:
TaskDialog tsDialog = new TaskDialog(ultraGanttView1.ActiveTask, ultraGanttView1.CalendarInfo.Tasks, ultraGanttView1); Label taskType = new Label(); taskType.Parent = tsDialog; taskType.Text = "Expedition"; taskType.SetBounds(20, 150, 100, 25); taskType.BringToFront(); UltraTextEditor name = new UltraTextEditor(); name.Parent = tsDialog;
but those controls are not showing up on the form.
Thanks,
Myca
Hi Myca,
You will need to add the label to the dialog's control collection, like this:
tsDialog.Controls.Add(taskType);
However, you may want to add a control to a specific tab rather than directly to the dialog. You can do that with the following code:
(tsDialog.Controls[0] as UltraTabControl).Tabs["General"].TabPage.Controls.Add(taskType);
Please try this out and let me know whether it works for you.
Hi Mike,
One more question on this -- I created a System.Windows.Forms.UserControl called DialogTaskEntry and put all my controls in a ultraGroupBox on it. Then I called:
DialogTaskEntry dialogTaskEntry = new DialogTaskEntry(); targetTab.Tabs["General"].TabPage.Controls.Add(dialogTaskEntry);
from the view model code. It seems to add my custom form on the same row as the "OK" and "Cancel" buttons, but I can't see all of it. What can I do to resize the Infragistics TaskDialog to include the whole size of my custom form?
Thanks in advance,
I was able to resize the task dialog with the following line of code:
tsDialog.FindForm().MinimumSize = new System.Drawing.Size(800, 600);
Please try it out and see whether it works for you.