10665 : How can I put an image (like the example in Yapp) in a TimeLine?

Question

How can I put an image (like the example in Yapp) in a TimeLine?

Answer

In phGantTimePackage you set the IphDataEntity_GantTime2.Style to gtsImage, uses the ImageIndex property to get a Image from the imagelist (same images as from the tree) . Or you can use a userdrawn time item and place an additional icon in there by normal GDI drawing.

In GTP.NET the TimeItemTextLayout has a property for ImageIndex. This enables you to place multiple icons in or outside of a time item.

10796 : Dragging between Gantts…

Question

I have two phGants on one form and drag between them and within them. When dragging between the gantts users hold down the cntrl key and when dragging within a single gantt they just drag the mouse. Problem is,, sometimes users forget and hold the control key down when dragging within a single control. The OnOlEDrop event does not trap for it. The senderid is always 0. How can I trap for this and know for sure whether they are dragging between two gantts or within 1 gantt?

Answer

When you recieve your GantTime you can check what phGant that owns in by navigating like this phDataEntity_GantTime.Row.TreeNode, when on the node you must iterate until TreeNode.Parent==nil then the TreeNode.OwningDataList will equal the phGantX.RootDataEntitiesTree for either Gantt1 or Gantt2

 

10579 : Can i move a Gant Time to a different row and a different time at the same movement?

Question

Can i move a Gant Time to a different row and a different time at the same movement?

I only can change row or day but not the two movements. I have programmed the two events ( OnGantTimeChangeRow and OnValueChangedGantTime) but only one of them is fired.

How can I do this?

Answer

You need to set IphGantX3.MoveInTimeWhenMoveRow=true and you will be fine.

 

10649 : Im using phGant VCL version with Delphi 2006 and would like to know how to save the content of the component to a file in order to reload it later ?

Question

I’m using phGant VCL version with Delphi 2006 and would like to know how to save the content of the component to a file in order to reload it later ?

Answer

There is no built in function to persist the component state to disk, and no function to reload. I would suggest that you us a MSXML DOM and iterate the gantt chart and save the objects and properties you want saved in elements and attributes.

10525 : Change the grids columns order in runtime.

Question

We are working with the phgantTime30 control as an scheduler. I was wondering if there is any property or something that allows me to change the grid’s columns’ order in runtime.

Something like selecting the column and dragging it to another position in the grid.

Answer

When you use the phSchema: You can call  IphSchemaX3.Columns.Move to throw columns around, but there is no interaction to let the user do this implemented. You would need to do that with OnMouseDown etc yourself.

When you use the phGant and the grid within: In the activex version you need to use GridColumnInsert and GridColumnRemove. This is not ideal and the VCL version allows for much more functionality not currently exposed…

10531 : Is it possible to set the language in order to change the date format?

Question

We have to insert the possibility to change language settings. Is it possible to set the language in order to change the date format?

Example: Regional settings of my PC are italian but I want dates in phGanttControl.ocx to be in English and I want to view the days of the week like this: “Sun”, “Mon”, “Thu”, ecc..

Alternatively, is it possibile to hide the days of the week when I’m zooming the control?

Answer

The settings is read from windows-locales at startup, the setting is read again as a responce to the WM_WININICHANGE message.

To change the locales settings in windows (got this from msdn):

setlocale( LC_ALL, “French_Canada.1252” );
// Set code page to French Canada ANSI default
setlocale( LC_ALL, “French_Canada.ACP” );
// Set code page to French Canada OEM default
setlocale( LC_ALL, “French_Canada.OCP” );

This is untested and we are not entirily sure that it will work. Maybe we will need to expose a method in the API to let you send in the desired culture-lcid.

You may also implement the IphGantX3.OnScalerStringShort and IphGantX3.OnScalerStringLong events and override the outputted text.

 

10533 : Change the date format in the top of scaler.

Question

I used the events OnScalerStringLong and OnScalerStringShort to change the date format in phGanttControl.ocx, but It remains to change this in the top of scaler. It says some like “2006 apr-mag” (in italian) but I want change this in “2006 Apr-May” (in english) programmaticaly

Answer

There is an event that allows you to override that text;  OnDateScalerInfoText.

10558 : Is there a way to make faster my gantt?

Question

I installed the Siemens version of phGantXControl.ocx but I see that it’s slower than phGantXControl.ocx of the try version.

Is there a way to make faster my gantt? I see that it exists an event called OnVirtualLoadGrid but I don’t understand how I can use it and if it is really able to improve performances of my gantt.

Answer

There is no difference in the phGant used by Siemens and the general download except maybe a version difference. You can upgrade (without any fees of course) to the latest patch.

The virtual load is an option if your loading and unloading times are noticeable, and you have many rows as root nodes.

Basically the virtual load has only the grid items shown on screen in memory, and sends events to load and unload data as you scroll in the y direction. So instead of taking all the time in the beginning it distributes the loading time. This will be a good option if your load has a small start up penalty and can deliver small amounts of data fast, but delivers large amounts of data slowly.

 

