10969 : The OnTimeItemAreaMouseWheel is not being called at all when I scroll the wheel over the TimeItemArea?

Question

I am handling the OnTimeItemAreaMouseWheel event. However,  the handler is not being called at all when I scroll the wheel over the TimeItemArea. Do I have to do anything special to activate this event?

 

Answer

 

Some mouse events (the wheel events included) will not fire unless the control has keyboard focus.

 

We will look into a permanent solution but in the mean time add a Focus call in mouse down:

gantt1.OnTimeItemAreaMouseDown += new MouseEventHandler(gantt1_OnTimeItemAreaMouseDown);

void gantt1_OnTimeItemAreaMouseDown(object sender, MouseEventArgs e)
{
  gantt1.TimeItemArea.Focus();
}

 

10941 : How can I determine which rows are selected in the grid?

Question

How can I determine which rows are selected in the grid? It’s easy to determine which row is selected with:
owningTaskId := StrToInt((gantt1.Grid.FocusedCell.GridNode.ListItemWhenDataBound() as DataRowView).Item[‘id’].ToString)
but how do I determine which multiple rows are selected?

Answer

Often in gui controls like the GTP.NET there is a distinct difference between “select” and “focus”. The “thing” with focus can almost always be only one, and focus often mean keyboard-focus (where will the key-strokes go).

Selections can often consist of many “items”, often refered to as multi-select.

So in the grid there is only one Focused cell: gantt1.Grid.FocusedCell. And there are possibly many selected cells: ArrayList al=gantt1.Grid.GridStructure.SelectedCells();
You will need to iterate thru the list of selected cells and get to their GridNode just as you did with the focused cell.

Each Cell has a Selected property that is true or false. You can programatically set this if needed.