10409 : Printing size

Question

I am wrestling with the parameters for printing the gantt chart.  I am trying to print on a 11 x 17 inch printer.  It prints in landscape mode correctly, but i want the image to take up the whole page.  Its stopping at about 7.5 inches horizontally.  Can u provide an example of how do to this?  Here is the code i am using:

LOCAL w as  long,h as long
w=0
h=0

thisform.gant1.printToDefault(1, 150, 5, 5,;
        thisform.gant1.treeWidth,;                          
        thisform.Gant1.TopItemTree, -1, .f., ;
        thisform.Gant1.Start , ;
        thisform.Gant1.Stop  ,; 
        thisform.gant1.getScaleLen,;
        thisform.gant1.scalerHeight, @w, @h)  

Answer

The Gantt works on pixels and you need to convert your inches from the printer to points or pixels. This is done by asking the printer for its resolution (this is standard windows but different in most environments).

Once you know how many pixels you want to fill you have two choices…
1. Use the available space in scale 1 to 1 that probably gives you very small time items on paper: To do this you would provide values for treewidth and ScaleLen that covers the available number of pixels.
or
2. Keeping the Treewidth and Scalelength more or less the same as on screen but calculate a scaling factor to use to fill the space: To do this you would go like this scale=PrinterPixelsInTheXDirection/(treeWidth+ScaleLen) and then use the scale in the PrintToDefault ( where you now use the value 5)

 

10393 : Is it possible to freeze a time items X position already during the drag event?

Question

We already implemented that TimeItems can only be dragged and dropped vertically: That is, when you drag it in a diagonal direction, then , the moves horizontally to the original position. Is it possible to freeze the its position already during the drag event?

Answer

In the phGantTimePackage this is not possible. This is due to the fact that you may want to allow for a time item being shifted horizontally when it is on the same row. (To fix this we would need to extend product with a callback method so that you can decide x and y coordinates during move, if you want to sponsor this development you should contact sales to get a cost estimate)

10359 : onDblClick Event in phSchema

Question

Hi,
how can I use the onDblClick Event in phSchema.
I would like to open a new window if i dblclick on an schematimeitem.

Answer

you can access the currently active SchemaTime (the latest clicked) with the ActiveDataEntity property:

  if Assigned(phSchema1.ActiveDataEntity) then
  begin
    phSchema1.RemoveSchemaTime(phSchema1.ActiveDataEntity);
  end;

Or you can use the info about clicked column and time:

var
  aphSchemaTime:TphDataEntity_SchemaTime;
begin
  if phSchema1.MouseDownColumn<>nil then
  begin
    aphSchemaTime:=phSchema1.AddSchemaTime(0);
    aphSchemaTime.Start:=phSchema1.MouseDownDateTime-1;
    aphSchemaTime.Stop:=phSchema1.MouseDownDateTime-1;
    aphSchemaTime.Col:=phSchema1.MouseDownColumn.ListIndex;
    aphSchemaTime.BackColor:=Random(65000);
  end;

 

10343 : Questions on Grid color and iterations

Question

I have 3 questions. I am using the phGant control in VB.

1. I want to color the background several rows in the grid, I ‘m using 4 columns in treegrid, how can I do this?

2. How can I edit the text in a time item?

3. How can I iterate through the timetems in the RootDataEntitiesTree and change the start from the timeitems, timeitems on the second level are unchanged

Thank you very much in advance.

Answer

To set seperate background colors in the grid you need to assign GridLayoutproperties to the cells. To declare GridLayoutProperties you go like this:

  phGantX1.GridLayoutPropAdd
  phGantX1.GridLayoutPropAdd
  phGantX1.GridLayoutPropAdd
 
  phGantX1.GridLayoutPropSet 0, ColorConstants.vbYellow, ColorConstants.vbBlack, “Helvetica”, 8, 20, 20, False, True, False, True, False
  phGantX1.GridLayoutPropSet 1, ColorConstants.vbRed, ColorConstants.vbBlack, “Helvetica”, 8, 20, 20, False, True, False, True, False
  phGantX1.GridLayoutPropSet 2, ColorConstants.vbBlue, ColorConstants.vbWhite, “Helvetica”, 8, 20, 20, False, True, False, True, False

And to use them on a specific cell you go can use the IphGantX3.SetGridCellLayoutPropIndex method.

2. There is currently no support to edit time item texts. If you need to you can bring up a dialog with an edit box. your would then use IphDataEntity_GantTime2.TimeItemsTextSet to update the text with the new value.

3. To iterate thru time items you go like this:

  // Another quicker way to get hold of all the time items

 

for(int i=0;i<axphGantX1.DataList3levGantTimes().Count();i++)

  {
    phGantXControl.IphDataList2lev aList2Lev=axphGantX1.DataList3levGantTimes().get_DataList2Lev(i);
   

for(int ii=0;ii<aList2Lev.Count();ii++)

    {
      phGantXControl.IphDataList aList=aList2Lev.get_DataList(ii);
     

for(int iii=0;iii<aList.Count();iii++)

      {
        phGantXControl.IphDataEntity_GantTime2 aGantTime=aList.get_Items(iii)

as phGantXControl.IphDataEntity_GantTime2;

        aGantTime.Start=aGantTime.Start.AddDays(1);
        aGantTime.Stop=aGantTime.Stop.AddDays(1);
      }
    }
  }

