10193 : Gantt will not refresh, and some callback events Like OnPrintToHdcNewPage will not fire in Microsoft Visual FoxPro

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

10179 : How do I retrieve the current width of a column?

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..

10169 : I am 3.0 license holder of phganttimepackage. I need to download the 3.2 which this site says is free for 3.0 license. can you guide me please

Question

I am 3.0 license holder of phganttimepackage. I need to download the 3.2 which this site says is free for 3.0 license. can you guide me please

Answer

If you only need the latest ocx you can always find it here: https://plexityhide.com/pub/phGantXControl.zip

If you need the latest built install (help files and samples) you find it here: https://plexityhide.com/pub/phTimePack30COM.exe (but you probably have this already)

For VCL developers you can find the latest patch here https://plexityhide.com/pub/d7dcu.zip or here https://plexityhide.com/pub/d2005dcu.zip

10172 : Can you help me, to disable any drag or change time in the gantt area.

Question

Can you help me, to disable any drag  or change time in the gant area. I want to give the editing outside the phgant. I don’t want the users to edit the time or the row of the Gantt.

Answer

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

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

In the GTP.NET 2.0 you have even better control; you set properties on the TimeItemLayout:

 AllowChangeRow  Limits the degrees of freedom available to user 
 AllowLinkReAssignStart  Controls if link re-assign can be done for the start of a link 
 AllowLinkReAssignTarget  Controls if link re-assign can be done for the target of a link 
 AllowLinkSelectionStart  Controls if link selection can be done for the start of a link 
 AllowLinkSelectionTarget  Controls if link selection can be done for the targer of a link 
 AllowMove  Limits the degrees of freedom available to user 
 AllowResizeEast  Limits the degrees of freedom available to user 
 AllowResizeWest  Limits the degrees of freedom available to user 

10168 : I would like to modify the properties of time items once they have been displayed.

Question

I am using your Gant Time Package, and I would like to modify the properties of time items once they have been displayed. I could not find how to get one, even when giving them a UserIntegerReference.
Could you please tell me how to get a reference to these items.

Thank you.

Answer

The object model of the phGantTimePackage has tree nodes, gantt rows, layers and time items. To successfully navigate thru these items you will be helped by this complete iteration sample:

private void buttonIterate_Click(object sender, System.EventArgs e)

{

  // Iterate everything in the Gantt; Add an X to each tree node and move each time one day…

 

// Tree items

 

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

  {
    phGantXControl.IphDataList aList=axphGantX1.DataEntityList2LevTree.get_DataList(i);
   

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

    {
      phGantXControl.IphDataEntity_Tree2 aTreeItem=aList.get_Items(ii)

as phGantXControl.IphDataEntity_Tree2;

      aTreeItem.Text=aTreeItem.Text+”x”;
     

for(int iii=0;iii<aTreeItem.GantRow.DataLists.Count();iii++)

      {
        phGantXControl.IphDataList aDrawingLayer=aTreeItem.GantRow.DataLists.get_DataList(iii);
       

for(int iiii=0;iiii<aDrawingLayer.Count();iiii++)

        {
          phGantXControl.IphDataEntity_GantTime2 aGT=aDrawingLayer.get_Items(iiii)

as phGantXControl.IphDataEntity_GantTime2;

        }
      }
    }
  }
 

// 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);
      }
    }
  }

        }

10160 : How can I fill a comboBox for a Column?

Question

I must provide custom values from DB to a grid columm, so my users can choose one. This list can change over time.
VCL edition.
Thanks.

Answer

The inplace-edit-combobox often must have different values depending on what column or row it pops up.

There is an event that fires just before the edit starts. In this event you may change the content in the combobox depending on focused cell.

In the phGantTimePackage OCX this event is called IphGantX3.OnBeforeCanEditGrid
You the call IphGantX3.GridEditComboClear and IphGantX3.GridEditComboAdd

In the phGantTimePackage VCL this event is called phGant.Grid.OnEditorCanModify, but there is another event that only fires when a combo edit is started: phGant.Grid.OnBeforeEditWithCombo.
You can then use phGant.Grid.InitEditCombo to update values

