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