Question
How is it possible to draw something in the Left Upper COrner above the Grid.
We want to show the Current Day
Answer
In the GTP.NET you can access the area above the grid like this: gantt1.Grid.Parent and cast the result to Panel.
Question
How is it possible to draw something in the Left Upper COrner above the Grid.
We want to show the Current Day
Answer
In the GTP.NET you can access the area above the grid like this: gantt1.Grid.Parent and cast the result to Panel.
Question
How do I determine when a user has changed the width of a column? I need to save column widths when they have been changed but since the columnwidthchanged event fires continuously during column dragging it is not really helpful in determining the final width (and I don’t want to update the database multiple times during a column sizing operation)..
Answer
It seems like a bug if the ColumnWidthChanged is fired all the time while moving and there is no way to detect if the move is still in progress.
A workaround is to set a variable called myColumnWidthChanged to true in that event and implement OnGridMouseUp and check if the variable is set, if so act. Also remember to reset the myColumnWidthChanged variable to false in the OnGridMouseUp.
Question
Is it possible to use a TimeItemStyle of ‘User’ in GTP.WEB? If so, how do we specify how to draw the item?
Answer
Yes. The Gantt_ASP uses the windows forms gantt for rendering. So implement the event found here:
Gantt_ASP.Gantt.OnTimeItem_UserDraw
This event can be implemented like this in c#:
this
.Gantt_ASP.Gantt.OnTimeItem_UserDraw += new PlexityHide.GTP.TimeItemEvent(this.impl_OnTimeItem_UserDraw);
In VB.NET you use the AddHandler call to assign a delegate in runtime, like this:
Add a method:
Private
Sub impl_OnTimeItem_UserDraw(ByVal aGantt As PlexityHide.GTP.Gantt, ByVal e As PlexityHide.GTP.TimeItemEventArgs)
Then you bind to this method like this:
AddHandler this.Gantt_ASP.Gantt.OnTimeItem_UserDraw, AddressOf impl_OnTimeItem_UserDraw
IMPORTANT: TimeItem.TimeItemLayout.TimeItemStyle must be set to User. Otherwise the user draw event is not called…< ?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />
Question
How can i get the height of the row, i tried this code, which is called in the PreRender-Event of the asp-page:
foreach( GridNode gn in gantt.Gantt.Grid.GridStructure.RootNodes )
{
GanttRow gr = GanttRow.FromGridNode(gn);
nHeight -= gr.Rect().Y;
}
But gr.Rect().Y is always -50, regardless of the height of the row (gr.Rect().Height is always 0 by the way ?)
Answer
GanttRow.FromGridNode(gn).Rect().Height is the correct way to find out the height. It will however only be correct for currently visible rows. Rows not on screen have an undefined height since their text wrapping and other rules are not calculated.
To get the correct surroundings to calculate the total visible height you must know that :
#1 In Gantt_ASP the Gantt is rendered in memory (the correct values to the GanttRow rectangles are set after this).
#2 Then internal ViewState is applied (so that the correct paging is set, and nodes folded and collapsed according to user actions)
#3 Then the OnApplyViewState event is fired
Put your Gantt-Height-changing code in the OnApplyViewState event.
protected void Gantt_ASP1_OnApplyViewState(object sender, EventArgs e)
{
this.Gantt_ASP1.Height = 200;
}
Question
Is it possible to add javascript event to the timeitems ? I have made a tooltip that i use everywhere in our web application. I would like to use the same tooltip but i can’t find how to add javascript event on the timeitems. What i need to do is display information when the mouse is over a timeitems. This information need to be place a array (The tooltil will be 200px X 300 px) so i need to use html code. The tooltip i’ve made allow me to do this so if it’s not possible to use my tooltip is there any other way to do this
Answer
Yes you can inject a reference to your own javascript if you implement the event OnAreaAttributes. In the sample below the onMouseOver event is used to set the status field of the browser but you could just as well call your own javascript.
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=\"You are now over a time item\" onMouseOver=\"self.status='Hey man, your are over a time item';return true\" ";
}
else
if (e.AreaKind==PlexityHide.GTP.WEB.AreaKind.TimeItemRow)
{
e.Result=" Title=\"Click this one if you are happy\" onMouseOver=\"self.status='YOU ARE NOW ON THE ROW, and not over a time item';return true\" ";
}
else
{
e.Result=" onMouseOver=\"self.status='---';return true\" "+e.Result;
}
}
Question
I use a gantt in my ASP.NET project:
The poperties UseExpandedRowHeights and CollisionDetectionSyncron are set to true, so that my rows have different sizes.
How can i set the Height of the gantt, so that all rows just fit into the gantt-(border) ?
Answer
You will need to load the data, then iterate the rows in Gantt_ASP.Gantt.Grid.GridStructure and sum up the heights. You will need to add the DateScaler height as well. Then set this value as the control height.
Update; this code will solve this:
protected void Gantt_ASP1_OnClientSideChangesApplied(object sender, EventArgs e)< ?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />
{
Gantt_ASP1.Gantt.Grid.Refresh();
Gantt_ASP1.Gantt.TimeItemArea.Refresh();
if (Gantt_ASP1.Gantt.Grid.GridStructure.LastDrawnNode != null)
{
Gantt_ASP1.Height = Gantt_ASP1.Gantt.Grid.GridStructure.LastDrawnNode.Rect().Bottom + Gantt_ASP1.Gantt.DateScalerHeight;
}
}
Question
In the GTP.Net version is there a way to find a UserReference like there is in the ActiveX version (FindFromUserVariantReference)?
Answer
In GTP.NET 3.0 you can use Grid.FindGridNodeUserReference to find GridNodes based on UserReference, Gantt.FindTimeItemUserReference to find time items in the entire Gantt or Layer.FindTimeItemUserReference to find in a single layer.
To find time item links use Gantt.FindTimeItemLinkUserReference.
Prior to GTP.NET 3.0 there is no “FindFromUserReference” function . The work around is to iterate and search yourself, or keep a hash-index on the side that you add the Gantt-object and the UserReference to each time you add something.
Question
I have a question regarding selection of cells in a grid.
Usually in the other applications (e.g. MS Excel) when you select a cell thruogh mouse click and then keep the mouse button pressed and drag it to some other cell then all the cells between them get selected but unfortunately its not the case with GTP.Net.
Is there any property or method available in your library to achieve this sort of effect?
Answer
The Grid allows for multi select just as explorer does; if you hold the shift-key you get an anchor point, keep shift held and select another cell, all cells between are selected.
If you hold the control key you create disjunct selections, clicking a selected cell will remove it from the selection group, clicking an unselected will add it to the selection group (while the ctrl key is held).
You can combine the two ways to build complex selections.
Question
When collision detection is enabled is it possible to ensure that ALL time items are of standard height. I want to prevent time items which don’t collide from expanding in height.
Do I need to use OnTimeItem_UserDraw for this? Are there some examples of the use of this method?
Answer
Currently non colliding time items will take on the height of the row minus the TopInset and BottomInset from the timeitemlayout. If you want to override the height of a time item you can do so by implementing the user draw. In the article in the link below the user draw is used to draw a progress bar inside a time item, but you can just as well limit the rectangle and draw a thinner time item. http://plexityhide.dyndns.org/InstantKB13/Article.aspx?id=10210
Question
Im developing a .NET 2.0 application. Currently, GTP.NET requires that my development PC have the 1.1 framework during its installation. Will you have a .NET 2.0 only capability before the end of 2006? I really dont want my customers to have to install two frameworks.
Answer
Yes we will have GTP.NET for .net 2.0 by that time