Cannot change cursor when mouse down in BCB6?

Cannot change cursor when mouse down in BCB6?

Post by Joso » Sun, 15 Jun 2003 14:49:10



Hi,
This program has only one line. I want to change the cursor when mousedown.
But it always change after the mouse up. How can I do it?
void __fastcall TForm1::FormMouseDown(TObject *Sender, TMouseButton Button,
      TShiftState Shift, int X, int Y)
{
   Cursor=crDrag;

Quote:}

Joson
 
 
 

Cannot change cursor when mouse down in BCB6?

Post by Junk Mai » Mon, 16 Jun 2003 08:47:18


This code works fine.  Make sure your not reseting the cursor anywhere else
in your code

//--------------------------------------------------------------------------
-
__fastcall TForm1::TForm1(TComponent* Owner)
  : TForm(Owner)
{

Quote:}

//--------------------------------------------------------------------------
-

void __fastcall TForm1::FormMouseDown(TObject *Sender, TMouseButton Button,
      TShiftState Shift, int X, int Y)
{
  Cursor = crDrag;

Quote:}

//--------------------------------------------------------------------------
-

 
 
 

Cannot change cursor when mouse down in BCB6?

Post by Hans Galem » Mon, 16 Jun 2003 15:08:20



> This code works fine.

Not for me with bcb3 and bcb5.

Hans.

 
 
 

Cannot change cursor when mouse down in BCB6?

Post by Joso » Mon, 16 Jun 2003 15:23:03


But this is the only one line in my program. I am using WindowsXp.


Quote:> This code works fine.  Make sure your not reseting the cursor anywhere
else
> in your code

//--------------------------------------------------------------------------
Quote:> -
> __fastcall TForm1::TForm1(TComponent* Owner)
>   : TForm(Owner)
> {
> }

//--------------------------------------------------------------------------
Quote:> -

> void __fastcall TForm1::FormMouseDown(TObject *Sender, TMouseButton
Button,
>       TShiftState Shift, int X, int Y)
> {
>   Cursor = crDrag;
> }

//--------------------------------------------------------------------------
Quote:> -

 
 
 

Cannot change cursor when mouse down in BCB6?

Post by Junk Mai » Tue, 17 Jun 2003 04:48:36


I'm using BCB 5.0 enterprise on a XP machine.  I'm not sure what would be
causing your problem...maybe try reinstalling BCB.  You say you click and
the cursor changes but when you mouse up the cursor goes back to normal?

My cursor goes back to normal when my mouse leaves the window but when the
mouse is on the form it is the correct cursor.  This is normal.

 
 
 

Cannot change cursor when mouse down in BCB6?

Post by Hans Galem » Tue, 17 Jun 2003 06:17:23



> I'm using BCB 5.0 enterprise on a XP machine.  I'm not sure what would be
> causing your problem...maybe try reinstalling BCB.

It is not my problem.

 > You say you click and

Quote:> the cursor changes but when you mouse up the cursor goes back to normal?

No. As long as the mouse is down the cursor won't change. This is what Joson
reported. He wanted the cursor to change immediately.

Quote:> My cursor goes back to normal when my mouse leaves the window but when the
> mouse is on the form it is the correct cursor.  

What is the correct cursor ? What is mouse is on the form ?

Please be a bit more exact. The cursor is the default cursor or the dragcursor
in this case. The mouse is down. Or the mouse is above the form.

Hans.

 
 
 

Cannot change cursor when mouse down in BCB6?

Post by Eudy Silv » Tue, 17 Jun 2003 07:45:21


It seems the form's cursor is not updated until you release
the mouse button. To verify this use

Cursor=crDrag;
MessageBeep(MB_OK);

in the FormMouseDown event handler and you'll hear the
'dong' immediately after pressing the mouse button, but
the cursor will only change after you release the button.
This is due to mouse capturing.

The easiest way to change the mouse cursor immediately is
to use
Screen->Cursor=crDrag;
in the FormMouseDown event handler. But this has a side
effect: the cursor will change for all controls on your form
(maybe not desirable).

A better way might be to use
Mouse->Capture = NULL;
Cursor = crDrag;

It works, but I'm not sure of what side effects this might
cause. Hopefully none :)

Eudy


> Hi,
> This program has only one line. I want to change the cursor when mousedown.
> But it always change after the mouse up. How can I do it?
> void __fastcall TForm1::FormMouseDown(TObject *Sender, TMouseButton Button,
>       TShiftState Shift, int X, int Y)
> {
>    Cursor=crDrag;
> }

> Joson

 
 
 

Cannot change cursor when mouse down in BCB6?

Post by Joso » Tue, 17 Jun 2003 23:40:05


Thank you. I have also found a method.
      HCURSOR hCurs;
      hCurs = LoadCursor(NULL, IDC_HAND);
      ::SetCursor(hCurs);
This works. But cursor changes back when mouse up. But this seems good to
me, I need not to chang it back manually.
Joson


> It seems the form's cursor is not updated until you release
> the mouse button. To verify this use

> Cursor=crDrag;
> MessageBeep(MB_OK);

> in the FormMouseDown event handler and you'll hear the
> 'dong' immediately after pressing the mouse button, but
> the cursor will only change after you release the button.
> This is due to mouse capturing.

> The easiest way to change the mouse cursor immediately is
> to use
> Screen->Cursor=crDrag;
> in the FormMouseDown event handler. But this has a side
> effect: the cursor will change for all controls on your form
> (maybe not desirable).

> A better way might be to use
> Mouse->Capture = NULL;
> Cursor = crDrag;

> It works, but I'm not sure of what side effects this might
> cause. Hopefully none :)

> Eudy


> > Hi,
> > This program has only one line. I want to change the cursor when
mousedown.
> > But it always change after the mouse up. How can I do it?
> > void __fastcall TForm1::FormMouseDown(TObject *Sender, TMouseButton
Button,
> >       TShiftState Shift, int X, int Y)
> > {
> >    Cursor=crDrag;
> > }

> > Joson

 
 
 

Cannot change cursor when mouse down in BCB6?

Post by Junk Mai » Fri, 20 Jun 2003 07:40:36


Try Using Application->ProcessMessages() after you set the cursor.

---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.490 / Virus Database: 289 - Release Date: 6/16/2003

 
 
 

1. Cannot change Cursor of TScrollingWinControl

My class has inherited from TScrollingWinControl.

I want to see coordinate of mouse pointer outside my window.
To do this I use SetCaptureControl(this)

Problem:

When left button of mouse is pressed I cannot change cursor of my control
TScrollingWinControl->Cursor

Cursor may be changed if SetCaptureControl(NULL);

How can I change cursor if SetCaptureControl(this)...

Help me! People!

Master Bo.

Sorry for my English.

2. quick check on what site looks like..please

3. Why the cursor cannot be changed?

4. stereoscopic 3D coding, where to start?

5. Help: changing appearance of mouse cursor

6. Problem with Canvas->Polygon() in BCB4

7. Cursor problems with BCB6...

8. which scanner to buy??

9. No graphics update and mouse response under BCB6 and Win-XP

10. Repaint events, refreshing controls -- anything changed in BCB6 ??

11. mouse slow down runnig 3ds4 under win95

12. Mouse slow down

13. can't render OpenGL scene while mouse button is down