10335 : Gantt component on my XP 64 bit system.

Question

I purchased the Gantt Time Package ActiveX a few years ago and it is working wonderfully. However, I switched to a new development PC which is running Win XP x64. I cannot get the plexityHide gantt installation program to run on this OS so that I can continue to develop my app in VB 6. All my other 32 bit components install and run fine on this machine.

Can you suggest a way that I can install the Gantt component on my XP 64 bit system. I feel certain that the component itself will work fine on this machine. I think it is just a restriction on the setup program.

Answer

If you still have a 32-bit system with the installation you can simply move the files from the installation folder.

The only important registration that takes place during installation is the regsvr32.exe call on the ocx, so you must do that by hand.( at the run prompt write regsvr32 <path>/phGantTimePackage.ocx).

 

10237 : It is not possible to set the CanEdit-Property of ” IphDataEntity_SchemaTime” to False.

Question

It is not possible to set the CanEdit-Property of ” IphDataEntity_SchemaTime” to False. It is always True and therefore the Schematime can be moved every time?

Answer

If you implement this event IphSchemaX3.OnBeforeCanEditSchemaTime that is fired just before the edit starts on SchemaTime, you can set CanEdit=false on the SchemaTime in the argument, and stop editing.

10571 : Time items with a color gradient?

Question

what should I do that the time items appear in 3d? I mean to get a color gradient?

Answer

In GTP.NET you can set the TimeItemLayout this way:

ti1.TimeItemLayout=new TimeItemLayout();
ti1.TimeItemLayout.BrushKind=BrushKind.GradientDiagonal;
ti1.TimeItemLayout.Color=Color.YellowGreen;
ti1.TimeItemLayout.GradientColor=Color.Yellow;

In phGantTimePackage you can get a gradient effect doing like this:
time.Style = txTimeStyle.tsPipe;

10392 : Can you have horizontal lines across the Gantt chart? Our users do not want Pyjama alternative colours but have requested horizontal lines to distinguish rows.

Question

I posted a Question half a year ago:

Can you have horizontal lines across the Gantt chart? Our users do not want Pyjama alternative colours but have requested horizontal lines to distinguish rows.

The answer was: draw a line using GDI. We did this, but there are difficulties with printing. You have to make a (nonlinear) correction for vertical line distances for different rowheights, for the report to display the same as the monitor-gantt. Also big problems arise when you have different rowheights within one ganttchart.

The reason why many user prefer horizontal lines is clear: as a black/white print output it is clearer and saves ink.

Will you offer horizontal lines as a standardfeature in future, as an alternative to pyjamas?

Answer

Sure we could extend the API to allow for row separating lines, but if there are issues with positioning user drawn things when printing we would like to fix it. Chances are that there is some simple mistake in your current code. Can you send me a sample showing the problems you have with printing and positioning of your user drawn lines and I will take a look at it…

10350 : Different colors on days

Question

with the ActiveX version of the control hosted on a web page, is it possible through script to block out specific days on the gantt chart like making weekends a different color? If so, how.

Answer

If you embed the ocx on a web page you can choose to write VB- or JScript on that page that will access the Gantt on the client side. Since the access to win32 functions are often very restricted on the client side you will have a hard time accessing drawing functionality that is needed to use the Back- and Foreground events.

A better solution is to produce your own ActiveX that uses the phGantTimePackage and put all the extra drawing stuff in that ActiveX, the user will then accept your control for download or not.

To hide certain days from view your can simply call IphGantX3.SetHiddenHour and IphGantX3.SetHiddenDayType from VBScript or JScript.

10387 : Gantt for Delphi 7, how to use?

Question

Im evaluating a few gantt tools for use in Delphi7.
I need some documentation
Is there anyway to find out how to use your software?
I dont see anything anywhere!
Teechart is integrated with a data set
What mechanism do you provide to load records

Answer

The phGantTimePackage comes both as VCL components and as an ActiveX.
The vcl components is probably the best choice for you.
The phGantTimePackage does not support datasource couplings, so you need to use the API to populate the Gantt chart with data.
The activex version is better documented since it has had a bigger audience thru the years, but all of the stuff in the ActiveX package is achievable with the VCL version (and more).
I guess that you downloaded the VCL version, but I suggest that you also download the ActiveX version and look over the samples there too, just to get a better picture on what is doable (most samples are in VB6).
 
Once you download the VCL package (make sure you get the right version 2006 will only work in BDS2006 and D7 will only work in Delphi 7).
The zip files contain dcu files and pbl files. Extract the contents to a new folder where you normally keep your third party components.
Open Delphi.
Close any open project.
Choose Components | Install packages
Choose Add.. in the dialog and browse to your folder were you extracted the dcu’s and bpl’s and choose the pbl.
You should now see the phGant etc components in a new plexityHide tab.
 
You should add the search path to the extracted dcu’s in the Library path.
 
The dcu’s are used for linking with your application. The bpl files contain the compiled code for design time behaviour.