10897 : Is there any way to print only the selected rows of GTP.Gantt?

Question

is there any way to print only the selected rows of GTP.Gantt?

 

Answer

 

You can temporarily filter out the rows you do not want to print by setting the Visible property of those GridNodes to false:< ?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

GridNode.Visible  Set to false to temporarily filter out this node from the rendering process (hide it for some reason) 

 

10928 : ERROR: Unable to parse project file LetsBuild_Web.csproj

Question

I am trying to load the web source project (letsbuild_web) into Visual Studio 2005 and it wants to convert but I get a conversion error (ERROR: Unable to parse project file LetsBuild_Web.csproj).

Do you know what the problem could be? Do you have a VS 2005 version?

Answer

The version is for VS2005 sp1. One thing that may explain this is that the project uses the “Web Application project model” introduced in Get Visual Studio 2005 SP1 described like this:

Web Application Projects
Web Application Projects provide Visual Studio 2005 with a Web project model similar to the Visual Studio .NET 2003 model.
Note: Visual Studio 2005 Service Pack 1 incorporates Web Application Projects.

Read more about it here

 

10892 : I have difficulties with adding links to my Gantt (Databound).

Question

I have difficulties with adding links to my Gantt (Databound). I do the following (see code below)to add the link to my dataset and get a nullReferenceException on the last line when adding the new row to the dataset.< ?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

 

What happens is that in your TimeItemLink.cs, UpdateValue() in the line int y = TimeItemLinks.IndexOf(aLink) the “list” variable used in IndexOf() is null.

 

Can you give me any clue on that please?

 

 

 

startItemRow = ((DataRowView)(linkStartItemUserData).First).Row;    // attività owner del link da creare;

        stopItemRow = ((DataRowView)((Pair)endItem.UserReference).First).Row;

        startId = Convert.ToInt32(startItemRow[“ID”]);

        stopId = Convert.ToInt32(stopItemRow[“ID”]);

 

       

        row = chartData.Tables[“link”].NewRow();

        row[“id”] = ++dataRowCount;

        row[“owner”] = startId;

        row[“target”] = stopId;

        row[“link_type”] = “StartToFin”;    //nuovo link sempre

        row[“color”] = “blue”;

        chartData.Tables[“link”].Rows.Add(row);

Answer

It is important that the TimeItem set the Identity field when using databound links.

 

TimeItem.Identity:  Identity is used to tie databound timeitemlinks. Set Identity to the primary key for your time items. If the time items are databound; assign the TimeItemDataConnect.NameInDS_Identity to the primary key column of your time item row 

 

10786 : Event when grid row is resized

Question

I use the following code to draw horizontal lines on the TimeItemArea.


private void gantt1_OnTimeItemAreaPaintBackground(OffscreenDraw aOffscreenDraw, OffscreenDrawArgs e)
{
  for (int i = 0; i < gantt1.Grid.GridStructure.RootNodes.Count; i++)
  {
    Rectangle rect = gantt1.Grid.GridStructure.RootNodes[i].Rect();
    Debug.Print(rect.Top.ToString() + " " + rect.Left.ToString());
    e.G.DrawLine(new Pen(new SolidBrush(Color.DeepSkyBlue)), aOffscreenDraw.CalcLeft, rect.Top, aOffscreenDraw.CalcRight, rect.Top);
  } 
}

What event is fired when a user resizes the height of a grid row to update the lines?

Answer

Grid.OnRowResize, this event was introduced recently and is not currently in the help file.

11092 : Resize columns by automagic

Question

I would like to have the columns in my grid autosize to encompass the longest value.  How can I do this?  For example if column 1 of row 1 has a value of ‘IT’ and column 1 of row 2 has a value of ‘Accounting’ then the size of column 1 should be wide enough to see all of the word ‘Accounting’ without the user having to increase the size manually every time.

< ?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" /> 

Thank you.

Answer

You will need to do this yourself by detecting values in the cells and meassure them, then change the width of the column.

I would implement OnGridPaintBackground, not that I will draw anything, but this will be called when the data is in place and the screen must update. I would loop thru the nodes on screen (Grid.GridStructure.VisibleNodes) and loop thru each cell finding out the widest entry in each column (by meassuring the content using the Graphics object in the OnGridPaintBackground event arguments). Once I have this information I need to compare it with the current GridColumn widths.  And if my “rules” says that the widths should change, change them. BUT it is important that you only change the widths if it is necessary, since the change will trigger a need for a new drawing pass (calling OnGridPaintBackground again). You can easily get into recursion if you change the display in an event that draws the display… But once you are aware of the risk it should be controllable.

 

 

To catch changing values implement OnAfterEditCell, to set the initialsetup I would

 

11237 : Snap time item placements while moving

Question

I know I can use DateScaler.Snap to control time item placement, but now I want to have the time item jump in discrete steps while the user moves it.

Is that possible?

Answer

Sure, everything is possible:

    /// <summary>
    /// This is how you can quantify the movement, while moving, to, for example, 1 hour
    /// </summary>
    private void gantt1_OnTimeItem_Hoover_ForQuantifyTest(PlexityHide.GTP.Gantt aGantt, PlexityHide.GTP.TimeItemEventArgs e)
    {
      if (gantt1.MouseMoveKind==MouseMoveKind.move)
      {
        int orgpos=gantt1.DateScaler.TimeToPixel(e.TimeItem.Start+e.Diff);
        DateTime quantizedTime=gantt1.DateScaler.SnapTime(e.TimeItem.Start+e.Diff,new TimeSpan(1,0,0));
        int newpos=gantt1.DateScaler.TimeToPixel(quantizedTime);
        int diff=newpos-orgpos;
        e.x =e.x+diff;
      }
    }

10781 : It is possible (using a key for example the CTRL) to lock the mouse movement along a row (Y position fixed) ?

Question

Hi, I have an application developed in VB.NET (VisualStudio2005) that use the GTP.NET. It is possible (using a key for example the CTRL) to lock the mouse movement along a row (Y position fixed) ? When I have several rows in the Gantt I want to make sure that I move only on the same row that I select (during the movement I display the details in a different form area) I hope to be clear. Thanks for the support

Answer

To stop a user from moving a time item between rows you can set the TimeItemLayout.AllowChangeRow to false. You can check in the OnMouseDown event if the special key that you decide is held and set TimeItemLayout.AllowChangeRow for all selected time items to the desired value.

11053 : Is there a way the Gant_ASPs gantt chart area will resize by browsers window size?

Question

I set the size of gantt_asp to 100% but the grid is resizing instead of the gantt chart area. Is there a way the Gant_ASP’s gantt chart area will resize by browser’s window size? < ?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

Answer

Currently we do not a built in capability to adjust from client side size changes. If you need it you will need to trigger a postback from the resize and supply the new sizes and adjust the size of the Gantt_ASP server side.

10992 : How to print with GTP.NET in ASP.NET ?

Question

How to print with GTP.NET in ASP.NET ?

Answer

To print from the web there are a couple of possibilities:

#1 Just print the page – not very hard nor nice

#2 Print to pdf on the server side and have the user download it… Nice, full control, but more complex and involves external components to handle the pdf part… Use the samples for windows forms that show print to a PrintDocument.

10832 : Does GTP.NET support Daylight saving time transitions?

Question

Does GTP.NET support Daylight saving time transitions?

When moving from winter to summer, does the timeline show a gap of one hour, i.e. does it jump from 01:59:59am to 03:00:00am in the transition date?

Similarly, does it jump back from 01:59:59am to 01:00:00am when the transition is from summer to winter?

Answer

The time scale will show all 24 hours of the daylight-saving-shift-nights.