10451 : Could you please help me to get content of grids cell (SingleText) during editing.

Question

Hello guys. Could you please help me to get content of grid’s cell (SingleText) during editing. I can use onAfterEdit and onBeforeEndEdit, but I need content of cell during editing -for example, if I’m typing word in the cell and want to repeat this word in another field during typing, not after end editing. If you have any sugestions. Thanks a lot.

Answer

In the OnBeforeEditCell event you can set up a event handler to the inplace editor that will be used in the edit. You gain access to the Editor here: Grid.CurrentEditor (make sure you have a late version, this is rather new)

(Gantt.Grid.CurrentEditor as TextBox).TextChanged += new System.EventHandler(this.inplaceedit_TextChanged);

10467 : .NET tooltip delay

Question

We’re loading the tooltip text in the gantt_OnTimeItem_Hoover event. This works fine, but the tool tip appears too quickly. How and where should I set the toolTip.InitialDelay? Every way that I tried to set this property has no effect.

Answer

I tried the sample Gantt_TimeItems and you are correct, the tooltip shows directly…

This is a bit odd since these values are set on the tooltip component:

this.toolTip1.AutomaticDelay = 2000;
this.toolTip1.AutoPopDelay = 20000;
this.toolTip1.InitialDelay = 2000;
this.toolTip1.ReshowDelay = 2000;

It appears to be some un-document feature that if you call toolTip1.SetToolTip(gantt1.TimeItemArea,newTooltipText); with the same text, the tooltip show directly; ignoring the InitialDelay etc…

Work around is to avoid setting the same text twice:

if (toolTip1.GetToolTip(gantt1.TimeItemArea)!=newTooltipText)
  toolTip1.SetToolTip(gantt1.TimeItemArea,newTooltipText);

Then it started to behave as expected (Only tested in VS2006 CLR20).

10432 : Separating a click from a move etc

Question

I would like the user to be able to change start and stop dates by moving the time item and dragging the start or stop. I would also like the user to click on the time item to get a new window up with more detailed information. I have problems to find out when the user has clicked on a time item, is there an easy way to do that? The events that I can think of (OnTimeItemAreaClick, OnTimeItemAreaMouseDown…) are all fired together with AfterMove, StartValueResize, and StopValueResize.

Answer

implement OnTimeItemAreaMouseDown, in this event check the Gantt.MouseMoveKind property, it can take on values like none,move,resizew,resizee,linkCreate,timeItemCreate,linkReAssign

This information combined with the standard event parameters like e.Clicks==2 can help you catch a double.

If you just want to catch a single click you should know that we interpet this as a select of that time item. So you can implement OnTimeItem_SelectionChanged to catch these.

 

10424 : Time zones

Question

My application (a smart client) downloads data from a web service and displays it using GTP.NET. I’ve run into some difficulties regarding time zone. For example: if a business is using -7 (mountain standard time with DST) and someone connects to the web service using some other time zone setting in windows, all the times are messed up.

I was thinking about different approaches to dealing with this problem. Would it be possible to set an instance of a gantt to work off of a different time zone than the windows machine it is currently running on? The main thing I’m worried about is making daylight savings times correct in the gantt. Some users might not have their OS set to the “right” time zone for the data and it could cause a problem.

Answer

This can quickly become really nasty unless we make some clear definitions. I think i would do it this way: Store all date-data in the format of ONE defined TimeZone.

Lets say we choose UTC.

So when we get data from our DB we need to “convert” it to the User-time-zone; using the TimeZone.GetUtcOffset function will help us substract or add the correct value.

Later when we want to apply updates to the database we call the DateTime.ToUniversalTime method and store the result.

This way the user can have a setting that makes sense for him or her and we do not need to worry… If I were to use your app I would look at the Gantt in UTC+1 when planning my work at home and then switch to UTC-7 when planning what meetings I should attend to next time I’m in the US.

10422 : Re-using a gantt in another place

Question

Whats the shortest way to copy all items, settings, properties…. (everything) from one gantt-control to another one? I wanna see everything that is in one gantt also in another gantt. exactly the same.

Answer

The one thing that pops into mind directly is to re-use the class that has the Gantt in it; weather it is a form or a panel or some other win-control; simply instansiate it one more time…

10420 : Hide scroll buttons in Gantt_ASP

Question

I implement myself the Scaling and Dragging – Buttons(JS:__doPostBack(‘gantt’,’Subtract’), JS:__doPostBack(‘gantt’,’scaledec’), etc. ) in my gantt in ASP.NET.

This works fine, now can i hide the arrows in the DateScaler, because they make no sense anymore in my App ?

Answer

In your formLoad you can set Gantt_ASP.Gantt.DateScaler.ScrollButtonsVisible=false and then the buttons will not show in the generated html

 

10381 : image on a TimeItem

Question

I want to know how to tile an image on a TimeItem.
I wrote this:< ?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

item.TimeItemLayout.ImageIndex    =  m_ClipItemIndex;
item.TimeItemLayout.TimeItemStyle =  TimeItemStyle.Image;

Now I see the image yet it is not tiled to the whole duration of the TimeItem.
(I.e the image is not Tiled to the whole duration of the TimeItem, It is shown in it original size and the rest of the TimeItem is not shown)

How can I do this?

Answer

Actually the ImageIndex set in a TimeItemLayout will only be in effect when the time item style is Image.
A better way to add the images to a time item is to use the ImageIndex of the TimeItemTextLayout.
You can add time item texts to your time items and set the text=”” but the ImageIndex to a valid index of the Gantts imageList.
You can use the padding functionality of the timeItemTextLayout to place the image where you want it.
You can add as many timeItemTexts as you need.
 
However this feature was not fully implemented in the 2.0.13.0. You may request a pre release of 2.1 called 2.0.19.0 that has this feature fully implemented from support.

10380 : Action on Grid data in Gantt_ASP

Question

I’m using PlexityHide GTP.NET.WEB.

I’m using this control to display all the event (Grid) with timeline.
Currently, when click on the timeline, the related info will display in other page at the frame below.

I had pass the eventID when OnTimeItem_ClientClick.

My question is, can i do the same as OnTimeItem_ClientClick but apply to the grid.

So far when my mouse point to each row on the grid, the cursor do not change to ‘hand’ and i try to few event like grid_click and etc, there is no response on that.

Please advice.

Answer

Currently the best way to do this is by changing the grid data to a link (href) and in the link describe what action you want to take.

Like if you have a name in a grid cell like “Karlsen” and you want to do something when the user clicks that name:
Instead of adding “Karlsen” to the cell add “<a href=’javascript:__doPostBack(‘Gantt_ASP1′,’SOMEID;SOMEDATA’)’>Karlsen</a> ” then catch the postback in the Form on the server side.

10377 : I cant find TimeItem from specific item like index.

Question

I cant find TimeItem from specific item like index.
How can I find TimeItem from specitfic item in 5 GanttRows?

Answer

To get to a specific time item you need to know the Layer, the GanttRow or the GridNode (you can iterate thru GridNodes if do not have a specific node). Then if you have a GridNode (worst case) you can go like this:

GridNode gn=gantt1.Grid.GridStructure.RootNodes[0];
GanttRow gr = GanttRow.FromGridNode(gn);
TimeItem ti=gr.Layers[theindexofLayer(probably 0 if you only have one layer)][theIndexOfTimeItemWithinLayer];