Check for a null when getting checkoff information

Added logic to use the DropCheckoff flag which tell the code that the checkoff goes on last row of the text. (default should be first row of text)
This commit is contained in:
John Jenko 2011-12-12 20:00:27 +00:00
parent 904947bb08
commit 870aa7736e
2 changed files with 13 additions and 5 deletions

View File

@ -204,7 +204,7 @@ namespace Volian.Controls.Library
MyItemInfo.RefreshItemAnnotations();
ChangeBar = MyItemInfo.HasChangeBar;
CheckOff co = _MyItemInfo.GetCheckOffStep();
if (co != null)
if (co != null && co.UIMark != null)
{
UserCheckOff = true;
UserCheckOffChar = (char)co.UIMark;

View File

@ -937,7 +937,9 @@ namespace Volian.Print.Library
mytab.YOffset = yoff;
if (mytab.MyMacro != null) mytab.MyMacro.YOffset = yoff;
}
float yForCheckoff = 0;
float yForCheckoff = yoff; //0; - default checkoff row is same as FIRST line of text
// if dropCheckoff is true, then the checkoff is place on the same of row as the LAST line of text
bool dropCheckoff = itemInfo.ActiveFormat.PlantFormat.FormatData.ProcData.CheckOffData.DropCheckOff;
if (itemInfo.MyContent.MyGrid != null)
{
VlnFlexGrid myFlexGrid = new VlnFlexGrid(1,1);
@ -945,7 +947,9 @@ namespace Volian.Print.Library
MyGrid = new vlnTable(myFlexGrid, cb);
Height = MyGrid.Height;
Width = MyGrid.Width;
yForCheckoff = yoff + Height - SixLinesPerInch;
//yForCheckoff = yoff + Height - SixLinesPerInch;
if (dropCheckoff)
yForCheckoff += Height - SixLinesPerInch; // place checkoff on last row of text
yoff += (Height + (2 * SixLinesPerInch));
CalculateXOffset(itemInfo, maxRNO, formatInfo);
}
@ -969,7 +973,9 @@ namespace Volian.Print.Library
Width = Int32.Parse(vals[3], System.Globalization.NumberStyles.AllowHexSpecifier) * MyItemInfo.FormatStepData.Font.CharsToTwips;
int lines = Int32.Parse(vals[2], System.Globalization.NumberStyles.AllowHexSpecifier);
Height = lines * SixLinesPerInch;
yForCheckoff = yoff + Height - SixLinesPerInch;
//yForCheckoff = yoff + Height - SixLinesPerInch;
if (dropCheckoff)
yForCheckoff += Height - SixLinesPerInch; // place checkoff on last row of text
yoff += (Height + (2 * SixLinesPerInch));
string erMsg = null;
try
@ -1005,8 +1011,10 @@ namespace Volian.Print.Library
&& !MyItemInfo.MyDocStyle.SpecialStepsFoldout))
{
yoff += Height;
yForCheckoff = yoff - SixLinesPerInch;
//yForCheckoff = yoff - SixLinesPerInch;
yoff += AdjustForBlankLines();
if (dropCheckoff)
yForCheckoff += Height - SixLinesPerInch; // place checkoff on last row of text
}
}
CheckOff co = itemInfo.GetCheckOffStep();