cnvcl hexedit的bug?
程序运行过程中,动态更新hexedit的内容,如果原来的hexedit内容只有一行,但是更新的内容超过两行,那么第二行不会自动显示出来。是我用的不对么?还是hexedit的bug?
void TForm1::UpdateHexedtContent(void)
{
UINT8 ucSndDat[1024];
UINT32 udwFrmLen = 0,udwIndex;
//Frm TAG
ucSndDat[udwFrmLen++] = 0x12;
//FRM Len.Current is fake valie
ucSndDat[udwFrmLen++] = 0;
//FT + CR + TD
ucSndDat[udwFrmLen++] = cbbFT->ItemIndex;
ucSndDat[udwFrmLen++] = cbbCR->ItemIndex;
ucSndDat[udwFrmLen++] = cbbTD->ItemIndex;
if(cbbFT->ItemIndex == 3) //It is ftResp, add ftResp Result field
{
ucSndDat[udwFrmLen++] = 0; //Resp OK
}
else if(cbbFT->ItemIndex == 1) //It is ftLog, add log into the frm buffer
{
UINT32 dwTextLen = edtLog->GetTextLen();
UINT8 *pucTextBuffer = new UINT8 [dwTextLen + 1];
edtLog->GetTextBuf(pucTextBuffer,dwTextLen + 1);
for(udwIndex = 0;udwIndex < dwTextLen;udwIndex++)
{
ucSndDat[udwFrmLen++] = pucTextBuffer[udwIndex];
}
delete [] pucTextBuffer;
ucSndDat[udwFrmLen++] = '\0';
}
//Update the real FRM-LEN field
ucSndDat[1] = udwFrmLen;
//Calculate the CRC
ucSndDat[udwFrmLen++] = CMN_GetCRC(&ucSndDat[1],udwFrmLen - 2); //When cal CRC, the FT-TAG and CRC should be discard,so CAL-CRC-LEN is frame len - 2
//Set buffer to the HexEdt's TMemoryStream
//**************************
//如果原来的内容是一行,但是此处ucSndDat的长度超过1行,那么第二行的内容不会自动刷出来。
//*****************************
hxedtDat->MemoryStream->Clear();
hxedtDat->MemoryStream->WriteBuffer(ucSndDat,udwFrmLen);
hxedtDat->Repaint();
}
|