Solutions Schedule for Silverlight - Gantt style drag and drop multi resource scheduling        
         
How To ...
 
 
  Solutions Schedule .NET v6.0    
         
Using Custom Controls for Direct Editing Resource List Items
   

Solutions Schedule .NET v6.0 (dbiSchedule.dll) uses standard text and combo boxes as its edit control. There are many cases where a third party control is an ideal option for creating intuitive direct edit capability. In this how to example a date picker control with a drop down calendar.

To use a third party control in the resource list area of Solutions Schedule .NET v6.0, select a control that exposes the keys strokes being pressed to the host. The host control does not monitor for key strokes so we look to a third party control for this purpose.

With the third party control established interrupt the control’s current edit mode process and monitor the third party control for the navigation keys being used, determine the new cell to go to after a navigation key is pressed, and then place the list back into edit mode.

 

Following are the steps are required to use a third party control:

 

·         Create a column object for the control and add it to the list.  NOTE: The EditType property of that column is set to “UserControl”.

·         If the third party control has a “Parent” property, set it to the host schedule making it easier for positioning later on.

·         Use the BeforeCellEdit event to test for focus on the appropriate column. Now, move the data from the cell to the user control.

In the following code example we are working with a standard date time picker control:

C#

void dbiSchedule1_BeforeCellEdit(object sender, Dbi.WinControl.BeforeCellEditEventArgs e)

{

    string strText;

    if (e.ColumnIndex == m_nUserControlColumn)

    {

        strText = e.NodeItem.GetCellText(e.ColumnIndex);

        dateTimePicker1.Value = Convert.ToDateTime(strText);

    }

}

VB.NET

Private Sub DbiSchedule1_BeforeCellEdit(sender As System.Object, e As Dbi.WinControl.BeforeCellEditEventArgs) Handles DbiSchedule1.BeforeCellEdit

        Dim strText As String

        If e.ColumnIndex = m_nUserControlColumn Then

            strText = e.NodeItem.GetCellText(e.ColumnIndex)

            dateTimePicker1.Value = Convert.ToDateTime(strText)

        End If

End Sub

 

·         Use the DisplayUserControl event to display the user control. Once again test to make sure the focus is in the correct column or else the user control will be showing up where it is not desired.


C#

void dbiSchedule1_DisplayUserControl(object sender, Dbi.WinControl.DisplayUserControlEventArgs e)

{

    if (e.ColumnIndex == m_nUserControlColumn)

    {

        dateTimePicker1.SuspendLayout();

        dateTimePicker1.Visible = false;

        dateTimePicker1.Location = new Point(e.X, e.Y);

        dateTimePicker1.Width = e.Width;

        dateTimePicker1.Visible = true;

        dateTimePicker1.ResumeLayout();

        dateTimePicker1.Focus();

    }

}

VB.NET

Private Sub DbiSchedule1_DisplayUserControl(sender As System.Object, e As Dbi.WinControl.DisplayUserControlEventArgs) Handles DbiSchedule1.DisplayUserControl

        If e.ColumnIndex = m_nUserControlColumn Then

            dateTimePicker1.SuspendLayout()

            dateTimePicker1.Visible = False

            dateTimePicker1.Location = New Point(e.X, e.Y)

            dateTimePicker1.Width = e.Width

            dateTimePicker1.Visible = True

            dateTimePicker1.ResumeLayout()

            dateTimePicker1.Focus()

        End If

End Sub

 

·         Use the RemoveUserControls event to write back the data from the user control and then hide the user control. NOTE: make sure to test that the focus is in the proper column or the data from the user control may be written back to all cells being edited.

C#

void dbiSchedule1_RemoveUserControls(object sender, Dbi.WinControl.RemoveUserControlsEventArgs e)

{

    if (e.ColumnIndex == m_nUserControlColumn)

        WriteDateTimeBack(e.ColumnIndex);

    dateTimePicker1.Visible = false;

}

VB.NET

Private Sub DbiSchedule1_RemoveUserControls(sender As System.Object, e As Dbi.WinControl.RemoveUserControlsEventArgs) Handles DbiSchedule1.RemoveUserControls

If e.ColumnIndex = m_nUserControlColumn Then

            WriteDateTimeBack(e.ColumnIndex)

        End If

        dateTimePicker1.Visible = False

End Sub

Now set your code for monitoring the keystrokes of the user control for navigation to other cells. By default, the host control will monitor for the <Enter>, <Esc>, <Tab> and <Shift Tab> keys. If you are using other keys for navigation, be sure to have those keys monitored and acted upon by the user control as well.

   
       
    Have a Great Scheduling Day !  
       
       
   
       
DBI Support Products Downloads  Purchase
Customers Support Request Form Warehouse Scheduling Framework Trial Downloads Order Page
News Releases FAQ Studio Controls for .NET
Contact Us License Registration Studio Controls for COM
Updates Solutions Schedule for .NET
Utilities Solutions Schedule for COM
Support Policies Staff Scheduler
Product Life Support Extractor - Essential Content Summary
Platform Products
Contact Us
 
   
  all rights reserved  |  copyright  1996 - 2016  |  Terms of Use