Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Placing Icons in a ListView at a specific point.

Posted on 1998-12-06
4
Medium Priority
?
172 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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 400 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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Objective: - This article will help user in how to convert their numeric value become words. How to use 1. You can copy this code in your Unit as function 2. than you can perform your function by type this code The Code   (CODE) The Im…
Introduction Raise your hands if you were as upset with FireMonkey as I was when I discovered that there was no TListview.  I use TListView in almost all of my applications I've written, and I was not going to compromise by resorting to TStringGrid…
This tutorial will teach you the special effect of super speed similar to the fictional character Wally West aka "The Flash" After Shake : http://www.videocopilot.net/presets/after_shake/ All lightning effects with instructions : http://www.mediaf…
We’ve all felt that sense of false security before—locking down external access to a database or component and feeling like we’ve done all we need to do to secure company data. But that feeling is fleeting. Attacks these days can happen in many w…
Suggested Courses

636 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