Solved

Placing Icons in a ListView at a specific point.

Posted on 1998-12-06
4
163 Views
Last Modified: 2010-04-04
Hi,
I'm trying to put an Item into a TListView at certain coordinates X and Y given by a OnDragDrop event.
I'm using this piece of code for it :
procedure TForm1.ListView1DragDrop(Sender, Source: TObject; X, Y: Integer);
var ListItem: TListItem;
begin
  ListItem := ListView1.Items.Add;
  ListItem.Caption := TSpeedButton(Source).caption;
  ListItem.Top:=Y;
  ListItem.Left:=X;
End;
The problem now is that the caption alwas gets on top or on the left of my TListView. I'v tried to set IconsOptions.AutoArange to False or True, it won't matter..

Anyone that can help me ??

Thx

Pieter
0
Comment
Question by:plambrec
  • 2
4 Comments
 
LVL 4

Expert Comment

by:dwwang
ID: 1349570
I think set AutoArrange to false only takes effects when it is in LargeIcons, in other status of listview, the icon will be at top-left at anytime.
0
 
LVL 20

Expert Comment

by:Madshi
ID: 1349571
Yes, dwwang is right. But I think it should work in "vsIcon" and in "vsSmallIcon"...

Regards, Madshi.
0
 

Author Comment

by:plambrec
ID: 1349572
nope, sorry, i tried both icons and smallicons style (without an actual icon, just a caption). It won't work...
I've downloaded a component called ExtListView which is an extended listview. this might work....


0
 
LVL 4

Accepted Solution

by:
dwwang earned 100 total points
ID: 1349573
Hi, I think the solution is to use SetPosition, see Delphi's help below:

Positions the list item in its list view control.

procedure SetPosition(const Value: TPoint);

Description

Call SetPosition to move the list item to a specified position. The Value parameter specifies the desired coordinates of the upper-left corner of the list item.

Note:      The list view control must have its ViewStyle property set to either vsIcon or vsSmallIcon.

Regards,
Wang
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

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…
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…
This video explains how to create simple products associated to Magento configurable product and offers fast way of their generation with Store Manager for Magento tool.
Need to grow your business through quality cloud solutions? With everything required to build a cloud platform and solution, you may feel like the distance between you and the cloud is quite long. Help is here. Spend some time learning about the Con…

948 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

17 Experts available now in Live!

Get 1:1 Help Now