10874 : I want to change the default resolution of the datescaler.

Question

I want to change the default resolution of the datescaler. By default it shows the datescaler resolution in days and i want to show it in quarters by default… how is this possible….????

Answer

DateScaler Class : TimeSpanSet Method will allow you to set the start and stop date of the view. Set values that are far enough apart to tell the datescaler that the quarters. Like:

Gantt.DateScaler.TimeSpanSet(DateTime.Now,DateTime.Now.AddDays(365));

11060 : The Datescaler is showing Month–>Date resloution.in two steps. But I want to make it into 3 Steps, i.e. Month–>Week—>Date resloution.

Question

The Datescaler is showing Month–>Date resloution.in two steps.
But I want to make it into 3 Steps, i.e. Month–>Week—>Date resloution

Answer

Currently the DateScaler does not have built in support for a three band presentation.

The somewhat complex workaround is to implement OnDateScalerPaintForeground and erase the default content and draw all three bands yourself. If you choose to go down this path you will want to use the TimeToPixel method and simply iterate from start to stop in your choosen resolution, call TimeToPixel for each step and draw a mark and a text.

We have offered the three band datescaler as a user-paid-for-extension to some clients but we have no deal yet. The n-band datescaler is on our todo list but not prioritised yet (and this means that we have no idea when we will implement it).

 

10791 : Databound links with different types

Question

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

{

  gantt1.TimeItemLinks.NameInDS_StartKey=”start”;

  gantt1.TimeItemLinks.NameInDS_TargetKey=”target”;

  gantt1.TimeItemLinks.DataSource=currentProject.WorkLinks;

}

loads the relationships… however type relationship is used one and one, which is installed in property Gantt1.TimeItemLinks.CreationTimeItemLinkStyle…

How fasten the type of the relationships to field database?

Thank you.

Answer

When the links are loaded they will be handled by the gantt1.TimeItemLinks.LinkDataConnect class.

This class has events like OnBeforeDSToLink. You can implement this event and change the link type based on the data provided in the arguments (or data you can access having the arguments as a context).

 

Currently Link Databind is not documented in the help file. The Link Databind is officially release with version 3.0 due soon.

Read this article to get an overview of link-databind https://plexityhide.com/GTPNETOverview.htm

 

10697 : Is it possible to change TimeItemLayout in runtime ?

Question

Is it possible to change TimeItemLayout in runtime ?
When I assign new layout:
                gr.Layers[0].TimeItemLayout = “Span”; nothing happens.

Answer

Yes, go like this:

gr.Layers[0][x].TimeItemLayout = Gantt.TimeItemLayouts.GetFromName(“Span”);

where x is the timeItem index you want to change.

This code gr.Layers[0].TimeItemLayout = “Span”;  changes the template used for this Layer when creating new time items.

 

10690 : How to change the TimeItem of parent node automatically after changing child node ?

Question

How to change the TimeItem of parent node automatically after changing child node ?
I want to implement task grouping (similar to MS Project). If user change the start/end date of child task parent will be expanded automatically (span node).

I handled OnTimeItem_StopValueResize and OnTimeItem_StartValueResize.

Sample (simplified) source code:
OnTimeItem_StopValueResize {
  GridNode node = e.TimeItem.GanttRow.GridNode;
  DataRowView dataRow = node.ListItemWhenDataBound() as DataRowView;

  dataRow[“startDate”] = ((DateTime)dataRow[“startDate”]).Add(e.Diff);
  dataRow[“endDate”] = ((DateTime)dataRow[“endDate”]).Add(e.Diff);

  if (node.ParentNode != null) {
    DataRowView parentDataRow = node.ParentNode.ListItemWhenDataBound() as DataRowView;
    parentDataRow[“startDate”] = dataRow[“startDate”];
  }
}

After that grid data are modified correctly but Gantt item (TimeItem) is not expanded.
What should I call to refresh also Gantt area ?

