10566 : Databound on my own classes

Question

I have created a custom collections ( Inherited from collection collectionbase and implemented the Ilistsource interface) and I used the property gantt1.Grid.RootNodes_DataSource to bind the data to the grid.The grid is filled correctly but when I change a value of the collection by programmatically does not change the value visualized on the grid.

How should i create my custom collection to perform the operation ? WHEN I USE A DATASET LIKE DATASOURCE IT WORKS CORRECTLY.

Answer

IList is enough to populate a component that supports databind. But it is not enough to catch changes to the list; like add and remove, nor to catch content change of a given row.

To successfully handle those events you must fullfill the IBindingList interface. In this interface you raise events when changes are applied.

10217 : I was unable to display TimeItemTexts Text as tooltip text in OnTimeItem_Hoover Event.

Question

I was unable to display TimeItemText’s Text as tooltip text in OnTimeItem_Hoover Event.

Is there way to show this ??

Thank you.

————— My code following that —————– private void gantt1_OnTimeItem_Hoover(PlexityHide.GTP.Gantt aGantt, PlexityHide.GTP.TimeItemEventArgs e) {

string newTooltipText=””;

if (e.TimeItem!=null) {

newTooltipText= ???????? ;

}

}

Answer

You can reach the time item texts like this:

e.TimeItem.TimeItemText[thezerobasedindexofthetext].Text

 

10444 : Splitting a time item over a holiday

Question

When I drop part of a timeitem at a holiday, I would like the timeitem to split (half before the holiday and half after the holiday) and join the two timeitems with an arrow. Can I just destroy the timeitem object and redraw it? Or is there a better way to achieve this?

Answer

There is no auto-split as you describe it. If it was me doing this I would probably do a Userdrawn time item that was drawn as two boxes with the line between them (hence I would not need to split it, just check where the holidays start and stop).

If you want to split it you can simply delete it and create two new ones; or one new and change the first…

10447 : What version of the Microsoft Framework is targeted for this control… 1.1 or 2.0?

Question

What version of the Microsoft Framework is targeted for this control…  1.1 or 2.0?

Answer

Both versions are covered, even if the general download still is for 1.1 you can get the assembly compiled for CLR 2.0 here: https://plexityhide.com/pub/PlexityHide.GTP.CLR20.zip

We also offer support for windows forms and ASP.NET

10375 : Is GTP.NET already ported to .NET CLR 2.0?

Question

Hi!
Is GTP.NET already ported to .NET CLR 2.0?
If no, is there a plan to port GTP.NET to CLR2.0 and is there a concrete date/version?

Answer

We have already done this in our lab, we anticipate no real problems and we will have a release when VS2005 goes public.

Update: GTP.NET for CLR 2.0 is available in the general download. After installation you will find two folders CLR11 and CLR20 that contain the assembly for GTP.NET for clr 1.1 (Visual Studio 2003, Borland 2006) and clr 2.0 (Visual Studio 2005)

10402 : I have integers in a column, I must sort them as numbers not strings

Question

I have a column with integer values, when I click the column head to perform the sorting I get this result:

1
10
11
12
13
2
20
21
22

I need:

1
2
3
4
5
6
7
8
9
10

Answer

This happens on unbinded sort, if you have data from a datasource via databind the sorting comes from the datasource. But in your case you can implement your own comparer:

Add the event in form load:
gantt1.Grid.OnUnBindedSort+=new UnBindedSortHandler(Grid_OnUnBindedSort);
// Implement it like this
private
void Grid_OnUnBindedSort(Grid aGrid, UnBindedSortArgs e)
{
  e.aListToSort.Sort(0,e.aListToSort.Count,
new MyComparer(e.descending,e.aColumn));
}

The MyComparer could look like this (this is really a good thing, you can compare anyway you want):

    class MyComparer: IComparer
    {

      private GridColumn fColumn;
      private bool fdescending;
      public MyComparer(bool descending,GridColumn aColumn)
      {
        fdescending=descending;
        fColumn=aColumn;
      }

      #region IComparer Members

      public int Compare(object x, object y)
      {
        int xint=0;
        int yint=0;
       
        if (y is GridNode)
          yint=int.Parse((y as GridNode).GetCell(fColumn.Index).Content.Value.ToString());
        if (x is GridNode)
          xint=int.Parse((x as GridNode).GetCell(fColumn.Index).Content.Value.ToString());

      
        if (fdescending)
          return xint-yint;
        else
          return yint-xint;
      }

      #endregion
      
    }

10319 : Could you give me a short summary on what the advantages are of purchasing your ASP.NET add-on for GTP.NET?

Question

Could you give me a short summary on what the advantages are of purchasing your ASP.NET add-on for GTP.NET?

Answer

The Gantt_Web extension is a free add on for GTP.NET license holders. It is an easy way to get out the exact same information on a ASP.NET web page that you have in a windows form Gantt. The web gantt is not as able as the windows forms gantt when it comes to interaction, but you can zoom and panorate in time and implement your own actions on time item clicks etc.

