l00ny
asked on
Change the blinking cursor of an DBEdit field
Hi,
does anyone know how to change the blinking cursor in a DBEdit field (within source code) ?
(I want to make the cursor larger).
Regards
l00ny
does anyone know how to change the blinking cursor in a DBEdit field (within source code) ?
(I want to make the cursor larger).
Regards
l00ny
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
This is a shorter code. When you click on Edit2 then it works OK, but when you enter Edit2 by TAB key, it doesn't work ok. Sorry, I couldn't solve it:
var
FBitmap: HBitmap;
.
procedure TForm1.FormCreate(Sender: TObject);
begin
FBitmap:=LoadBitmap(0,MAKE INTRESOURC E(OBM_RGAR ROW));
Edit2.OnEnter:=Edit2.OnCha nge;
Edit2.OnClick:=Edit2.OnCha nge;
end;
procedure TForm1.FormClose(Sender: TObject; var Action: TCloseAction);
begin
DestroyCaret;
DeleteObject(FBitmap);
end;
procedure TForm1.Edit2Change(Sender: TObject);
begin
CreateCaret(Edit2.Handle, FBitmap, GetSystemMetrics(SM_CXBORD ER),GetSys temMetrics (SM_CYBORD ER));
ShowCaret(Edit2.handle);
Edit2.Invalidate;
end;
var
FBitmap: HBitmap;
.
procedure TForm1.FormCreate(Sender: TObject);
begin
FBitmap:=LoadBitmap(0,MAKE
Edit2.OnEnter:=Edit2.OnCha
Edit2.OnClick:=Edit2.OnCha
end;
procedure TForm1.FormClose(Sender: TObject; var Action: TCloseAction);
begin
DestroyCaret;
DeleteObject(FBitmap);
end;
procedure TForm1.Edit2Change(Sender:
begin
CreateCaret(Edit2.Handle, FBitmap, GetSystemMetrics(SM_CXBORD
ShowCaret(Edit2.handle);
Edit2.Invalidate;
end;
ASKER
thanks for your answer.
I had to change some of your source code so I could implement a resource file.
But there is still one problem: When I click into Edit2 the old (default) cursor plus the new cursor is there. When I change the Edit2 field everything works fine.
Here is my source:
[...]
{$R CURSOR.RES}
procedure TForm1.Edit2Enter(Sender: TObject);
begin
FBitmap := LoadBitmap(Hinstance,'CURS
CreateCaret(Edit2.Handle, FBitmap,
GetSystemMetrics(SM_CXBORD
ShowCaret(Edit2.handle);
end;
procedure TForm1.Edit2Exit(Sender: TObject);
begin
DestroyCaret;
DeleteObject(FBitmap);
end;
procedure TForm1.FormClose(Sender: TObject; var Action: TCloseAction);
begin
DestroyCaret;
DeleteObject(FBitmap);
end;
procedure TForm1.Edit2Change(Sender:
begin
FBitmap := LoadBitmap(hinstance,'CURS
CreateCaret(Edit2.Handle, FBitmap,
GetSystemMetrics(SM_CXBORD
ShowCaret(Edit2.handle);
end;