Solved

Disappearing Cursor

Posted on 1997-03-11
17
263 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
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
Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

 
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 100 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

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

In this tutorial I will show you how to use the Windows Speech API in Delphi. I will only cover basic functions such as text to speech and controlling the speed of the speech. SAPI Installation First you need to install the SAPI type library, th…
Creating an auto free TStringList The TStringList is a basic and frequently used object in Delphi. On many occasions, you may want to create a temporary list, process some items in the list and be done with the list. In such cases, you have to…
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…

821 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