Question
Category Archives: phGantTimePackage FAQ
10204 : Can we read the rect of a gantt row?
Question
Can we read the rect of a gantt row?
Answer
private void axphGantX1_OnHintInfo(object sender,
AxphGantXControl.IphGantXEvents_OnHintInfoEvent e)
{
labelHint.Text=”Starts”+e.theStart.ToString()+” and This
long:”+e.theLength.ToString();
}
Use the e.theStart and e.theLength parameters to get the would be time/length if the user were to drop now.
10203 : How can we set the text alignment of the grid cells?
Question
How can we set the text alignment of the grid cells?
Answer
Define a layout property and use it on cells
fGLP:=phGantXLP.GridLayoutProp(0);
fGLP.HorzAlignRight:=TRUE;
phGantXLP.SetGridCellLayoutPropIndex(x,y,0);
10188 : Differences between phGantTimePackage COM and VCL
Question
We are looking at your phGantTimePackage Evaluation COM edition and VCL edition.
Are the two products the same in terms of functionality?
Do we have to choose one or the other – or are both available in same license?
Is source code available?
Answer
The phGantTimePackage VCL and COM has one source. The COM edition has COM wrapping code around it, and does not expose all the functionality of the VCL source. However the COM version is better documented because it has a bigger and more demanding audience.
All in all the functionality is more or less the same. The VCL version in D7 integrates into the BOLD framework and that really rocks! (Bold came with Delphi7 Architect version and is the best MDA framework in the world, in Delphi2005 the guys that made Bold made ECOII and is a strong contender for the title of the best MDA framework in the world)
The VCL version is rather detailed in its object model (almost as detailed as GTP.NET the .NET Gantt ).
If you license the source you can build the OCX from it, using Delphi7 or Delphi2005, and use it as VCL components, with or without BOLD
10184 : How to select the item (row) in the grid that corresponds to an item in the gantt area that is selected ? (i.e in the same row)
Question
How to select the item (row) in the grid that corresponds to an item in the gantt area that is selected ? (i.e in the same row)
Answer
In GTP.NET you implement the event Gantt.OnTimeItem_SelectionChanged and put some code there like:
if (e.TimeItem.Selected)
Gantt.Grid.GridStructure.FocusedCell=e.TimeItem.GanttRow.GridNode.GetCell(0);
In phGantTimePackage the event is called IphGantX3.OnSelectionChangedGantTime, and the code would look like this
if (theDataEntity.Selected)
IphGantX3.GridCellFocusedY=(theDataEntity.Row.TreeNode as IphDataEntity_Tree3).GridRowIndex;
10198 : How can the font color of the GantTime objects be set?
Question
How can the font color of the GantTime objects be set?
Answer
– phGantX.TimeItemTextFont1 to …3 and phGantX.TimeItemTextFont1Color to
…3Color
Define these fonts and then use them in this method:
IphDataEntity_GantTime2.TimeItemsTextSet
index integer
Value String
X integer
Y integer
FontIndex integer <—- HERE
Description
Sets text on a single time item.
10201 : Turn off the tooltip to be displayed on my Schema control
Question
I dont want the tooltip to be displayed on my Schema control. How do I do this. Note that if I do not set the text for the time using the .AddText(), then the blank tooptip comes. I simply want to disable any tooltip whatsoever on the control
Answer
There is a property called ShowBigONOFF on the phSchema, set this to
FALSE…
10195 : How do I call PrintToHDC from C#?
Question
How do I call PrintToHDC from C#? The first argument asks for “aHDC” which
I don’t know what it is?
Answer
aHdc=(int)e.Graphics.GetHdc().ToInt32();
uw=0;
uh=0;
axphSchemaX1.PrintToHdc(aHdc,0,0,200,20,aScale,aScale,aStartCol,axphSchemaX1.Columns().Count()-1, axphSchemaX1.ScalerStart, axphSchemaX1.ScalerStop,axphSchemaX1.FlipView,ref uw,ref uh);
e.Graphics.ReleaseHdc((System.IntPtr)aHdc);
Note: PrintToDefault grabs the Device Context Handle (hdc) from the windows deault
printer and then uses PrintToHDC
10181 : Can the tree node be uniquely identified in PhGantt? How to disable node name change?
Question
Can the tree node be uniquely identified in phGantt? How to disable node name change?
Answer
You can use the UserReference or UserIntegerReference of IphDataEntity to put a unique key in.
And you can stop editing of a particular cell by implementing IphGantX3.OnBeforeCanEditGrid and set the theDataEntity.CanEdit=false
10194 : OnValueChangedGrid, I want to overide the new date value with my own default date.
Question
On my gant chart I have 4 columns setup, two of which are of type tekDate. Inside the OnValueChangedGrid event I am checking the value of the date that the user just modified. If the new value is not a valid date (based on my applications business rules) I want to overide the new date value with my own default date.
Answer
the value will be set in the cell after the event is called
so no matter what you do the cell inside the event will matter. However the
newValue string is a string pointer so you can change it inside the event
try this:
procedure TForm1.phGantXColsValueChangedGrid(Sender: TObject;
const theGant: IphGantX3; const theDataEntity: IphDataEntity_Tree2; X,
Y: Integer; var newValue: WideString);
begin
newValue:=’This Value’;
end;
or in your case:
if (e.newValue is not Valid)
{
e.newValue = defaultDate.ToString();
}