10155 : Can we disable the multi-selection?

Question

Can we disable the multi-selection?

Answer

Currently there is no property to turn of multiselection in the grid, we have added one in 2.0. But the workaround is to implement OnGridCellSelectChanged and call Gantt.Grid.GridStructure.ClearSelections in this implementation.

To avoid multiselect for time items you can implement the Gantt.OnTimeItem_SelectionChanged event, and simply call Gantt.ClearSelected from inside this call…

10152 : user sees 2 timeitems on the screen and wants to link them using mouse and clicking on one timeitem and dragging link to the other timeitem. how shuld I do this?

Question

user sees 2 timeitems on the screen and wants to link them using mouse and clicking on one timeitem and dragging link to the other timeitem. how shuld I do this?

BTW thx for great control. Having source is very helpful.

Answer

You can but a tool button on your menu allowing the user to enter the special mouse mode for creating time item links;

gantt1.EnterLinkCreateMode(checkBox1.Checked);

When this mode is active clicks will be handled as link create and not as move or resize operation in timeitem area.

Thomas Reinberger contributed with this code and comment, Thank you Thomas:

The trick is to allow TimeItem moves and to check the x value of the mouse click. Then, if the mouse click is nearby the right or left border of a TimeItem (but not exactly at the border since we also want to let the user resize the timeItem. See code below.

private void gantt1_OnTimeItem_BeforeMove(PlexityHide.GTP.Gantt aGantt, PlexityHide.GTP.TimeItemEventArgs e)
  {
   TimeItem ti = e.TimeItem;

   if (ti != null)
   {
    if (e.x >= ti.DrawRect().Right-15 && e.x <= ti.DrawRect().Right-4)
    {
 ti.TimeItemLayout.AllowMove = false;
    this.gantt1.EnterLinkCreateMode(true);
    }
    else if (e.x >= ti.DrawRect().Left+4 && e.x <= ti.DrawRect().Left+15)
    {
     ti.TimeItemLayout.AllowMove = false;
     this.gantt1.EnterLinkCreateMode(true);
    }
    else
    {
     ti.TimeItemLayout.AllowMove = true;
     this.gantt1.EnterLinkCreateMode(false);

    }
   }
  }

 

10143 : Ive setup my gantt chart to use a DataSet for its data source.What I would like to do is add text to each time item on the gantt. How?

Question

The OnNodeInserted function is called for each grid row. What I would like to do is add text to each time item on the gantt. How would I go about doing that? I have a GanttRow, but I’m not sure how to get the TimeItems from that GanttRow so I can add the TimeItemText.

Answer

For time items you willl find a TimeItemDataConnect for each layer.

It is the TimeItemDataConnect object that resolves the events in the datasource to actual time item property values. You can implement the TimeItemDataConnect.OnBeforeDSToTimeItem (the event is not available in the property grid but just type yourLayer.TimeItemDataConnect.OnBeforeDSToTimeItem+= and hit tab in VS)

In this event you can inspect that data from the datarow and you can do additional things on your time item, like setting a TimeItemLayout etc.

This event is also good for conversions, if you datarow has start and length instead of start and stop.

But this is also a perfect place to add a TimeItemText to the time item. Just check the collection of timeItemTexts on the time item so that you have not already added it…

10144 : Im not able to delete the selectedtimeitem. how do i do that?

Question

Im trying to add and delete the TimeItem using the context menu Add and Delete menus respectively. I can add the timeitem by getting the start and end time, but im not able to delete the selectedtimeitem. how do i do that?

Answer

You can delete a time item like this:

aTimeItem.Layer.Remove(aTimeItem);

Note: If the the time item has been added as a result of a databind to the layer you should remove the row in the datasource and not “attack” the time item itself…

 

10139 : I loose date information when zooming.

Question

When I zoom in by sliding the scaler, I loose some very useful information on dates and Times. Let me explain…. Lets say I start showing the chart with a period of 2 months, when I zoom in down to the hour level, i loose the date information at some point. First line shows 2000 March-April, second line shows time of the day and third line shows minutes in the hours. But where is my current date? I expected this information climbing on the first line like ‘2000 March 06′, second line ’21:00:00′ and third line ’00 10 20 30 40 50 00’. Any way to keep the complete date/time cascade ?

Answer

These are good points. Currently the overview info is put in the extra text called “date scale info” in the top left corner. And also remember that all texts that are generated in the date scale can be overriden, extended or replaced with numerous events… We will put this on our attention list for constructive feedback. Thank you.

 

10141 : I want to select timeitemlink on gantt by mouse. How can I select timeitemlink by mouse?

Question

I want to select timeitemlink on gantt by mouse. But I didn’t find any associated events and methods.
How can I select timeitemlink by mouse?

Answer

This functionality is available in GTP.NET 2.0+.

Gantt.TimeItemLinks.SelectedLink returns the currenly selected link if any (otherwise it returns null)

The TimeItemLayout class has been extended with the following properties that controls link behaviour:

 AllowLinkReAssignStart  Controls if link re-assign can be done for the start of a link 
 AllowLinkReAssignTarget  Controls if link re-assign can be done for the target of a link 
 AllowLinkSelectionStart  Controls if link selection can be done for the start of a link 
 AllowLinkSelectionTarget  Controls if link selection can be done for the targer of a link 

10136 : What is the SubCol field of TimeItem and how is it used?

Question

What is the SubCol field of TimeItem and how is it used?

Answer

The SubCol property of phDataEntity_GantTime and  phDataEntity_SchemaTime in the phGantTimePackage and on the GTP.TimeItem in GTP.NET controls sub-columns or, in the Gantt case, sub-rows of a single GanttRow.

The SubCol property is the one set by the CollisionDetection logic (when CollisionDetect=true) to visualize the time items side by side rather than on top of each other.

You may also use the SubCol property yourself if you turn off the CollisionDetecion. Setting the SubCol property to Zero is equal to “no subcolumn” and 1 is the first of the SubColumns. You can control the number of sub columns by setting GTP.GanttRow.SubColumns=x or in the phGantTimePackage you would use IphGantRow3.SetUseSubCols(x)

10134 : Delphi2005

Delphi2005 Runs both .NET and win32.

To get the phGantTimePackage VCL for win32 Delphi2005, download this: https://plexityhide.com/pub/d2005dcu.zip

To run the .NET components in GTP.NET download the normal GTP.NET installation https://plexityhide.com/pub/GTP.NET.msi

To tap into some truly powerfull stuff, download our ECOII Samples for Delphi2005 and GTP.NET; https://plexityhide.com/pub/SamplesECO.zip

10135 : Binding time items from an ArrayList

This is how you can bind a layer in a GanttRow to show the your data from an ArrayList as Time Items in the Gantt:

// If you have data with two DateTime properties….

      class TimedThing:object
      {
        public TimedThing(DateTime start,DateTime stop)
        {
          Start=start;
          Stop=stop;
        }
        private DateTime fstart;
        private DateTime fstop;
        public DateTime Start
        {
          get{return fstart;}
          set{fstart=value;}
        }
        public DateTime Stop
        {
          get{return fstop;}
          set{fstop=value;}
        }
      }

    private void button1_Click(object sender, System.EventArgs e)
    {

// …And you put such objects in an arraylist…
      ArrayList myTimeItems=new ArrayList();
      myTimeItems.Add(new TimedThing(DateTime.Today,DateTime.Today.AddDays(1)));
      myTimeItems.Add(new TimedThing(DateTime.Today.AddDays(2),DateTime.Today.AddDays(3)));
      myTimeItems.Add(new TimedThing(DateTime.Today.AddDays(4),DateTime.Today.AddDays(5)));
      myTimeItems.Add(new TimedThing(DateTime.Today.AddDays(6),DateTime.Today.AddDays(7)));
      myTimeItems.Add(new TimedThing(DateTime.Today.AddDays(8),DateTime.Today.AddDays(9)));

      GanttRow gr1=GanttRow.FromGridNode(gantt1.Grid.GridStructure.RootNodes[0]);
      Layer l=gr1.Layers.AddLayer();

// Then you can set up the Layer to display your properties as start and stop for time items
      l.NameInDS_Start=”Start”;
      l.NameInDS_Stop=”Stop”;
      l.DataSourceList=myTimeItems;

// cool…     

    }