• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 200
  • Last Modified:

How to hide the cursor, part 2

Hi everybody,

A few hours ago I have asked how to hide my cursor on
the canvas of the component. Received some good solutions.
But after testing their are a few minor problems, that I hope
you can help me with it.

+ The cursor has to be hidden on startup.
+ When I hide the cursor and then show it again it blinks twice.

Could you PLEASE help me to find the faults!

The example on my site:http://members.home.nl/peterkiers/
(Underneath the Under Construction bar you see a floppy disk)

Greetings,

P.
0
peterkiers
Asked:
peterkiers
  • 5
  • 3
1 Solution
 
TheRealLokiSenior DeveloperCommented:
Have you tried setting form1.doublebuffered := true;
This might fix the blinking.
I haven't seen your solution, but in case it haasn't been said yet, you could create your own cursor, which just happens to be blank, and set that cursor as your componen'ts cursor
0
 
peterkiersAuthor Commented:
I have tried form1.doublebuffered := true, but the cursor still flickers twice.

P.
0
 
diniludCommented:
Check this

procedure TMainForm.ShowCursor1Click(Sender: TObject);
begin
 MyDrawingPanelx1.CursorFlashTimer.Enabled :=MyDrawingPanelx1.Blinking;
 MyDrawingPanelX1.CursorVisible:= True;
end;
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
peterkiersAuthor Commented:
Oke,

But when I turn on the cursor to blink in the Connect-Dialog screen
after pressing the connect-button the cursor starts blinking
and when i press menu-item Hide cursor the cursor doesn't dissapear

P.

0
 
peterkiersAuthor Commented:
Damn your good.

I'll be back in several hours because i have an exame to take.
But the purpose for my programm has to be this:

+at Startup the cursor has to be hidden
+When the user presses Show Cursor the cursor has to be showed (this is done)
+When the user presses Hide Cursor the cursor has to be hidden (this is done)
+When the user selects blinking cursor in the dialog-screen after pressing on
  the Connect-button the cursor will blink, but when the user click on hide cursor
  the cursor has to be hidden, and when the user again click on show cursor
 The cursor has to appear again blinking.

Peter.
0
 
diniludCommented:
this code is working for me.

procedure TMainForm.ShowCursor1Click(Sender: TObject);
begin
 MyDrawingPanelx1.CursorFlashTimer.Enabled :=MyDrawingPanelx1.Blinking;
 MyDrawingPanelX1.CursorVisible:= True;
end;

procedure TMainForm.HideCursor1Click(Sender: TObject);
begin
 MyDrawingPanelx1.CursorFlashTimer.Enabled :=False;
 MyDrawingPanelX1.CursorVisible:= False;
end;
0
 
peterkiersAuthor Commented:
Hi, dinilud.

I have tested the code and it works for me to.
Can you (before I award the points) PLEASE to that
with the option Cursor Type. Because when I choose
Cursortype BOX en then press Connect the cursor
appears as a box-shape, but when I press Hide Cursor
the cursor doesn't dissappear.

The blinking-part works great. Thank you...

Peter




0
 
diniludCommented:
Try this

(*-----------------------------------------------*)
procedure TMyDrawingPanelX.ClearCursor;
var
  xpos, ypos: integer;
begin
  if (Lastcursorx = -1) or (Lastcursory = -1) then exit;
  xpos := (Lastcursorx * FontWidthPix) - FontWidthPix;
  ypos := (Lastcursory * FontHeightPix) - 1;
  with Canvas do
  begin
    if csrShape = csrUnderLine then
    begin
      Pen.Mode := pmBlack;
      Pen.Color := ColorBlack;
      Brush.Style := bsSolid;
      Brush.Color := ColorBlack;
      MoveTo(xpos, ypos);
      LineTo(xpos + FontWidthPix, ypos);
    end
    else
    begin
      Pen.Mode := pmNotXor;    // < =   Chnage Here
      Pen.Color := ColorBlack;
      Brush.Style := bsSolid;
      Brush.Color := ColorBlack;
      Rectangle(xpos, ypos - FontHeightPix + 1, xpos + FontWidthPix, ypos);
    end;
  end;
end;
0
 
peterkiersAuthor Commented:
Yip, that's the answer, 500 p. comming your way...

Peter Kiers
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

  • 5
  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now