Please advise how to modify the text box (not the mouse cursor style)

Relevant information is not found, a bit is the mouse cursor style is Tmemo cursor, a text box to modify, I need it bold color etc.

In addition to ask, in the Tmemo newline, what method to have to let it highlighted, the purpose is to let the user directly know the existence of wrap.

Please Master advice.

Started by Rex at February 07, 2016 - 11:34 PM

Finally, you can use CreateCaret, ShowCaret to change the cursor, here I would like to ask, what need not to need to use DestroyCaret to release it?

I can see that, if not create HWND has focus, then DestroyCaret is invalid, that is to say, you cannot use DestroyCaret in when the window is closed, then it should do with?

Posted by Rex at February 13, 2016 - 12:10 AM

CreateCaret is required for every text box with the code, have to do is set to the mouse, keyboard operation, too cumbersome.

Ask how the text can directly replace the whole program frame cursor?

Posted by Rex at February 26, 2016 - 12:24 AM

Object oriented is used to doing, He inherited a text box TEdit or Tmemo is not on the line, what is the mouse and keyboard of different operations set what the write once

In addition, the newline character is what, can display the newline?

Posted by Demi at January 06, 2017 - 10:55 PM

LZ is also a veteran, playing program has more than 10 years, this question should be no problem

Posted by Demi at January 08, 2017 - 9:34 PM

If you inherited subclass is not or is too lazy, can use universal TApplicationEvents controls


var
caretBmp: TBitmap; // The cursor.

procedure TForm1.FormCreate(Sender: TObject);
begin
caretBmp := TBitmap.Create;
caretBmp.LoadFromFile('1.bmp');
end;

procedure TForm1.FormDestroy(Sender: TObject);
begin
caretBmp.Free;
end;

// Put a TApplicationEvents control, the OnMessage event processing

procedure TForm1.aplctnvnts1Message(var Msg: tagMSG; var Handled: Boolean);
var
i: Integer;
begin
if Msg.message = WM_PAINT then
begin
// Iterate through all the controls they set caret
for i := 0 to ControlCount - 1 do
begin
// TCustomEdit is Tmemo, Tedit... Etc. the parent class.
if Controls[i] is TCustomEdit then
begin
if DestroyCaret then
begin
// The caret cursor picture set logic dynamic own according to
CreateCaret(Msg.hwnd, caretBmp.Handle, 0, 0);
SetCaretPos(Msg.pt.X, Msg.pt.Y);
ShowCaret(Msg.hwnd);
end;
Break;
end;
end;
end;
end;

Posted by Demi at January 13, 2017 - 10:25 PM