10388 : Im interested in having some read only time items in a gantt.

Question

I’m interested in having some read only time items in a gantt. These time items are only there to show aggregate data (the total number of hours worked per employee). I don’t want the user to be able to modify them or select them on the gantt. When the user’s mouse hovers over these time items I don’t even want the mouse cursor to change into a hand.

I saw the suggestions in this article:

http://plexityhide.dyndns.org/InstantKB13/Article.aspx?id=10026

Unfortunately, the items are still selectable and the mouse cursor acts as if they are movable items.

Ideally, I’d like to draw information on the “background” of the gantt row at the beginning of each week which states the total number of hours worked for that user for the week. How I was going to accomplish this was adding another layer to the gantt which was databound to a rollup table I calculate which contains this data.

Is there a better way which you would recommend I use to achieve the desired effect?

Answer

To get information into the background that is truly “dead” and allows no interaction I suggest that you implement the OnTimeItemAreaPaintBackground event as described in this article: http://plexityhide.dyndns.org/InstantKB13/Article.aspx?id=10066

You can use the Gantt.DateScaler.TimeToPixel method to translate a time to an exact pixel position so that you place your info on the exact correct place.

 

10386 : Is there a way, that you can save all your preferences of the GanttChart in a XML-File?

Question

Is there a way, that you can save all your preferences of the GanttChart in a XML-File?

So I want to setup a GanttChart, fill the grid on the left, move and add some TimeItems and then click “Save”.
When I click open, the whole GanttChart should be loaded, so that I can edit it.
(MS Project saves it as *.mpp for example).

Answer

There is no built in function to persist all data in a Gantt to a stream, but if you set up your data with databind you can persist the datasources and this is the prefered approach.

It would be a straight forward thing to do such a stream, just iterate all the GridNodes, and for each node all the GanttRows, and for each GanttRow, all Layers and for each Layer all the TimeItems, and for each time item, the time item texts and the time item links.

Maybe we will add this in the future as a good example of iteration, but currently you are regretfully on your own, sorry.

10385 : Id like to develop a Multi-Language ASP.NET – app with gtp.net. The Multi-Language Texts are stored in a Database.

Question

I’d like to develop a Multi-Language ASP.NET – app with gtp.net. The Multi-Language Texts are stored in a Database.

Question1: How can i set month-labels (Jan, Feb, Mar, …)?

Question2: How can i change the look (colour …) of the TodayLine and the VerticalDayStripes?

Answer

GTP.NET Gantt and Gantt_ASP uses windows culture information to get the default day and month names and you can set your own culture like this:
// Culture settings
    private void comboBoxCulture_SelectedIndexChanged(object sender, System.EventArgs e)
    {
      if (comboBoxCulture.SelectedIndex>-1)
      {
        dateScaler1.CultureInfoDateTimeFormat=new CultureInfo( comboBoxCulture.Items[comboBoxCulture.SelectedIndex] as string, false ).DateTimeFormat;
      }
    } 

But if you want to override the texts that end up on the datescaler some other way you can do so by implementing the DateScaler.OnDateScalerDrawString event. Here you get info about time, date and resolution you also get the suggested output and this value you can change to your own localized thru db-lookup value.

Regarding the TodayLine and VerticalDayStripes, both these items will be drawn with the color set in Gantt.TimeItemArea.BackColor

 
 

11244 : Zoom in zoom out images in Gantt_ASP is flipped?

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

 

How come the images for zoom in zoom out does the reverse of what they should? + zooms out and – zooms in!

 

Answer

 

There are two common takes on this: + goes closer – goes further away. OR + shows more time and – shows less time… We have chosen the latter one. Right or wrong?  Anyway you can switch the icons by implementing Gantt_ASP.OnGetResource

Implement Gantt_ASP.OnGetResource and when id == “PlexityHide.GTP.WEB.zoomin.gif” etc. you can send in another image…

10768 : Is it possible to make the datescalar text align to vertical?

Question

 

Is it possible to make the datescalar text align to vertical vertical orientation, in gtp.net?< ?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

Answer

Currently you must draw the texts yourself in the datescaler if you want them vertical. You can do this in the event OnDateScalerDrawString and then set e.ContinueDraw=false to stop the default text drawing.

 

10980 : Changing all row heights when one row is changing

Question

I tried to use the OnRowResize event to change all rows while one was changing. The grid starts to flicker and behave weird when doing this…

Answer

To solve this we introduced a new event.< ?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

 

New event added OnRowResizeDone

 

Event fires when user has resized a row.

You can implement this event to do other changes that you want as a result of a row height change,

like if you want to change all other Grid rows the same way.

 

This event is available from 3.0.9.1

 

So your code can look like this:

 

    /// <summary>

    /// This sample show how to detect a user row height change and how to change all the rows

    /// alike after the user has released the mouse button.

    /// </summary>

    void Grid_OnRowResizeDone(Grid aGrid, RowResizeDoneArgs e)

    {

      for (int i = 0; i < aGrid.GridStructure.RootNodes.Count; i++)

      {

        aGrid.GridStructure.RootNodes[i].UserRowHeight = e.GridNode.Rect().Height;

      }

    }

 

10626 : If im using paging on the gantt is it possible in the code to which page i want to display?

Question

I’ve got a question about the Gantt for ASP.NET 2. If i’m using paging on the gantt is it possible in the code to select which page i want to display. For exemple when the page is loading in the code i would like to display the page 5 of the gantt, is it possible ?

Answer

Yes. The Gantt_ASP.CurrentPage property (int) controls this. The value is stored in a viewstate variable like this

(

int)ViewState[“CurrentPage”]

10563 : Position of the fisheye area?

Question

How can I get the size and the position of the fisheye area? I want to draw a smaller rectangle in the background of the datescaler but I cant find any public properties to get the necessary values.

Answer

New properties has been added to facilitate this as a response to this question:
Exposed readonly properties FishEyeLow and FishEyeHigh. Good when developer needs to draw something special in the fisheye position.

10867 : I want to set the minimum value for the column width, hows this possible ???

Question

I want to set the minimum value for the column width, hows this possible  ???

Answer

You can implement this event Gantt.Grid.OnColumnWidthChanged.

This event is fired continuously as the user drags the column divider. Check the column value and if you think it is out of bounds set it within bounds in this event.

10588 : Can we make the Today line in real time?

Question

Can we make the Today line update in real time?

Currently I have to move or rescale in the DateTime scaler to get the today line to update. Could this happen in real time?

I have tried using various methods such as Invaildate etc on a timer without success.

Answer

All you need to do is to make sure the TimeItemArea gets invalidated once in a while. Add a timer and in the onTimer event go something like:

gantt1.TimeItemArea.Invalidate();

(for phGantTimePackage you can send an inavlidation message to the handle found here IphGantX3.HWndGantArea)