I am using GTP.NET control with VS2005 (C#).

Answer

What you do in your code above is that you change the grid node datarow. If you want to change the TimeItem’s datarow you will need to do something like this:

DataRowView dataRowForTimeItem = GanttRow.FromGridNode(node.ParentNode).Layer[0][0].ListItemWhenDataBound() as DataRowView;

So to clarify: In your code I can only see a change of the Cell values not of the TimeItem, and that explains why the time item is not updated.

11058 : I am trying to add 2 texts to a time item. I want to be able to show text1 on one line and text2 on the line below text1. How can I accomplish this?

Question

 

I am trying to add 2 texts to a time item. I want to be able to show text1 on one line and text3 on the line below text1. I have tried the code below but only the last text gets displayed. How can I accomplish this?

 

Answer

 

To accomplish this use two TimeItemTextLayouts with different padding. The second one should have a top padding to make it appear under the first one:

 

      TimeItemText titxt = new TimeItemText();
      titxt.Text = “Test”;
      titxt.TimeItemTextLayout =
      gantt1.TimeItemTextLayouts.GetFromName(“Default”);
      titxt.TimeItemTextLayout.Color = Color.Black;
      titxt.TimeItemTextLayout.Font = new Font(FontFamily.GenericMonospace, 10, FontStyle.Regular);
      titxt.TimeItemTextLayout.VertAlign = StringAlignment.Near;
      ti.TimeItemTexts.Add(titxt);

 

      TimeItemText titxt2 = new TimeItemText();
      titxt2.Text = “Test2”;
      titxt2.TimeItemTextLayout = gantt1.TimeItemTextLayouts.GetFromName(“Default”).Clone() as TimeItemTextLayout;
      titxt2.TimeItemTextLayout.Name = “SecondOne”;
      gantt1.TimeItemTextLayouts.Add(titxt2.TimeItemTextLayout);
      titxt2.TimeItemTextLayout.Padding=new Rectangle(0,20,0,0);
      ti.TimeItemTexts.Add(titxt2);

10670 : When deleting a timeitem, how is it possible to all succeding linked timeitems? And how could one make an undo command?

Question

When deleting a timeitem, how is it possible to delete all succeding linked timeitems? And how could one make an undo command, to restore the deleted timeitems, including the links? Thank you in advance, Nicholas

Answer

When deleting the time item you can check the LinkStartCount and LinkTargetCount of the time item. You can access these TimeItemLinks with methods LinkStart(i) and LinkTarget(i) of the time item.

These TimeItemLinks should then (probably) be removed with TimeItemLink.DropLink.

In the very near future it will be possible to handle DataBind of the time items links as well (we are done and it this article explains how to use it https://plexityhide.com/GTPNETOverview.htm).

I think that this is the best approach if you want to handle undo etc. You can then have your data in a dataset and you can have a copy of the dataset from an earlier time. Then an Undo is merly a matter of switching datasets (back to an older one)…

10853 : I want to know if there is a way in which i can call methods of an IE-hosted Gantt from a codebehind file ?

Question

My program is implemented like your http://www.plexityhide.nu/IEHostedGantt/Default.htm < ?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

from Q10027

 

But I want to know is there a way in which i can call methods of this dll from a codebehind file? (Want to pass a DataSet that i can populate the table with)

 

And also if it is possible to send information from the dll to the codebehind file? (So when a time item gets changed i send this information back to the codebehind file to update other fields in a different user control)

Answer

Please refer to this article for useful tips on using the XBAP deploy: https://plexityhide.com/faqs_gen_GTPNET/10787.htm

 

The dll is hosted locally and it is not executed at the server at all.

You can produce javascript code and have that call the dll on the client side.

To get feedback from dll I guess you can expose events and implement and assign a javascript event handler to it, then have some javascript do a postback with necessary information.

 

10655 : My customer wants to prevent days from showing where he is not working?

Question

It is easy to prevent some weekdays from showing (e.g. saturday, sunday).

But my customer wants to prevent such days from showing where he is not working (that are only some specific sundays, but not all sundays). Can I mark some specific dates that where not shown in the datescaler.

Answer

It is not possible to hide just one specific day in the datescaler. We actually had it working this way when we developed it, but everyone got really confused, and all our real user test showed that they got really really confused too. So we skiped it.

A better way (we think) is to signal with a color in the datescaler, or maybe draw background in the TimeItemArea.

If you really want to have the working days stacked up and nothing in between I guess you can do so by taking a startdate (lets say 2006-01-01) and index your work days from this date; workday1 = 1/1, workday2 = 2/1 and so on. Override the Datescaler output so that it shows your workday dates instead of the january dates. Remember to fix all Start and Stop values for start times from your own “Workday-calendar”. And Voila! you got your stacked up workday calendar…

 

10826 : Can i get the Event Of Row selection Changed on grid?

Question

Can i get the Event Of Row Selection Changed on grid .

I am getting event OnGridCellSelectChanged But it gets fired as many number of the coloumns in row.

Answer

Currently there is no OnRowChange event. You can implement the OnGridCellSelectChanged and keep the e.Cell.GridNode value in a member variable; whenever this changes the selection is on a new row.