Jump to content
Sign in to follow this  
WalkingAway

Odd behaviour - LIstbox.OnClick and ShowMessage

Recommended Posts

Is to make sense not to use ShowMessage inside OnClick event due to mouse cursor hang?

My event works pretty well until I decided to add ShowMessage inside.

After that cursor over listbox has "crossed out circle" and I have to click on listbox to get it normal.

But that click itself seems not to work also.

 

It's only happens when listbox.DargMode = dsAutomatic.

 

Why?

Share this post


Link to post

So, after that ( if Listbox1.DragMode = dmAutomatic ):

 

procedure TForm6.ListBox1Click(Sender: TObject);
begin
 ShowMessage('Bla bla');

end;

 

you can see what happens.

Thank you.

Share this post


Link to post

It's a normal behavior. You should give us more information in order to give us a chance to suggest how could you change the code.

 

If you really have to use dmAutomatic in that case whenever you would like to cancel the drag operation you have to call the EndDrag method with false of the control (in this case the listbox).

Share this post


Link to post
21 minutes ago, Lajos Juhász said:

It's a normal behavior. You should give us more information in order to give us a chance to suggest how could you change the code.

 

If you really have to use dmAutomatic in that case whenever you would like to cancel the drag operation you have to call the EndDrag method with false of the control (in this case the listbox).

Thank you.

Yes I intend to use dmAutomatic (as I need to move items inside that listbox), but (also) I don't want such behaviour after OnClickMethod.

 

I think this code

begin
 ShowMessage('Bla bla');
 ListBox1.EndDrag(False);

end;

 

cover all my needs, at least so far I see what I intend top see.

 

Let's see what happens when I implement actual drag/drop functionality.

Thank you.

Edited by WalkingAway

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×