In GTP.NET the event is called Gantt.Grid.OnBeforeEditCell, and you can fill the combobox with data like this:

private void grid1_OnBeforeEditCell(PlexityHide.GTP.Grid grid, PlexityHide.GTP.BeforeEditEventArgs beforeEdit)
{

  if (beforeEdit.Cell.Content is ComboText)
  {
    (beforeEdit.Cell.Content as ComboText).EditBox.Items.Clear();
    (beforeEdit.Cell.Content as ComboText).EditBox.Items.Add(“Item 1”);
    (beforeEdit.Cell.Content as ComboText).EditBox.Items.Add(“Item 2”);
    (beforeEdit.Cell.Content as ComboText).EditBox.Items.Add(“Item 3”);
    (beforeEdit.Cell.Content as ComboText).EditBox.Items.Add(“Item 4”);
  }

}

 

10151 : I cant get any image (using ImageIndex) to appear in all phGantX tree nodes in Windows XP

Question

I am not sure if this is happening to anyone else I cant get any image (using ImageIndex)  to appear in all phGantX tree nodes in Windows XP and Windows 2003 Server. I ran sample VB ( Samples\ActiveX\VB6\GanttWithGrid ) to confirm this.

Please advise. Thanks.

Answer

This is probably not an issue of the phGantTimePackage but an imagelist problem.
The imagelist is part of the comctrl.ocx and this component has caused a lot of confusion on XP. The original comctrl32.dll that came with XP was not compatible with older versions and broke many applications. I think you should examine what version of the comctrl32.dll you are using and try to upgrade your XP machine to the latest version.

Microsoft issued a fix for the comctrl32.dll.

They describe the problem here (I hate pasting microsoft links into the KB, have you noticed how often they change their links just to break other peoples references, anyway here goes):

http://support.microsoft.com/default.aspx?kbid=811415

This is what they wrote so that you can use google to find the article if (when) the link above is broken…


SYMPTOMS

You can use SendMessage to get the image handle from various controls in Microsoft Windows Common Controls 6.0 (Mscomctl.ocx). By using SendMessage, you can pass TB_GETIMAGELIST, LVM_GETIMAGELIST, TVM_GETIMAGELIST, or TCM_GETIMAGELIST to get the imagelist handle for the Toolbar, ListView, TreeView, and TabStrip controls.

However, when you do this on a computer running Windows XP, the wrong handle is returned. If you call any other APIs, and then pass this handle, those API calls will not function correctly.

CAUSE

This problem occurs because Windows XP and Mscomctl.ocx load two different versions of Comctl32.dll that are not compatible.

RESOLUTION

A supported fix is now available from Microsoft, but it is only intended to correct the problem described in this article. Only apply it to systems that are experiencing this specific problem. This fix may receive additional testing to further ensure product quality. Therefore, if you are not severely affected by this problem, Microsoft recommends that you wait for the next Visual Studio 6.0 service pack that contains this fix.


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

10149 : How can i get a notification every time the user change a row value? phGant

Question

How can i get a notification every time the user change a row value?

I have 3 columns in a gantt grid, two of them are start and stop (tckDate) for the time entity. But i need to reflect changes made in those columns visualy in the time entity, but i can find an event for the task. Thank you very much.

Answer

In the ActiveX you have the event IphGantX3.OnValueChangedGrid that is triggered whenever a new value is applied to the cell.

In VCL this event corresponds to the phGant.Grid.OnEditStop event.

10148 : How can i set nil (null) parent to a node in phGantX?

Question

How can i set nil (null) parent to a node?

I can set a subnode with: activeNode.ChangeOwner(parentNode.SubDataList,0);

But how can i set the node with no parent at all?

Thanks a lot!

Answer

You can change the parent of a node to null, by adding it to the root list:

activeNode.ChangeOwner(IphGantX3.RootDataEntitiesTree,0);

or you can change the parent property directly;

IphDataEntity_Tree2.Parent=nil;