I'm currently working on some software that takes input from a serial device and this is dropped into a TRichEdit box. This will work fine with plain text however the serial device in question also sends information regarding font size, colour etc.
I've check online and tried to implement what's being said and some of it is contradictory i.e. some say use Add() before SetAttributes and some say it should be after. However trying both methods nothing happens, the sample text is still in default.
This is my current test code outside of the main app as I try to get this, what I thought was simplistic, to work.
Example of what I get but this part is ok. The Serial Device will send
1D 21 11 (Sets the font size) 1D 42 01 (Sets alternate Colour on) 1D 42 00 (Sets alternate Colour off)
31 20 20 4d 45 41 4c 20 43 48 4f 49 43 45 2d 32 "1 MEAL CHOICE-2"
OK, sample code.
intOldStart = reReceiptData->GetTextLen();
asNewLine = "1 MEAL CHOICE-2";
reReceiptData->SelStart = intOldStart;
reReceiptData->SelLength = asNewLine.Length();
reReceiptData->SelAttributes->Color == clBlue;
reReceiptData->SelAttributes->Style == TFontStyles() >> fsBold;
reReceiptData->Lines->Add(asNewLine);
I've changed the order of this with Add() before and after the SelAttributes however I never get blue or bold text.