Link to home
Start Free TrialLog in
Avatar of jkb2
jkb2

asked on

Disappearing Cursor

I have a Timage that I want a user to click on to "drag" it to another area on the screen. I set the dragIcon of the TImage to csDrag and issue the BeginDrag in the MouseDown event for the TImage. When I press the mouse down, The Cursor Disappears never to appear again when it is over the Timage until I reset the program.

The Smaller TImage resides on top of another FormSize TImage.

Avatar of mheacock
mheacock

Have you tried resetting the icon back to default after the cursor has left the TImage?  Perhaps your DragIcon is
not set (perhaps set to nothing ,therefore invisible,
so check Mouse/Pointers in control panel).  Have you tried
this on any other systems?  I did a test and I can't reproduce
your problem, so I'm suspecting it is simply how you have
your system configured.
Avatar of jkb2

ASKER

I am a little confused...

It the cursor that is specified not defined by my program and not the system?

I looked at the mouse pointer's and see nothing about Drag/Drop.
Could you post all the code that relates to the TImage (events, etc.) as a comment?  I'll pick it up and check it out.
Avatar of jkb2

ASKER

var
  InOutImg   : Array[0..19] of TImage;

Procedure...

  InOutImg[Count].SetBounds(272,Left[Count],25,25);

Procedure Form1.FormCreate() ...{Normal Formcreate Proc Dec}

begin
 For x := 0 to 19 do
  begin
   InOutImg[x] := TImage.Create(Form1);
   InOutImg[x].Parent := Form1;
   InOutImg[x].Visible := True;
   InOutImg[x].DragCursor := crUpArrow;
   InOutImg[x].Stretch := True;
   InOutImg[x].OnMouseDown := Form1.InOutImgMouseDown;
   InOutImg[x].OnDragover := Form1.InoutImgDragOver;
   InOutImg[x].Name := 'InOut' + InttoStr(x);
   InOutImg[x].DragMode := dmManual;
   InOutImg[x].DragCursor := crDrag;
  end;
end;

procedure TForm1.InOutImgDragOver(Sender, Source: TObject; X, Y: Integer;
  State: TDragState; var Accept: Boolean);
begin

 Accept := True

end;

procedure TForm1.InOutImgMouseDown(Sender : TObject; Button: TMouseButton; Shift: TShiftState;
            X, Y: Integer);
Var
 MyVar : Integer;
begin
 MyVar := (Sender as Timage).Tag;
 If theComps[MyVar] = ComputerId Then   begin
   InOutImg[MyVar].DragIcon := CrDrag;
   InOutImg[MyVar].BeginDrag(True);
 end;
end;


A Little Explanation is in order. When I started this PGM, I was really into the ideas of dynamically creating these controls to save memory. I will be changing this once i get all of this working because there is really no true need for the dynamic creation (Do you Agree).

I am still wondering if the first thing that you stated don't have something to do with it. I don't have a "Drag/Drop" icon under the mouse pointer on my Control Panel.

Thanks.
I check your code out tonight.  About the Drag/Drop icon...neither do I...I answered without first checking the pointers...I just presumed.

As for the dynaimc creation...I do agree in this instance.  The only thing you are saving by going the dynamic allocation route for the TImages in hard drive space...your .EXE will be smaller.

I'll get back to you on this tonight.
I check your code out tonight.  About the Drag/Drop icon...neither do I...I answered without first checking the pointers...I just presumed.

As for the dynaimc creation...I do agree in this instance.  The only thing you are saving by going the dynamic allocation route for the TImages in hard drive space...your .EXE will be smaller.

I'll get back to you on this tonight.
I check your code out tonight.  About the Drag/Drop icon...neither do I...I answered without first checking the pointers...I just presumed.

As for the dynaimc creation...I do agree in this instance.  The only thing you are saving by going the dynamic allocation route for the TImages in hard drive space...your .EXE will be smaller.

I'll get back to you on this tonight.
soory about the multiple post...sometimes it is very hard to reconnect to the expert server and things appear to lock up...so I press reload...and things get sent again.
Well...I'll have to apologize...I tried your code and I couldn't reproduce your problem.  My guess is that it is how you have your system configured.

Another note though (this may or may not be a problem):  why are you setting the name property of your dynamic component?  This is might be affecting what is going on (though I would  guess that it isn't...but sometimes you never know)...you  should only change a components name at design-time...I know they are dynamic components, but you shoud still never start fiddling with the name component...it can cause all kinds of strange behaviour with Delphi...components not being freed from memory.

Anyhow, perhaps that will work...perhaps it won't.  Sorry.  I thought it would be easily reproducable with your code in hand.
Were you able to solve the problem?  If you weren't, you can reject my answer...maybe one of the other experts will be able to supply you with an answer.
Avatar of jkb2

ASKER

I am wanting to try a few things before I reject this if it's ok with you. I just haven't had time to try. I will get around to it in the next day or so.

Thanks for your patience.

No problem.
Avatar of jkb2

ASKER

Thanks for the assistance... Let's see if someone else has an answer...

I am convinced that it is a problem with my setup somewhere. I completly took out all of the dynamic creation of the components thinking that that might cause something to happen but to no avail.

The last test was to change the .Cursor property to crDrag and sure enough it is not showing up when I pass the mouse pointer over the component so...

The search continues...

Thanks again...
Do you use resource files?

If so, don't use resource IDs 32762..32767

Are you certain that the {$R *.DFM} is present where it should be?

Regards,

Erik
ASKER CERTIFIED SOLUTION
Avatar of alona041797
alona041797

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 jkb2

ASKER

Didn't do it. I have just found out that it's not just limited to my computer as I have made a setup and installed this program on another computer.

Avatar of jkb2

ASKER

Didn't do it. I have just found out that it's not just limited to my computer as I have made a setup and installed this program on another computer.