10262 : I want to add a new time item by Mouse clicking and dragging. How-To ?

Question

Hi,
I want to add a new time item by Mouse clicking and dragging.
Is it possible and so How-To ? 

Thank you .

Answer

Yes you can do this by entering a special mouse mode: EnterTimeItemCreateMode

I recently did this in a data bounded Gantt and then you actually do not want the time item created but get all info about it so that you can create the underlaying object that in turn shows up in Gantt as a time item, seconds later.

I first implemented the OnTimeItem_OnBeforeMouseModeUse event to enter the EnterTimeItemCreateMode if the context was right:


		private void gantt1_OnTimeItem_OnBeforeMouseModeUse(PlexityHide.GTP.Gantt aGantt, PlexityHide.GTP.TimeItemEventArgs e)
		{
		  if (e.TimeItem==null)
		  {
			GanttRow gr=gantt1.GanttRowFromPoint(new Point(e.x,e.y));
			if (gr!=null)
			{
				if ((gr.GridNode.ListItemWhenDataBound() as RenderedTuple).Element.AsObject is Task)
					gantt1.EnterTimeItemCreateMode(true,null,0);
			}

		  }
		}

I then caught the created time item, got all the data that I needed from it and then threw it away, and exited the special mouse mode:

		private void gantt1_OnTimeItem_AfterCreateByMouse(PlexityHide.GTP.Gantt aGantt, PlexityHide.GTP.TimeItemEventArgs e)
		{
			if (e.TimeItem.Stop>e.TimeItem.Start.AddHours(8))
			{
				// If the time item created was of considerable length...
				TaskTime taskTime=new TaskTime(projPlannerMain.EcoSpace);
				object x=(e.TimeItem.GanttRow.GridNode.ListItemWhenDataBound() as RenderedTuple).Element.AsObject;
				taskTime.OwningTask=(x as Task);
				taskTime.Start=e.TimeItem.Start;
				taskTime.Stop=e.TimeItem.Stop;
			}
			e.TimeItem.Layer.Remove(e.TimeItem);
			gantt1.EnterTimeItemCreateMode(false,null,0);
		}

10278 : is it possible to change the backcolor of the Holyday (saturday and sunday) that automatically have a different color?

Question

is it possible to change the backcolor of the Holyday (saturday and sunday) that automatically have a different color?

Answer

In GTP.NET you can solve this in a number of ways:

#1 Use the

VerticalDayStripes  Vertical stripes on certain days 
VerticalDayStripes_Days  VerticalDayStripes set to true, this property then chooses the days, sat and sun default 

#2 draw time dependent stuff in the background; as shown in this article: http://plexityhide.dyndns.org/InstantKB13/Article.aspx?id=10066

#3 Override the text output in the datescaler like this:


    private void dateScaler1_OnDateScalerDrawString(PlexityHide.GTP.DateScaler dateScaler, PlexityHide.GTP.DateScalerDrawStringEventArgs e)
    {
      if (checkBoxRedSun.Checked)
      {
        // If you want to customize the way the date scaler draws its strings, you can...
        if (e.DateTime.DayOfWeek==DayOfWeek.Sunday )
        {
          if ((!e.LongIntervall && e.Resolution==NonLinearTime.TimeResolution.days) ||
              (e.LongIntervall && (e.Resolution==NonLinearTime.TimeResolution.hours6 || e.Resolution==NonLinearTime.TimeResolution.hours3 || e.Resolution==NonLinearTime.TimeResolution.hours)))
          {
            e.Brush=new SolidBrush(Color.Red);
            e.Font=new Font("Arial", 10,FontStyle.Bold);
            // In this case we only change the font and let the standard drawing continue, but you can just as easily completly override the default string. Just return e.ContinueDraw=FALSE;
            e.ContinueDraw=true;
          }
        
        }
      }
      
      if (checkBoxMyOwnWeekPres.Checked)
      {
        // If you want to customize the way the date scaler draws its strings, you can...
          if ((e.LongIntervall && e.Resolution==NonLinearTime.TimeResolution.days) && (!dateScaler1.UseDayNumbersNotWeeks))
          {
            // In this case we override the long intervall presentation when the resolution of the lower is Days ;
            e.OutputText=e.DateTime.ToString("MMdd")+" - "+e.DateTime.AddDays(6).ToString("MMdd");
            e.ContinueDraw=true;
          }
        
      }

    }

10232 : Row heights on Collisiondetected

Question

I have Collision turned on (True) so now in 1 node I have some timeitems, and in some nodes they are at the same time, so I timeitem is put below an other.

Can I change the node/rows height when filling the Gantt or even better can I let the user change the height of the row/node so he can see better the colliding timeitems in one row/node?

Answer

There are new properties in the latest service release:

GanttRow.IncreaseRowHeightOnCollision
GanttRow.IncreaseRow_SuggestedHeightPerItem

If you set these the rows will adapt on collisions. Pretty cool?