11061 : Multiselect in the TimeItemArea

Question

I know you can multiselect time items by holding the ctrl key while clicking them, and that you can get to all selected time items by the method gantt1.GetSelectedTimeItems().

But what if I do not allow multi select? How can I stop it?

Answer

To effectively stop multiselect for the TimeItems go like this:< ?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

 

    gantt1.OnTimeItem_SelectionChanged += new TimeItemEvent(gantt1_OnTimeItem_SelectionChanged);

 

    void gantt1_OnTimeItem_SelectionChanged(Gantt aGantt, TimeItemEventArgs e)

    {

      if (e.TimeItem.Selected)

      {

        foreach(TimeItem ti in gantt1.GetSelectedTimeItems())

        {

          if (ti!=e.TimeItem)

            ti.Selected=false;

        }

      }

    }

 

10538 : Multi select of grid cells

Question

I have a question regarding selection of cells in a grid.

Usually in the other applications (e.g. MS Excel) when you select a cell thruogh mouse click and then keep the mouse button pressed and drag it to some other cell then all the cells between them get selected but unfortunately its not the case with GTP.Net.

Is there any property or method available in your library to achieve this sort of effect?

Answer

The Grid allows for multi select just as explorer does; if you hold the shift-key you get an anchor point, keep shift held and select another cell, all cells between are selected.

If you hold the control key you create disjunct selections, clicking a selected cell will remove it from the selection group, clicking an unselected will add it to the selection group (while the ctrl key is held).

You can combine the two ways to build complex selections.