10401 : With Gantt, is there a simple way to make TimeItems read-only i.e. a user cant move them?

Question

With Gantt, is there a simple way to make TimeItems read-only i.e. a user cant move them?

Answer

Yes. each TimeItem has a TimeItemLayout (you may re-use timeItemLayouts to several timeItems). In the TimeItemLayout set these properties:
AllowChangeRow=false
 AllowChangeRow=false
 AllowLinkReAssignStart=false
 AllowLinkReAssignTarget=false
 AllowLinkSelectionStart=false
 AllowLinkSelectionTarget=false
 AllowMove=false
 AllowResizeEast=false
 AllowResizeWest=false

As you see the granularity to control what a user is allowed to do or not is high.

 

10373 : Is it possible to control the drawing of TimeItems so that if the TimeItemText is not contained within the area of the TimeItem box then I can use the TimeItemTexts box as the box of the TimeItem.

Question

I am developing a Gantt tool which will have to display a LOT of data. Is it possible to control the drawing of TimeItems so that if the TimeItemText is not contained within the area of the TimeItem box then I can use the TimeItemText’s box as the box of the TimeItem. This would ensure that the text did not overlap a subsequent TimeItem

Also, how do I get hold of the box data?

Also is it possible to expand a time-item’s height according to the number of lines the TimeItemText has wrapped to. How can I find out this number?

Answer

None of the things you ask for are available out of the box, but you can solve them all using the user draw technique. Take a look at this article that discusses OnTimeItem_UserDraw: http://plexityhide.dyndns.org/InstantKB13/Article.aspx?id=10210

In the OnTimeItem_UserDraw event you get the bounds of the box: e.Rect. The same value is also available in the TimeItem.DrawRect property. To get the bounds of the TimeItemText you need to meassure the text with the Graphic.MeasureString method from GDI. The Graphics object is also supplied in the TimeItem_UserDraw event.

These are good ideas and we will consider to extend the TimeItemLayout to handle these things in the future. Thanks!

10403 : GTP.NET for a ASP.NET gantt_OnAreaAttributes

Question

I’m evaluating GTP.NET for a ASP.NET – App.
In the event “gantt_OnAreaAttributes(Gantt_ASP aGantt, AreaAttributeEventArgs e)” is like to use UserReference-Property of the TimeItem (Key-ID of a Database-Record)
How can i do this?

Answer

You can use the information in the e.GroupName and e.ItemKey.

For  e.AreaKind==AreaKind.TimeItem the e.GroupName will be “TI;” and the ItemKey you can send into the Gantt_ASP.TimeItemFromKey and you will get the TimeItem back so:

Gantt_ASP.TimeItemFromKey(e.ItemKey).UserReference will do it.

10346 : Getting the clicked Node

Question

A gantt in my application has a treeivew of GridNodes, and I would like to enable the users to right click on the root nodes (which would bring up a context menu) and select a delete menu item to delete that node and all of the child nodes. I only want the user to see a menu if they click on a root node.

So far I have been unable to get the index of the grid node that I clicked on to see if its a root node. I started off with GanttRowFromY(e.Y).GridNode, but the node that is returned always has an index of 0 and the .ParentNode is never null (but the .ParentNode.ParentNode) is always null – irrespective on which GridNode I right-click on.

Could you send a code sample where you get the GridNode which the user clicks on? Also, is there a place where I can store an object that will reference back to the data record which is responsible for the creation of this node? Similar to what you can do with the TimeItem.UserReference property.

Answer

The reason for GanttRowFromY(e.Y).GridNode failing is probably because you send in a coordinate from the Grid Context (from OnGridMouseDown maybe) and the grid and timeitem area are not aligned due to column heads of the grid.

This is the way to do it:


    private void gantt1_OnGridMouseDown(object sender, System.Windows.Forms.MouseEventArgs e)
    {
      Cell cell=gantt1.Grid.GridStructure.CellFromXY(e.X,e.Y);
      if ((cell!=null) && (e.Clicks==2)) 
      {
        MessageBox.Show(cell.Node.SubLevel.ToString()+" - "+ cell.Node.Index.ToString());
      }
    }
If you only want to show the popup for root nodes you should check that Node.SubLevel==0.
You also had a question on where to store a reference in the GridNode; The answer is GridNode.UserReference :-)

 

 

 

10345 : Differences in ASP and windows forms controls

Question

Is the GTP.NET.WEB version also exactly like Gantt_M$_Look.exe?

I have installed Gantt_M$_Look.exe it works fine but the thing is I need ASP.NET version.

If your answer is yes we will buy .

Answer

