Question
How can I show the current version of GTP.NET ?
Answer
If you right click the PlexityHide.gtp.dll , choose Properties, switch to version: The Assembly Version name holds the correct version.
Question
How can I show the current version of GTP.NET ?
Answer
If you right click the PlexityHide.gtp.dll , choose Properties, switch to version: The Assembly Version name holds the correct version.
Question
I’ve tested GTP.NET in connection with ECOII. Your example you provided works fine, except that changed names of the task or subtask items are note written to the EcoSpace. It seems there is a problem with the command:
e.GridNode.SubNodes_DataSourceList=tasks.GetList();
For project names it works.
Thanks in advance
Answer
I think maybe there was a mistake in an earlier version. The code for hooking up the subnodes now looks like this:
// We want to handle sub nodes with data bind….
// And we defined the sub tasks with nesting in our expression handle.
CurrencyManager cm=e.GridNode.OwningCollection.NodeDataConnect.CurrencyManager;
object ox=e.GridNode.ListItemWhenDataBound();
PropertyDescriptor pd=cm.GetItemProperties()[“SubTasks”];
RenderedList subnodes=pd.GetValue(ox) as RenderedList;
e.GridNode.SubNodes_DataSourceList=subnodes;
And according to recent testing it works. I have updated the download of the sample: https://plexityhide.com/pub/AProjectPlanner.zip
Thank you for bringing this issue to our attention.
Question
Can you schedule in hours? for job scheduling?
Answer
Yes, GTP.NET will show any time intervall. Even down to milli seconds if desired, and up to decades if needed.
Question
I want to create a cell with custom draw and also use a custom editor. Can this be done with the Grid from plexityHide?
Answer
Yes. You will need to implement 4 events
#1 OnGridCustomCellDraw, to control how the cell data will be drawn when not in edit mode
private void gantt1_OnGridCustomCellDraw(PlexityHide.GTP.Grid aGrid, PlexityHide.GTP.CustomCellEventArgs e)
{
//e.G.DrawImage(pictureBox1.Image,e.Cell.CellRect.Left,e.Cell.CellRect.Top);
int x = 0;
if (e.Cell.Content.Value != null)
x = (int)e.Cell.Content.Value;
e.G.DrawString(x.ToString() + " Custom", aGrid.Font, new SolidBrush(Color.Firebrick), e.DrawRect.Location);
}
#2 & #3 OnGridCustomCellEditStartByMouse and OnGridCustomCellEditStartByKey to start edit and create the custom editor,
place it, fill it with the current cell value etc.
private void gantt1_OnGridCustomCellEditStartByMouse(Grid aGrid, CustomCellEventArgs e)
{
// This event triggers for custom cells when edit Edit Starts from a mouseclick: Show editor, with data from Cell.Content.Value
// Why two start edit events? Mouse and Key? - Well you may want to catch the key press as input, but click should selet all in the editor...
if (e.MouseEventThatStartedEdit.Clicks==2)
InitCustomEditor(aGrid,e);
}
private void gantt1_OnGridCustomCellEditStartByKey(Grid aGrid, CustomCellEventArgs e)
{
// This event triggers for custom cells when edit Edit Starts from a key press: Show editor, with data from Cell.Content.Value
// Why two start edit events? Mouse and Key? - Well you may want to catch the key press as input, but click should selet all in the editor...
InitCustomEditor(aGrid,e);
}
private TrackBar customEditTrackBar=null;
private void InitCustomEditor(Grid aGrid,CustomCellEventArgs e)
{
customEditTrackBar = new TrackBar(); // keep the component until edit ends
aGrid.Controls.Add(customEditTrackBar);
customEditTrackBar.Bounds = e.Cell.Content.LimitRect;
customEditTrackBar.AutoSize = false;
customEditTrackBar.Maximum=100;
customEditTrackBar.TickFrequency=10;
int x=0;
if (e.Cell.Content.Value!=null)
x = (int)e.Cell.Content.Value;
customEditTrackBar.Value=x;
customEditTrackBar.Focus();
}
}
#4 OnGridCustomCellEndEdit that ends a current edit session and moves data from custom editor into the Cell
private void gantt1_OnGridCustomCellEndEdit(Grid aGrid, CustomCellEventArgs e)
{
// This event triggers for custom cells when edit is done: move new data from editor to Cell.Content.Value
if (customEditTrackBar != null)
{
e.Cell.Content.Value = customEditTrackBar.Value;
aGrid.Controls.Remove(customEditTrackBar);
customEditTrackBar = null;
}
}
Question
I want to format the text of the area for the LongIntervall of the DateScaler but I found some inconsistent appearances. Please take a look at the attached sample. My code begins at line 520.
As long as the DateScaler resolution is days and the DateScaler shows a part of a month the OnDateScalerDrawString method will be called and the Argument contains the correct OutputText. But if the resolution is hours the text disappears when the span is only from 00:00 to 12:00 or from 13:00 to 24:00. The same problem appears if you move the 12:00 marker beyond the StartTime or the 13:00 marker beyond the StopTime.
There is also a draw problem at time resolution minutes10 and minutes. The left box divider disappears if you scale to the right and the 10 minutes marker moves beyond the DateScaler StartTime. Another Question: Why the boxes showing the time goes from 0:30 to 0:30 and not from 0:00 to 0:60?
Answer
I have looked over your sample.< ?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />
You are correct in your observations.
When the resolution is Day/Hours the definition is to draw the box at daystart (24:00) and the Daylabel at 12:00, however if the scale is set in such a way that the resolution is Day/Hours but neither 24:00 nor 12:00 is on screen, no box start and no label point will be defined, then no label will be placed (and this is your observation). This is not currently treated as a bug.
The same strategy is used for all the scaling, but with different values. So the thing you saw for 10min/1min is pretty much the same.
>Another Question: Why the boxes showing the time goes from 0:30 to 0:30 and not from 0:00 to 0:60?
– When we have resolution larger than a day we always place the box at start and stop of the chosen resolution (day,week,month, quorter etc) and the label in the middle of the box. But when the resolution is less than a day in the upper band it is desirable to place the upper label at the correct value position (ie 09:00:00), and hence we must place the box around the position -> 30, 30
At this point we are not prepared to make any changes to the current logic, but we appreciate your feedback. Please feel free to argue with our positions if you do not agree.
Question
Hi,
I am trying to evaluate Gantt chart control for use in few of our WEB projects.
I am glad to see that most of my requirements are fulfilled by GTP control. However there is one requirement to show details of Task in ToolTip for each of the timelines. I would like to know how to do it. A code snipped would help.
GridNode gn2 = gn.SubNodes.AddNode();
gn2.GetCell(0).Content.Value = dr[0];
TimeItem tj = GanttRow.FromGridNode(gn2).Layers[0].AddNewTimeItem();
tj.Start = DateTime.Parse(dt1.Rows[0][“mStatusValidFromDate”].ToString()).AddDays(5);
tj.Stop = tj.Start.AddMonths(6);
tj.TimeItemLayout = new TimeItemLayout();
tj.TimeItemLayout.Color = Color.Red;
tj.TimeItemLayout.TimeItemStyle = TimeItemStyle.Square;
tj.TimeItemLayout.TopInset = 20;
tj.ToolTip = “My details”; //Is it possible to do something like this.
Answer
We have choosen to not include any special handling of tooltips in GTP.NET, instead we urge you to use the standard ToolTip control for .NET and bring it up in a event. This way you can also provide dynamic information and not only fixed texts.
A good example of this is in the Gantt_TimeItems sample in the general download. It goes like this :
private void gantt1_OnTimeItem_Hoover(PlexityHide.GTP.Gantt aGantt, PlexityHide.GTP.TimeItemEventArgs e)
{
string newTooltipText="";
if (e.TimeItem!=null)
{
newTooltipText="You are pointing at a time item that start "+e.TimeItem.Start.ToLongDateString();
if (e.TimeItem.UserReference is BreakInfo)
newTooltipText=newTooltipText+"\n The time item you are pointing on has a BreakInfo object in UserReference...";
}
else
{
newTooltipText="";
}
if (gantt1.MouseMoveKind==MouseMoveKind.move)
{
newTooltipText="You are moving a time item to the new date "+gantt1.FocusedTimeItem.Start.Add(e.Diff).ToLongDateString();
if (!(gantt1.GanttRowFromPoint(new Point(e.x,e.y)) == gantt1.FocusedTimeItem.Layer.Layers.GanttRow))
{
newTooltipText="You are moving a time item to a different row";
if (e.Diff.Days!=0)
newTooltipText=newTooltipText+"\n and to the new date "+gantt1.FocusedTimeItem.Start.Add(e.Diff).ToLongDateString();
}
}
else
if (gantt1.MouseMoveKind==MouseMoveKind.resizew)
{
newTooltipText="You are changing the start time of a time item to the new date "+gantt1.FocusedTimeItem.Start.Add(e.Diff).ToLongDateString();
}
else
if (gantt1.MouseMoveKind==MouseMoveKind.resizee)
{
newTooltipText="You are changing the stop time of a time item to the new date "+gantt1.FocusedTimeItem.Stop.Add(e.Diff).ToLongDateString();
}
if (toolTip1.GetToolTip(gantt1.TimeItemArea)!=newTooltipText)
toolTip1.SetToolTip(gantt1.TimeItemArea,newTooltipText);
}
This sample shows dynamic tooltips, but if you need Static, just add a string to the TimeItem.UserReference and pick it up in this event
Question
Is there a way to combine two column cells? i have 5 columns in my grid, but every 10 columns i only have 2 columns filled with data. and the second data is so long (string) that i wanna use the other 3 columns for drawing the full information. is that possible?
Answer
I see your point and this would be good functionality. Will make a note in the todo list. Currently you must do something like this: Create the cells that you want to combine as CustomCells, then when you draw the custom cell, you identify the other two cells (in the group of 3), find out their rectangels, find out if they are on screen etc; calculate a grid cell that is big enough to cover all three cells, then draw your data into this (with gdi commands).
Question
How would I add tooltips to time items and grid cells in the Gantt_ASP
Answer
In IE-html the title attribute of a tag is interperted as a tooltip so to add the tooltip to a grid cell you only change the text in it from “Hello” to “<span title=\”The hello tooltip\”>Hello</span>”…
And for a time item you would go like this:
private void Gantt_ASP1_OnAreaAttributes(PlexityHide.GTP.WEB.Gantt_ASP aGantt, PlexityHide.GTP.WEB.AreaAttributeEventArgs e)
{
if (e.AreaKind==PlexityHide.GTP.WEB.AreaKind.TimeItem)
{
e.Result=" Title=\"Tooltip for this time item\" ";
}
}
In Ajax things has changed slightly:
This design is a bit more complex but a lot more flexible.< ?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />
To get a very simple tooltip you can set the title property of an img element; but our problem was: How do we let the developer do this when the img is created in javascript at the client, but the text for the tooltip is most likely prepared at the server?
This is how we solved it:
We added a property that lets you inject javascript code into the code we generate:
1. Gantt_ASP.ClientSideJavaScript_TimeItemInit
And we added an event that enables you to produce a string server side that will travel down to the client and can be used in the code you injected by using the property above
2. Gantt_ASP1.OnTimeItemUserStringPrepare
So if you implement just like this:
Gantt_ASP.ClientSideJavaScript_TimeItemInit = "aImgElement.title=aClientTimeItem.UserString;\r\n";
void Gantt_ASP1_OnTimeItemUserStringPrepare(PlexityHide.GTP.WEB.Gantt_ASP aGantt, PlexityHide.GTP.WEB.TimeItemUserStringPrepareArgs e)
{
e.result="This time item starts st "+e.ti.Start.ToLongDateString();
}
You get the simple tooltip on client side movable time items, and they work both in FireFox and IE
Question
It is possible to make a Tracking Gantt? I mean having 2 TimeItems for each node differently coloured and which can overlap? Just like MS Project style.
Answer
I am not entirly sure what you mean with “tracking” in this case, but it safe to say that one way or the other you can do anything that MSProject can do.
You might need to use UserDrawn time items, you might need to use time items on different drawing layers, but rest assured that you can do everything in MSProject. If you want a specific answer please explain your need in greater detail.
Question
How can I tell which nodes in my tree are visible to the user?
When the user expands a node, I would like to be able to adjust the display so that all the sub-nodes of that node are visible (without the user having to scroll up or down to see them).
Or is there a way of getting the Gant control to adjust the display automatically? I would ideally like the tree to work like the tree in Windows Explorer.
Answer
Both the phGantTimePackage and GTP.NET returns a rectangle of -1,-1,-1,-1 for the grid rect of cells that has not been drawn (because they are not currently on screen).
In phGantTimePackage you can use the IphGantRow3.GetRect method
and in GTP.NET you would use GridNode.Rect
The same applies to individual cells (that they return a -1 rect if not currently on screen).