10455 : TimeItem made from images

Question

I want to create a timeline which taper like an arrow?
Can I select an Image for the middle part and one for the front and end part like some web site devolper tools?
I need a timeline like an arrow with pinnacles on both sides.    (For Example: <=======>; <=>; <==============================>)
Is it possible with GTP.Net?
Which size is optimal for the image?
And how does it works when I have a longer period?
In some web design tools I can choose a left and a right image and the middle part was draw/stretch for the period.

Answer

There is regretfully no out-of-the-box three image time item style (this is a good suggestion and we will remember this).

However if you choose “User” style on your time item and implement the OnTimeItem_UserDraw event you can easily implement this:

imageList1.Draw(e.G,e.Rect.X,e.Rect.Y,e.Rect.X+arrowWidth,e.Rect.Height,const_firstArrow);
imageList1.Draw(e.G,e.Rect.X+arrowWidth,e.Rect.Y,e.Rect.Width-2*arrowWidth,e.Rect.Height,const_middlepart);
imageList1.Draw(e.G,e.Rect.X+e.Rect.Width-arrowWidth,e.Rect.Y,arrowWidth,e.Rect.Height,const_secondArrow);

Its hard to give advise regarding the size; this pretty much depends on your design and the grid nodes row height that you want to use. If you are using variable row height etc.

10341 : Controlling datetime values while they change

Question

Is it possible when resizing an item (not after releasing the mouse button) snap the start of every item to the 0.00.00 time of that day and the resizing the end to the 23.59.59 ?

Answer

If you implement the OnTimeItem_Hoover event and access the e.Diff property you will find how much the move is currently worth. So if the mouse button is released the new value on whatever is changed will be oldValue.Add(e.Diff).

What you can do is to change the e.Diff value in OnTimeItem_Hoover event. You can change the value anyway you like but if you want snapping you can use the Gantt.DateScaler.Snap function.

10327 : Hi. Is it possible to give the rootnodes in the grid another (background) color than the subnodes?

Question

Hi. Is it possible to give the rootnodes in the grid another (background) olor than the subnodes?

Answer

You can set different cellLayouts on the different cells, the cellLayouts have a myriad of properties that control the look of the cell.

      CellLayout layout=new CellLayout(); 
      layout.MinHeight=20; 
      layout.Font=new Font(“Microsoft Sans Serif”,10); 
      layout.FontColor=Color.Black; 
      layout.VertAlign=StringAlignment.Center; 
      layout.Name=”layout”; 
      layout.HeaderBackgroundColor=SystemColors.Control; 
      layout.HeaderBackgroundGradiantColor=layout.HeaderBackgroundColor; 
      layout.LineRight.Use=true; 
      layout.LineRight.Color=SystemColors.ControlDark; 
      layout.LineTop.Use=false; 
      layout.LineBottom.Use=false; 
      gantt1.Grid.CellLayouts.Add(layout); 
       
      CellLayout layoutrightjust=new CellLayout(); 
      layoutrightjust.MinHeight=20; 
      layoutrightjust.LineRight.Use=true; 
      layoutrightjust.LineRight.Color=SystemColors.ControlDark; 
      layoutrightjust.LineTop.Use=false; 
      layoutrightjust.LineBottom.Use=false; 
      layoutrightjust.Font=new Font(“Microsoft Sans Serif”,10); 
      layoutrightjust.FontColor=Color.Black; 
      layoutrightjust.Name=”layoutrightjust”; 
      layoutrightjust.HorzAlign=StringAlignment.Far; 
      layoutrightjust.VertAlign=StringAlignment.Center; 
      layoutrightjust.HeaderBackgroundColor=layout.HeaderBackgroundColor; 
      layoutrightjust.HeaderBackgroundGradiantColor=layout.HeaderBackgroundColor; 
      gantt1.Grid.CellLayouts.Add(layoutrightjust); 

10340 : Moving many time items at a time

Question

I’ve a set of timeitems that when one of them is moved with mouse the other ones must be translated proportionally. it’s possible to show the destination position of the items when we are dragging it (not only the one catched by the mouse cursor) ?

Answer

The Gantt component handles multi select, so if a user holds the ctrl key while clicking the selection is extended with more time items. When many time items are selected and one of them are dragged, all the other ones follow.

So what you can do is to programatically set the TimeItem.Selected property to true to all the time items you want to be moved as a group.

