Link to home
Start Free TrialLog in
Avatar of jpdupont
jpdupont

asked on

How to modify the caret width/height in a edit control.

I want to modify the caret width/height in a edit control.

I found "CreateCaret" and "ShowCaret" in the WinAPI.Hlp
I tried to play with these functions but I get the old caret.

- I want to know where and how call the procs.
- How work with a "bitmap " to create the caret ?

Some sample code would be very helpful.
ASKER CERTIFIED SOLUTION
Avatar of ronit051397
ronit051397

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of jpdupont
jpdupont

ASKER

Sorry, the code don't work ...
I paste your code on my form.

(FBitmap : HBitmap ?)

The bitmap is drawned on the edit. The old caret is also there.
The bitmap disapear when the edit is redrawn (type some text in).

I try without bitmap (with a 10x10 caret).
Same problem.
Add the following to the code:

procedure TForm1.Edit2Change(Sender: TObject);
begin
  FBitmap:=LoadBitmap(0,MAKEINTRESOURCE(OBM_RGARROW ));
  CreateCaret(Edit2.Handle, FBitmap,                      GetSystemMetrics(SM_CXBORDER),GetSystemMetrics(SM_CYBORDER));
  ShowCaret(Edit2.handle);
end;

Have you try the code you send ;) ?

Exactly the same effect :
The code don't work.

JP
Yes, I tried. Post your EMail and I'll send it to you.
I tested it in Delphi 3, WinNT4.
Ronit,

I'm using D3.02, Win95.
jpdupont@skynet.be

Thanks for the help !

The sample code work.
But I get some flicker when using the edit with new caret
(I tried no bitmap caret).
Probably there is an other way to do the work.
Thank for help.