- Default events
- Events with procedures for quick use
- Advanced use of events with procedure
- Optional events
- Sort code of a column
Events associated with a Gantt Chart column
WINDEV manages the following events by default for a "Gantt Chart" column (in order of appearance in the code editor):
|Initialization||Executed when the window is opened. *|
|Before creating the task||Run when selecting "New task" from the popup menu of the "Gantt Chart" column.|
|Entry in input in a task||Run when selecting "New task" in the context menu of the "Gantt Chart" column. This event is run immediately after the event "Before creating the task".|
|Exit from task input||Run during the exit from task input (exit when adding a task or when modifying a task via the popup menu for example).|
|Select a task||Run when selecting a task found in the "Gantt Chart" column. This event is executed when the popup menu opens.|
|Moving a task||Run when moving a task in the "Gantt Chart" column (move performed with the mouse for example).|
|Resizing a task||Run when resizing a task in the "Gantt Chart" column (resize operation performed with the mouse for example).|
|Deleting a task||Run when selecting "Delete the task" from the popup menu of the "Gantt Chart" column.|
|After linking a prerequisite task to a task||Run once the link was created via the popup menu (select "Link a prerequisite task" and click the prerequisite task).|
|Modifying the progress of a task||Run when the user changes the cursor of the progression bar in the task.|
(*) By default, the "Initializing" event of each control is executed according to the order in which the controls were created in the window. To modify this order of execution:
- On the "Window" tab, in the "Order" group, click "Initialization".
- In the window that appears, use the arrows on the right to change the order in which the controls are initialized.
Events with procedures for quick use
Most of the events associated with the Gantt Chart column are run:
- when using the context menu of the "Gantt Chart" column.
- when using the mouse.
To handle tasks more easily, several procedures appear in each event. These procedures take in parameter:
All the characteristics of the element handled by the popup menu or by the mouse are automatically assigned to this variable.
Example: To store a task added by the user via the popup menu in a "Task" data file, simply enter the following code in the event "Exit from task input":
PROCEDURE EnterInInput(gtEdited is GanttTask)
// Store the data
Task.Title = gtEdited.Title
Task.StartDate = gtEdited.StartDate
Task.EndDate = gtEdited.EndDate
Advanced use of events with procedure
You can also allow the user to define more precisely the characteristics of his task during an addition or a modification.
To do so, create a window with the information to specify.
In the code, simply open the window in the event "Enter the task in input". To lock the direct input via the context menu of the column, the event must return False.
This principle can be applied to all the events called by the context menu of the column.
PROCÉDURE EnterInInput(gtEdited is GanttTask)
// Opens the window for task input
// with the selected task (in Creation or Modification mode)
// Returns False to lock the direct input in the column
Several optional events are supported.
To add an optional event:
- Select the desired control.
- Display the code window of this control (F2 key).
- Click the link "Add other events to xxx" at the bottom of the window code, after the last event.
- All the optional events available for the control are displayed.
- Check the optional event to add and validate.
Remark: You can select several optional events.
- The selected optional event is automatically added to the events managed by the control.
To disable an optional event, simply perform the same operations to display the list of optional events. Then simply uncheck the optional events to delete.
Remark: If the disabled code contains WLanguage code, this code is automatically deleted.
You can manage:
- how columns are sorted (event "Whenever sorting"). This event is run when the user sorts the column with and .
- how the magnifier is used to perform a search (event "Whenever performing a search with the magnifier"). This event is run during the search (for each character typed) from the "magnifier" search control.
- The column resized by the user.
Sort code of a column
When the user clicks the title of a table column, the sort code of column is automatically called.
To find out the sort direction, declare a parameter at the beginning of the sort code.
// -- Whenever COL_Gantt is sorted
Trace(bAscending? "Ascending column sort" ELSE "Descending sort")