We help IT Professionals succeed at work.

Hoist the colors! We’ve added location flags to usernames sitewide, so it's easier to connect with the global community on EE. View My Profile

x

Disappearing Cursor

jkb2
jkb2 asked
on
323 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.

Comment
Watch Question

Commented:
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.

Author

Commented:
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.

Commented:
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.

Author

Commented:
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.

Commented:
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.

Commented:
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.

Commented:
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.

Commented:
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.

Commented:
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.

Commented:
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.

Author

Commented:
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.

Commented:
No problem.

Author

Commented:
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...

Commented:
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
This one is on us!
(Get your first solution completely free - no credit card required)
UNLOCK SOLUTION

Author

Commented:
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.

Author

Commented:
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.

Gain unlimited access to on-demand training courses with an Experts Exchange subscription.

Get Access
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Empower Your Career
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE

Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Unlock the solution to this question.
Join our community and discover your potential

Experts Exchange is the only place where you can interact directly with leading experts in the technology field. Become a member today and access the collective knowledge of thousands of technology experts.

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.