How to hide StiBarCode in code?
Posted: Tue Feb 19, 2013 4:11 pm
Hi,
I am creating a label report in code and want to hide an StiBarCode object if there is no data for the barcode. The StiBarCode object is added to an StiPanel object which has a condition that sets the Enabled property to false if a particular data field is null
e.g.
This works fine for the StiPanel and any other objects added to it (e.g. StiText and StiImage objects), apart from the StiBarCode object.
I have also tried to add a similar condition directly to the StiBarCode object, but that does not work either.
e.g.
How can I hide the barcode when the source data field is empty?
Thanks, Martin.
I am creating a label report in code and want to hide an StiBarCode object if there is no data for the barcode. The StiBarCode object is added to an StiPanel object which has a condition that sets the Enabled property to false if a particular data field is null
e.g.
Code: Select all
StiPanel objLabelArea = new StiPanel(new RectangleD(0, 0, Math.Round(LabelDefinition.Style.LabelStyle_LabelWidth, 2), Math.Round(LabelDefinition.Style.LabelStyle_LabelHeight, 2)));
objLabelArea.Name = "LabelArea";
objLabelArea.Conditions.Add(new StiCondition() { Column = strID, Condition = StiFilterCondition.EqualTo, DataType = StiFilterDataType.Expression, Value1 = "null", Enabled = false });
objDataBand.Components.Add(objLabelArea);
I have also tried to add a similar condition directly to the StiBarCode object, but that does not work either.
e.g.
Code: Select all
strFldName = "{" + String.Format("{0}.Barcode", LabelsView.Table.ToString()) + "}";
objBarcode = new StiBarCode(new RectangleD(x, y, w, h))
{
AutoScale = true,
BarCodeType = new StiCode39ExtBarCodeType(13F, 1F, 2.2F, StiCheckSum.No),
Code = new StiBarCodeExpression(strFldName),
HorAlignment = ReportHelper.AlignmentToStiAlignment(objItem.LabelItem_Alignment),
Name = strName
};
objBarcode.Conditions.Add(new StiCondition() { Column = strID, Condition = StiFilterCondition.EqualTo, DataType = StiFilterDataType.Expression, Value1 = "null", Enabled = false });
objLabelArea.Components.Add(objBarcode);
Thanks, Martin.