?
Solved

Disappearing Cursor

Posted on 1997-03-11
17
Medium Priority
?
271 Views
Last Modified: 2012-01-14
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.

0
Comment
Question by:jkb2
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
17 Comments
 
LVL 3

Expert Comment

by:mheacock
ID: 1334785
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.
0
 
LVL 1

Author Comment

by:jkb2
ID: 1334786
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.
0
 
LVL 3

Expert Comment

by:mheacock
ID: 1334787
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.
0
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!

 
LVL 1

Author Comment

by:jkb2
ID: 1334788
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.
0
 
LVL 3

Expert Comment

by:mheacock
ID: 1334789
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.
0
 
LVL 3

Expert Comment

by:mheacock
ID: 1334790
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.
0
 
LVL 3

Expert Comment

by:mheacock
ID: 1334791
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.
0
 
LVL 3

Expert Comment

by:mheacock
ID: 1334792
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.
0
 
LVL 3

Expert Comment

by:mheacock
ID: 1334793
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.
0
 
LVL 3

Expert Comment

by:mheacock
ID: 1334794
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.
0
 
LVL 1

Author Comment

by:jkb2
ID: 1334795
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.

0
 
LVL 3

Expert Comment

by:mheacock
ID: 1334796
No problem.
0
 
LVL 1

Author Comment

by:jkb2
ID: 1334797
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...
0
 
LVL 3

Expert Comment

by:sperling
ID: 1334798
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
0
 
LVL 2

Accepted Solution

by:
alona041797 earned 200 total points
ID: 1334799
Don't put BeginDrag in the OnMouseDown event,
instead set DragMode to Automatic, this should solve your problem.
0
 
LVL 1

Author Comment

by:jkb2
ID: 1334800
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.

0
 
LVL 1

Author Comment

by:jkb2
ID: 1334801
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.

0

Featured Post

Industry Leaders: 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!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The uses clause is one of those things that just tends to grow and grow. Most of the time this is in the main form, as it's from this form that all others are called. If you have a big application (including many forms), the uses clause in the in…
This article explains how to create forms/units independent of other forms/units object names in a delphi project. Have you ever created a form for user input in a Delphi project and then had the need to have that same form in a other Delphi proj…
In this video, Percona Solution Engineer Dimitri Vanoverbeke discusses why you want to use at least three nodes in a database cluster. To discuss how Percona Consulting can help with your design and architecture needs for your database and infras…
In this video, Percona Director of Solution Engineering Jon Tobin discusses the function and features of Percona Server for MongoDB. How Percona can help Percona can help you determine if Percona Server for MongoDB is the right solution for …
Suggested Courses

801 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question