10418 : I am trying to conditionally allow or prevent the moving/resizing of timebars

Question

I am trying to conditionally allow or prevent the moving/resizing of timebars on the calendar based on certain conditions. I have read the helpfile and a KB article on the topic but i still dont understand how to manipulate a time item’s move/resize properties.

The reply to the KB question reads….
_________

Answer

In phGantTimePackage this can be handled with properties on the IphGantRow3.

IphGantRow3.TimeItems_CanChangeRow=false
IphGantRow3.TimeItems_CanMove=false
IphGantRow3.TimeItems_CanResize
_____________

So this is on a ROW basis? Cant i have do this down at the timebar level??

Also, i dont understand the naming convention of “IphGantRow3.TimeItems_CanResize”. 

My code to populate the treeview and to draw timebars is shown below.  Can you show where and how in my code to allow/prevent a timebar from being moved or resized??  I was hoping to do something like the following but it DOES NOT work:

tTime.AllowMove = .t.
tTime.AllowChangeRow = .t.
tTime.AllowResizeEast = .t.
tTime.AllowResizeWest = .t.

Answer

You are correct that the “Allow” properties are set per row. This is a design limitation (or flaw) to the phGantTimePackage that has been fixed in the GTP.NET. The workaround for phGantTimePackage user to get conditional AllowResizeEast etc is to implement the IphGantX3.OnBeforeCanEditGantTime and in this event evaluate what the correct settings for the properties should be and update them on the row.

 

10779 : Cannot click image with zero length

Question

I need to select a time item TimeItemStyle=image with the click mouse but the time item start and finish is equal.

No action on image

Answer

This is what we call a FixedSize time item, it has no length and is common in milestones etc.

In GTP.NET you set FixedSizeUse to true and FixedSize to a pixel value in the time item layout.

In phGantTimePackage you set IphDataEntity_GantTime2.FixedSize to the pixel value you need

10648 : How can you add a link from one time object to another on double click.

Question

How can you add a link from one time object to another on double click.

I have tried using the code

Set alink = theGant.AddLink
If Not (theDataEntity Is Nothing) Then

   If alink.LinkOwner Is Nothing Then
    alink.LinkOwner = theDataEntity
  Else
    Set alink = phGantX1.AddLink
    alink.LinkedTo = theDataEntity 
  End If
End If

Answer

A link needs two time items. If you want to add a link as a result of a double click you will have one time item for sure. Namely the time item you double clicked on. But what about the other?

You can iterate thru the time items and find another selected time item (IphDataEntity_GantTime.Selected=true) or you can take the double click as the start for finding the other, by setting the component into a “link creating mode” and drag a link out to a new time item as described in this article.

The important thing to remember is to set two different time items in the link properties LinkOwner and LinkedTo, otherwise the link will not be drawn.

    Dim aLink As IphDataEntity_Link
    Set aLink = theGant.AddLink
   
    aLink.LinkOwner = theStartDataEntity
    aLink.LinkedTo = theTargetDataEntity

 

 

 

 

10644 : Im evaluating GTP.NET and YAPP, could you tell me whta is the relation between the two products?

Question

I’m evaluating GTP.NET and YAPP, could you tell me what is the relation between the two products? Can projects created in yapp be opened using GTP?

Answer

Yapp was made using the phGantTimePackage. Yapp is a standalone application that uses many of the features available in the phGantTimePackage. When .net was released we constructed GTP.NET, that stands for GanttTimePackage.Net. Now GTP.NET is a, fully managed, potent component package that in many ways surpass the phGantTimePackage.

Yapp uses a simple xml format to persist the objects within. This format could easily be interperted and read by your code to show the same data in the GTP.NET, but there are no such functions built into the GTP.NET package.

10564 : I have a problem with setting the rowheight property of the grid.

Question

I use your phGantTime package with Delphi 7.

I have a problem with setting the rowheight property of the grid. I cannot set this value less than 20 pixels. I tried to reduce the used font size too, but the rowheight is always 20. How can I resolve the problem? Our client wants to see more rows on the screen, without scrolling the gant.