10325 : How can i implement OnBeforeDSToTimeItem???? im working with VB (not C#).

 Question

hello,i’m working gtp.net and i’ve got a problem….when using datasource.
how can i implement OnBeforeDSToTimeItem????

i’m working with VB (not C#).
I would like to change,color,timeitemtext,

Answer

Add a method with this signature:

Private

Sub Form2_OnBeforeDSToTimeItem(ByVal aTimeItemDataConnect As TimeItemDataConnect, ByVal args As TimeItemAndDSArgs)

Then you bind to this method like this:

AddHandler gr.Layers(0).EnsuredTimeItemDataConnect().OnBeforeDSToTimeItem, AddressOf Form2_OnBeforeDSToTimeItem

10322 : The data in the bound datasource must be mangled before presentation. How?

Question

Because of the data in my normalized tables, when I use a databound gantt, no column in my DataTable has the data I would like to display in my GTP.NET grid.  I figured that I could use OnGridCustomCellDraw and OnGridPaintForeground to paint the cell much in the same way that I use the UserDraw, can I use these methods to draw the text in my Grid?

The problem I’m having is that the OnGridPaintForeground is the only event two that ever gets called, and based on the arguments given and the frequency it is called, I don’t think it is the appropriate for drawing the text for the grid column.

I must be missing some property that I need to set – similar to what you do with the TimeItemStyle when you are using UserDraw on TimeItems.

Are there any examples available where this is done?

Answer

One way is to produce a complex datasource that takes in the values from your other tables, but I think what you really want is a way to intercept what is put on the screen and also (if editable) a way to intercept what is put in the datarow when the grid is edited…

For this you need Grid.GridStructure.RootNodes.NodeDataConnect

There is currently no sample on this but the logic is the same as for time items (TimeItemDataConnect) and there are some samples for that…

Look at this article : http://plexityhide.dyndns.org/InstantKB13/article.aspx?id=10098

What you want to do is to implement the events:

Grid.GridStructure.RootNodes.NodeDataConnect.OnBeforeCellToDS
AND
Grid.GridStructure.RootNodes.NodeDataConnect.OnBeforeDSToCell

Once there you can do whatever you need with the data and fill the cells…

 

 

10323 : It is possible in the GTP.NET to make a multiple TimeItem ion using standard Windows application style with CTRL / SHIFT keys?

Question

It is possible in the GTP.NET to make a multiple TimeItem ion using standard Windows application style with CTRL / SHIFT keys?

Answer

Pressing CTRL while clicking time items will handle multi select. I you click an unselected timeitem it will be selected, if you click a selected it will be unselect (this is if you hold the ctrl key).

If you do not hold the control key the time item you click will be selected and all other time items will be unselect

 

10299 : Is it possible to define multiple combo-boxes in the grid of the gant with different values?

Question

Is it possible to define multiple combo-boxes in the grid of the gant with different values?

For example:
Column 1: Color (red, green, blue)
Column 2: User (User1, User2, User3)

When yes -> how to I have to define the combo-boxes?

Answer

The ComboBox values should be added to just before the combobox-edit-cell goes into edit mode.
The correct event to use is the Grid.OnBeforeEditCell

One possible implementation of this event looks like this:


private void grid1_OnBeforeEditCell(PlexityHide.GTP.Grid grid, PlexityHide.GTP.BeforeEditEventArgs beforeEdit)
{
  if (beforeEdit.Cell.Content is ComboText)
  {
    (beforeEdit.Cell.Content as ComboText).EditBox.Items.Clear();
    (beforeEdit.Cell.Content as ComboText).EditBox.Items.Add("Item 1");
    (beforeEdit.Cell.Content as ComboText).EditBox.Items.Add("Item 2");
    (beforeEdit.Cell.Content as ComboText).EditBox.Items.Add("Item 3");
    (beforeEdit.Cell.Content as ComboText).EditBox.Items.Add("Item 4");
  }
		
}

Note; in early versions of GTP.NET the beforeEdit.Cell.Content returned null in the OnBeforeEditCell event, get the latest patch to fix this issue
 

10295 : I use the week indicator and wonderd if its posible to change it from “W32” to … lets say “Uke 32” ?

Question

Hi I’m evaluating the GTP.Net and got a language problem as follow’s:

I use the week indicator and wonderd if it’s posible to change it from “W32” to … let’s say “Uke 32” ?

NB! This is the best Gantt chart component I ever tested, and I have 25 years of experience.

Answer

Gantt.DateScaler.PrefixWeek=”Uke” will do it. You can also change the default of PrefixQuarter from “Q” to something more language specific. Thanks for the positive feedback!

 

10679 : Is there an event that it fires when a row width is changed by a gui-action (not if you set it by code)?

Question

Is there an event that it fires when a row width is changed by a gui-action (not if you set it by code)?

Answer

Yes, Gantt.Grid.OnRowResize

Sample in VB.NET:


Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

  AddHandler Gantt1.Grid.OnRowResize, AddressOf My_OnRowResize ' add an event handle thru code 

  Gantt1.Grid.Columns.AddNew(PlexityHide.GTP.CellType.SingleText)
  Gantt1.Grid.RootNodes.AddNode()
  Gantt1.Grid.RootNodes.AddNode()
  Gantt1.Grid.RootNodes.AddNode()

End Sub

' Implement the eventhandler
Private Sub My_OnRowResize(ByVal aGrid As PlexityHide.GTP.Grid, ByVal e As PlexityHide.GTP.RowResizeArgs)
  ' If the row is getting higher than 50 pixels we stop it from growing further
  If e.Delta > 0 And e.GridNode.Rect.Height > 50 Then
    e.Delta = 0
  End If
End Sub