PDA

View Full Version : Exceptions with zero height page


Unregistered
October 25, 2002, 15:23:51
Hi,

I've set the page height to zero (I didn't mean this, it was actually my mistake) and the control had accepted this. I could then insert some text and it was OK as long as it fit on the page (probably of height before change). But when I instered some text which forced the control to create a new page, it crashed with unrecoverable exception.

Regards,
Cezariusz Marek


This message was originally posted by Cezariusz Marek in the old TX Text Control Support Forum.

Björn Meyer
October 25, 2002, 15:49:19
Hello Marek

I tried to reproduce this issue, but unfortunately without success. I have simply created a TX Text Control on a form and set the page size to 0 (which is default). I have typed some text up to the end of the visible control area (BTW: If the page size is not set, the control doesn't work page oriented). It is not possible to enter more text which is intented, but I am not able to reproduce a crash of the control. Do you have a sample which shows me the problem?

Thank you very much for your help.

Björn Meyer, TX Text Control
bjoern@textcontrol.com


This message was originally posted by Björn Meyer in the old TX Text Control Support Forum.

Unregistered
October 28, 2002, 13:00:26
Hello,

I cannot send you a sample right now, because TX control is used in our report engine. But the sequence, extracted from the source, is like this:

m_TextControl.LoadFile(strFileName);
CRect rcMargins;
m_TextControl.GetDocumentMargins(rcMargins);
if (!rcMargins.IsRectNull() && (rcMargins != CRect(-1, -1, -1, -1)))
{
m_TextControl.SetPageMargins(rcMargins);
}
CSize szPage;
m_TextControl.GetDocumentPageSize(szPage);
if (szPage != CSize(0, 0))
{
CSize areaSize(szPage.cx - rcMargins.left - rcMargins.right,
szPage.cy - rcMargins.top - rcMargins.bottom);
m_TextControl.SetPageSize(areaSize, TF_PAGEVIEW, TF_NOHSCROLL | TF_NOVSCROLL);
}

In a previous version I've made a mistake, and area size was calculated like this:

CSize areaSize = (szPage.cx - rcMargins.left - rcMargins.right,
szPage.cy - rcMargins.top - rcMargins.bottom);

so it was equal to:

CSize areaSize(szPage.cx - rcMargins.left - rcMargins.right, 0);

Then engine fills marked field with data:

int nFieldCurrent = m_TextControl.FieldGetNext(0, 0);
CString strData;
while (nFieldCurrent)
{
m_TextControl.FieldGetData(nFieldCurrent, strData);
if (strData == strFieldName)
{
if (m_TextControl.FieldChangeText(nFieldCurrent, strValue))
{
bRet = TRUE;
}
}
nFieldCurrent = m_TextControl.FieldGetNext(0, nFieldCurrent);
}

One of FieldChangeText call caused GPF, probably the one which moved some text to a new page.

I can send you executable demo of this error, but I cannot send you the whole source code.

Cezariusz Marek


This message was originally posted by Cezariusz Marek in the old TX Text Control Support Forum.