For example:

phGant1.Grid.SetRowHeight(1, 15);

phGAnt.Grid.GetRowHeight(1) get 20

Thanks.

Answer

This has to do with the cellLayout that has a MinHeight property that is default set to 20. If your cell does not activly use CellLayouts the DefaultCellLayout.MinHeight is used.

Change it like this phGrid.DefaultContentLayoutProperty.MinHeight:=15.

10559 : Web deploy

Question

Whenever we are accessing phGantTimePackage 3.0 through an ASP page using ActiveX control over internet, it is giving following error:

“Object doesn’t support this property or method”

and crashes the IE though the ActiveX control is registered on the client m/c correctly. To contrast with, if we access the same page on the local network, it is executing perfectly.

Eg:

http://www.myserver.com/PTGantView.asp gives error while http://myserver/PTGantView.asp works fine (both are same m/c’s).

What can be the possible issue here? Any help would be highly appreciated.

Answer

When you want to distribute the phGantTimePackage.ocx over the web in this way you should use a cab file. You can use the cab file found here https://plexityhide.com/pub/CAB.zip further more, since the phGantTimePackage is a signed control you must use a lpk file on the web server (this does the same thing as the lic file on the local computer). The lpk files are enclose in the Cab.zip and they should be in the same folder as the cab file. The zip also contains a small htm sample page.

 

10536 : I need is to be able to display various periods of calendar with several shifts (time periods) in a day…

Question

Hello,

My question is the same that was asked in ‘Q10066 – FAQ: I need is to be able to display various periods of calendar with several shifts (time periods) in a day..’.

My problem is that you posted a sample for GTP.Net saying that it would be the same for phGantTimePackage, but I can’t find the OnDateScalerPaintBackground or the OnTimeItemAreaScalerPaintBackground events in the phGantTime OCX.

Which event should I override to be able to paint different weekdays with different colors in the Gantt?

Thank you very much,

Answer

In phGantTimePackage you have these events in the VCL version:

TphGant.OnUserDrawBackground
TphDateScaler.OnUserDrawBackground

In the OCX version the DateScaler OnUserDrawBackground is not currently available (if you need it email support and we can expose it) but you have the phGantX.OnGantAreaDrawBackground to handle the background in the TimeItemArea.

 

10509 : How can I access to phGantXControl enums like TxTimeStyle in VC++?

Question

How can I access to phGantXControl enums like TxTimeStyle in VC++?

I want to set the style of a GantTime, but I can’t write in my code

time->SetStyle(tsPipe);

I can only write something like this:

time->SetStyle(8);

Thanks

Answer

This really depends on how you imported the type library, but if all is somewhat standard you should find the enum definition TxTimeStyle in the created h file.

So then you would go

time->SetStyle(TxTimeStyle.tsPipe);

10407 : How can I get the height of a timeitem? or the height of a treeitem?

Question

How can I get the height of a timeitem? or the height of a treeitem?
And how can I get the count from all visible treeitems?

Answer

You can use the IphGantRow3.GetRect method to get the rectangle of the GanttRow, to get the x-coordinates you must use the DateToPixel on Start and stop.
To get all visible tree items; Iterate thru Gantt.RowList and get the IphGantRow3.GetRect for each item check if the rectangle is -1,-1,-1,-1 then that row is not on screen.

10628 : Is there a way to hide the grid?

Question

We’ve been using your phGantControl OCX for a few years now, and we would like to have it displayed with no tree and no grid visible. Is there a way to hide it, and to make sure the user won’t be able to make it visible (it seem that a separator can be dragged by the user to make the tree visible).

Answer

The grid row height controls the height of the Gantt row and currently the grid must be at least a few pixels wide so that the row height can be calculated.

The best way to “hide” the grid is to put something else above it, or kidnap it and put it somewhere else (offscreen). To do this you will need the window handle of the grid and call win32 windows functions to add a control to the grid (covering it) or to move the grid.

The windows handle is reached with the IphGantX3.HWndGrid property