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);
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);
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
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;
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…
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.
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
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();
}
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
Question
The user can change the columns width of the grid and my application must remember that and to restore it when the user open the project again. I am using the property Width:
ph.GridColumn(0).Width
But it does not work, always it returns the initial width, not the modified
How do I retrieve the current width of a column?
Answer
To get to the current runtime width you must use this call:
Gantt.GridColumnGet(index: Integer; var title, editkind, Width, SortEnable: OleVariant);
Send in variant variables and they will get the value for the Title, the editkind, the current runtime width and if the Sortenable was set or not..
Question
Gantt will not refresh, and some callback events Like OnPrintToHdcNewPage will not fire in Microsoft Visual FoxPro
Answer
FoxPro has something that is called AutoYield. This is default set to TRUE
You MUST set it to FALSE when you expect or want callbacks like for UserDraw and Print new page etc:
Sample:
IF THISFORM.phGantX1.PrintSettingsDialog()
SET PRINTER TO THISFORM.phGantX1.PrintSettingsPrinterName
_VFP.AutoYield= .F.
THISFORM.phGantX1.PrintToDefault(3, 20, 6, 6, ;
THISFORM.phGantX1.TreeWidth, THISFORM.phGantX1.TopItemTree, -1, .T., {}, ;
DATE(), THISFORM.phGantX1.GetScaleLen, THISFORM.phGantX1.ScalerHeight,0,0)
ENDIF