10704 : How can I print only selected pages from a GTP.NET gantt?

Question

How can I print only selected pages from a GTP.NET gantt?

There does not seem to be a way of advancing to the first page of a selected page range.

Answer

We will always render all pages (to the printDocument) it is then up to the printDialog to send these pages to the printer.

You can instruct the print dialog to start on page x:

“The FromPage and ToPage properties are used by the PrintDialog when the user selects a print range. The PrintDialog.AllowSomePages property must be set to true to enable the user to specify a print range. In addition, the PrintDialog requires the MinimumPage and MaximumPage to be specified and the FromPage value to be within that range.”

So why are all pages processed if we only want to print page 5?

The number of pages is not known until the printDocument has finished. We need to see how many nodes that fits on each page.

The frameWork is really very flexible. Let me show you this:

   PreviewPrintController y=new System.Drawing.Printing.PreviewPrintController();
   y.UseAntiAlias=true;
   printDocument.PrintController=y;
   printDocument.Print();
   PreviewPageInfo[] aPreviewPageInfoList=y.GetPreviewPageInfo();
   aPreviewPageInfoList[5-1].Image  <— The image(EMF) of page 5… 


 

 

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.

 

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);

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.

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)…

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…

 

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.

 

10833 : How to obtain a runtime key for gtp.net?

Question

How to obtain a runtime key for gtp.net? Since my last update of gtp.net i’ve to call RegisterRuntimeKey…

Answer

You get the runtime key by visiting this page http://www.plexityhide.nu/runtimekeys/Default.aspx 

You must enter your serial number (CSGTPXXX) & your exe or assembly name.

The exe or assembly name to use is the name of your produced assembly or exe that will call Gantt.RegisterRuntimeKey or Gantt_ASP.RegisterRuntimekey.

Do you run a web-project without assemblies? Then you enter the dns name (for this site its plexityhide.nu) of your  deploy server instead.

You will get an automated email directly on completion of the form with the key + instructions on how to enter it into your application.

Need more hints on what to enter in the assembly name box? You can call gantt_Asp1.RuntimeKeyHelp or/and gantt1.RuntimeKeyHelp_Assembly to get the correct info for your application.

About runtime keys:

Call this early in your application to register the runtime key.
The runtime key is free for registered users and is obtained as described at http://www.plexityhide.nu/runtimekeys/Default.aspx 

The runtime key is unique per application, you can obtain as many runtime keys as you need.
The runtime key is NOT a runtime license, registered users have the license, the runtime key only removes the runtime plexityHide marking.

The main reasons for the introduction of runtime keys are:

#1 To Better understand customer applications and demands to guide us in further development
#2 To better track evaluation copies and important customer feedback
#3 To Protect customer investments from unfair competition from pirates
#4 Increase awareness of the plexityHide brand

 

Gotchas:
The key is compared with the application/assembly name in runtime so the key must be generated with the correct application/assembly name.

Call this in FormLoad for winforms:
Gantt.RegisterRuntimeKey(“THE RT KEY YOU GOT IN THE EMAIL”, “YOURKEY YOU GOT WHEN YOU BOUGHT GTP.NET”);
For ASP.NET you can choose to enter the url instead of the application name in the form (http://www.plexityhide.nu/runtimekeys/Default.aspx)


Or if you have the Gantt in an assembly, you can use the assembly name.

 

Just visit

http://www.plexityhide.nu/runtimekeys/Default.aspx and follow the instructions.