Solved

Placing Icons in a ListView at a specific point.

Posted on 1998-12-06
4
164 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

Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
How to call a form that is in a DLL  from an application? 13 71
SUM 2 INTEGER ARRAYS INTO 1 10 100
How to build JSON File in Delphi 6 3 32
Wincontrol not (correctly) drawn 15 37
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…
Introduction I have seen many questions in this Delphi topic area where queries in threads are needed or suggested. I know bumped into a similar need. This article will address some of the concepts when dealing with a multithreaded delphi database…
This tutorial gives a high-level tour of the interface of Marketo (a marketing automation tool to help businesses track and engage prospective customers and drive them to purchase). You will see the main areas including Marketing Activities, Design …
Microsoft Active Directory, the widely used IT infrastructure, is known for its high risk of credential theft. The best way to test your Active Directory’s vulnerabilities to pass-the-ticket, pass-the-hash, privilege escalation, and malware attacks …

776 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