You can get the same look in ASP as you get in windows forms, everything from userdrawn time items, links, locale sensitive date scaler info, things drawn in the background or foreground…

The limitations in the asp version is in the interaction part.

  • You can scroll in time, backwards and forwards (it will be more jerky than in windows forms)
  • You can zoom in time inwards and outwards (it will be more jerky than in windows forms)
  • You can select and detect clicks to individual time items and Gantt rows.
  • You cannot out of the box get multiple edit modes in the grid (you need to code client side scripts for this)
  • You cannot grab a time item and drag it.

10334 : Is it possible to have some timeitems in the gantt that cannot be resized?

Question

it’s possible to have some timeitems in the gantt that cannot be resized? (not all, some of the depending on custom data in UserReference)

Thank you for your support, the component is very nice and powerful!

Answer

Yes, You can set the FixedSize property to a pixel value on the TimeItemLayout. You also need to set the FixedSizeUse to true.A fixed value cannot be resized and will not stretch on zooming etc. This is good for milestones or bullet points in your schedule.

If the time item really has a stop value but you do not want the user to be able to change it you should set the TimeItemLayout.AllowResizeEast property to false instead.

 

 

10332 : How do you databind a dataset to the datagrid for the Web (PlexityHide.GTP.WEB.dll)?

Question

How do you databind a dataset to the datagrid for the Web (PlexityHide.GTP.WEB.dll)?  Followed the example like the Windows Form does not bind the data – the dataset does have the information.

Answer

We made a new sample. This is sample is not in the general download at the time this is being written, but it will be.

You can download the sample from here: https://plexityhide.com/pub/WebSampleWithDatabind.zip

This sample is very thin but it shows the important concepts. The sample has more or less a copy of the sample Gantt_Database and instansiate the windowsform from that sample, wraps the data bounded gantt from that sample to a Gantt_ASP.

Ofcourse you would not need to instansiate the form, but it is a practical solution if you already have a winform with a Gantt and you want to show the same info on the web.

The new active code from the sample above is only this:


private void Page_Load(object sender, System.EventArgs e)
{
	// Put user code to initialize the page here
			
	// Since we made a sample called Gantt_Databind that brings up a windows form
	// with a gantt that shows data from a demo database we reuse that form and 
	// instruct this web gantt to wrap that gantt (gantt_ASPSettings2.WrapGantt)
	// When that is setup we ask the form to connect to the database. Voila!
	// This is a good example on how you can reuse the investment in a form showing 
	// Gantt data on the web.
			
	Form1 aformwithaBindingGantt=new Form1();
      this.gantt_ASPSettings2.WrapGantt(aformwithaBindingGantt.Gantt);
      aformwithaBindingGantt.Gantt.DateScaler.ScrollButtonsVisible=true;
      this.gantt_ASPSettings2.Gantt_ASP.RescalingButtonsVisible=true;
      this.gantt_ASPSettings2.Gantt_ASP.TreeExpandStatusInViewState=true;
      aformwithaBindingGantt.OpenDBEtc();
    }

10342 : OnAfterCheck event

Question

OnAfterCheck event

Is it possible to include some kind of OnAfterCheck event in the grid of GTP.Net? OnAfterEditCell won’t fire after a checkbox (Celltype.BoolCheck) has been (un)checked

Answer

The event Grid.OnBeforeEndEditCell fires when any inplace edit control is taken out of edit mode, or when the checkbox is clicked. In this event you can dis-allow any editing based on your own logic.

 

10328 : Tag on TimeItems

Question

Hello,

i’d like to ask if it’s possible to add a Tag property (an Object variable) to the TimeItem class and GanttRow one (and maybe others). Usually it’s present in the .NET default controls to store useful data (like the code that represent a node in a tree control) for easily identify things.

I’d like to see that already implemented in the Gantt component without deriving the already existing classes.

Answer

Yes you are free to use the UserReference property of the TimeItem for this.

10273 : No images in Gantt_ASP

Question

I’m trying to test your gantt control in asp.net.

Currently i’m not able to test cause when i put the control on my webform, it looks like that the images for showing the controll can not be loaded or be found.

What i see is that i c:\temp 3 images are inside. The folder as fullaccess to everyone.

When i run the webapplication there is the same result. It looks like that images are not found.

Answer

The search path supplied is only used for design time images. In runtime the images are put into the cache and held for two minutes. The Gantt_ASP component uses the GTPImg.aspx page to retrieve the requested image from the designtime storage (disk) or the runtime storage (cache).

So your application must include a copy of the GTPImg.aspx page. You do not have to do anything special with it, just make sure that it is part of your project and resident in the same folder as your Gantt_ASP components owning web-form.