ControlClick event for the Gantt Chart
Details
Date:4/21/2009 4:34:25 AM
Product:ActiveGanttVB Scheduler Component
Framework:Visual Studio 6.0
Version:2.7.3
User's Development Environment:XBase++
Subject:ControlClick
Question

METHOD dlgGant:ControlClick(Sender, kEventTarget, nIndex, nPIndex, nX, nY,
nButton) 
debugout(kEventTarget, nIndex, nPIndex, nX, nY, nButton)

If I click inside the gantt the ControlClick event gets the following parameters passed:


3th col 3th row : 3, 3, 135.00, 87.00, 1, NIL, 3th col 4th row : 3, 4, 69.00, 105.00, 1, NIL, 3th col 10th row: 3, 10, 102.00, 228.00, 1, NIL, 2nd col 13th row: 2, 13, 39.00, 294.00, 1, NIL, 1st col 13th row: 1, 13, 12.00, 294.00, 1, NIL, taskbar 2nd row : 3, 0, 494.00, 65.00, 1, NIL, 
no taskbar      : no event

You can see:

1. nPIndex is not passed instead the X-position of mouse is passed 2. kEventTarget is the really target acc. E_EVENTTARGET instead it is the column 3. nIndex is the row 4. a click at a task fires the EVT_MILESTONE event and the nIndex is 0.

Answer

Answer:

Certain events handle those events for several different objects. We did this because it would be far more complicated to do for example:

TaskClick

MilestoneClick

So it is very important to do a select case in these events that have ActiveGanttVB.E_EVENTTARGET


Private Sub ActiveGanttVBCtl1_ControlClick(ByVal EventTarget As ActiveGanttVB.E_EVENTTARGET, ByVal ObjectIndex As Long, ByVal ParentObjectIndex As Long, ByVal X As Single, ByVal Y As Single, ByVal Button As Integer)
    Select Case EventTarget
        Case E_EVENTTARGET.EVT_MILESTONE
            ActiveGanttVBCtl1.Milestones.Item(ObjectIndex).Caption = ""
        Case E_EVENTTARGET.EVT_TASK
            ActiveGanttVBCtl1.Tasks.Item(ObjectIndex).Caption = ""
    End Select
End Sub

As you can see the E_EVENTTARGET determines the type of object that raises the event.

 

All trademarks are property of their respective holders, and are only used to directly describe the products and services being provided. Their use in no way indicates any relationship or endorsement between The Source Code Store LLC and the holders of said trademarks.