10596 : Deleting a link

Question

We are evaluating your phGantTimePackage and we have a doubt: we want to delete a link made between 2 tasks. We’ve used the addLink method, but we have a problem when we try to delete the link. We saw a code example in your web and tried to follow it, but we encountered a problem with the types that the method GetLinks returns.

The code line is: “If ((Not alink.LinkOwner Is Nothing) And (Not alink.LinkedTo Is Nothing)) Then” and the error is: ‘the object doesn’t admit this method’.

The complete code is:

Dim alink As IphDataEntity_Link
  For i = 0 To theGant.GetLinks.Count() – 1
    Set alink = theGant.GetLinks.Items(i)
    If Not alink Is Nothing Then
      If ((Not alink.LinkOwner Is Nothing) And (Not alink.LinkedTo Is Nothing)) Then
        If (alink.LinkOwner = SomeObject of type ‘phGantXControl.IphDataEntity_GantTime’) Or (alink.LinkedTo = = SomeObject of type     ‘phGantXControl.IphDataEntity_GantTime’) Then
        End If

What is wrong? Is there any method similar to addLink for delete a link?

Answer

When you have the link object you can delete it like this:

theGant.GetLinks.Remove(alink);
or theGant.GetLinks.Delete(i);

10529 : I want to set the time format on the timeline in phGantXControl.ocx.

Question

I want to set the time format on the timeline in phGantXControl.ocx.

How I can set a time format like this?

06:31:00 PM

I see that I should use the TimeFormat property, but I don’t know how I can map the ‘:’ separator and the A.M./P.M. indicator.

Answer

We use the DateTimeFormat provided by Borland. You can use DateFormat and TimeFormat properties. This is the definition:

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

c                    Displays the date using the format given by the ShortDateFormat global variable, followed by the time using the format given by the LongTimeFormat global variable. The time is not displayed if the date-time value indicates midnight precisely.

d                    Displays the day as a number without a leading zero (1-31).

dd                  Displays the day as a number with a leading zero (01-31).

ddd                Displays the day as an abbreviation (Sun-Sat) using the strings given by the ShortDayNames global variable.

dddd              Displays the day as a full name (Sunday-Saturday) using the strings given by the LongDayNames global variable.

ddddd            Displays the date using the format given by the ShortDateFormat global variable.

dddddd          Displays the date using the format given by the LongDateFormat global variable.

e                    (Windows only) Displays the year in the current period/era as a number without a leading zero (Japanese, Korean and Taiwanese locales only).

ee                  (Windows only) Displays the year in the current period/era as a number with a leading zero (Japanese, Korean and Taiwanese locales only).

g                    (Windows only) Displays the period/era as an abbreviation (Japanese and Taiwanese locales only).

gg                  (Windows only) Displays the period/era as a full name. (Japanese and Taiwanese locales only).

m                   Displays the month as a number without a leading zero (1-12). If the m specifier immediately follows an h or hh specifier, the minute rather than the month is displayed.

mm                Displays the month as a number with a leading zero (01-12). If the mm specifier immediately follows an h or hh specifier, the minute rather than the month is displayed.

mmm              Displays the month as an abbreviation (Jan-Dec) using the strings given by the ShortMonthNames global variable.

mmmm           Displays the month as a full name (January-December) using the strings given by the LongMonthNames global variable.

yy                  Displays the year as a two-digit number (00-99).

yyyy               Displays the year as a four-digit number (0000-9999).

h                    Displays the hour without a leading zero (0-23).

hh                  Displays the hour with a leading zero (00-23).

n                    Displays the minute without a leading zero (0-59).

nn                  Displays the minute with a leading zero (00-59).

s                    Displays the second without a leading zero (0-59).

ss                   Displays the second with a leading zero (00-59).

z                    Displays the millisecond without a leading zero (0-999).

zzz                 Displays the millisecond with a leading zero (000-999).

t                     Displays the time using the format given by the ShortTimeFormat global variable.

tt                    Displays the time using the format given by the LongTimeFormat global variable.

am/pm            Uses the 12-hour clock for the preceding h or hh specifier, and displays ‘am’ for any hour before noon, and ‘pm’ for any hour after noon. The am/pm specifier can use lower, upper, or mixed case, and the result is displayed accordingly.

a/p                 Uses the 12-hour clock for the preceding h or hh specifier, and displays ‘a’ for any hour before noon, and ‘p’ for any hour after noon. The a/p specifier can use lower, upper, or mixed case, and the result is displayed accordingly.

ampm             Uses the 12-hour clock for the preceding h or hh specifier, and displays the contents of the TimeAMString global variable for any hour before noon, and the contents of the TimePMString global variable for any hour after noon.

/                     Displays the date separator character given by the DateSeparator global variable.

:                     Displays the time separator character given by the TimeSeparator global variable.

‘xx’/”xx”          Characters enclosed in single or double quotes are displayed as-is, and do not affect formatting.