Solved

Disappearing Cursor

Posted on 1997-03-11
17
256 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
17 Comments
 
LVL 3

Expert Comment

by:mheacock
Comment Utility
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
Comment Utility
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
Comment Utility
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
 
LVL 1

Author Comment

by:jkb2
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
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
How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

 
LVL 3

Expert Comment

by:mheacock
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
No problem.
0
 
LVL 1

Author Comment

by:jkb2
Comment Utility
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
Comment Utility
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 100 total points
Comment Utility
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
Comment Utility
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
Comment Utility
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

Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

Join & Write a Comment

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…
Introduction Raise your hands if you were as upset with FireMonkey as I was when I discovered that there was no TListview.  I use TListView in almost all of my applications I've written, and I was not going to compromise by resorting to TStringGrid…
This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're looking for how to monitor bandwidth using netflow or packet s…
This video demonstrates how to create an example email signature rule for a department in a company using CodeTwo Exchange Rules. The signature will be inserted beneath users' latest emails in conversations and will be displayed in users' Sent Items…

771 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

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now