=?ISO-8859-1?Q?Dar=EDo_Alejandro_Guzik?= <
XXXX@XXXXX.COM >wrote:
Quote
>[...] I would suggest that you use a TMemo
As it happens, I didn't know TMemo as well as I thought that
I did. When I tested it, even though I set WantReturns and
WordWrap to false, TMemo still formatted it's Lines based
on where they would wrap based on it's Width *and* this was
reflected in it's Text property as well (which is just a
getter anyway so that's not *that* surprising).
The result was a double vertical bar (||) where the lines were
breaking so I had to switch to a TEdit.
Quote
I just want to show some data, so multiline or not I will
make it show in 1 line that shows the right part of a text
if it doesn't fit on the viewable size.
You'll have to manage that yourself at runtime by subclassing
the TEdit's WindowProc method (you can also subclass the
control and either override it's WndProc *or* use a message
map):
// Add to the header
private:
TWndMethod OldWndProc;
void __fastcall NewWndProc( TMessage &Message );
public:
__fastcall ~TForm1();
// add to the unit
//-------------------------------------------------------------
__fastcall TForm1::TForm1(TComponent* Owner) : TForm(Owner)
{
OldWndProc = Edit1->WindowProc;
Edit1->WindowProc = NewWndProc;
}
//-------------------------------------------------------------
__fastcall TForm1::~TForm1()
{
Edit1->WindowProc = OldWndProc;
}
//-------------------------------------------------------------
void __fastcall TForm1::NewWndProc( TMessage &Message )
{
OldWndProc( Message );
if( Message.Msg == WM_PAINT )
{
TCanvas *pCanvas = new TCanvas;
pCanvas->Handle = ::GetDC( Edit1->Handle );
TRect R = Edit1->ClientRect;
pCanvas->FillRect( R );
::DrawText( pCanvas->Handle, Edit1->Text.c_str(), -1, &R, DT_SINGLELINE | DT_RIGHT );
::ReleaseDC( Edit1->Handle, pCanvas->Handle );
pCanvas->Handle = NULL;
delete pCanvas;
}
}
//-------------------------------------------------------------
~ JD