Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6693515
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T05:59:30+00:00 2026-05-26T05:59:30+00:00

I have a ListView set to vsIcon. Each item is a image with a

  • 0

I have a ListView set to vsIcon. Each item is a image with a small text beneath. When I add many items they are wrapped for the width of the ListView (for example 5 items on a row). But when I change its width they are not wrapped again for the new width.

What I tried so far:

  • ListView.Update;

  • ListView.Refresh;

  • ListView.Repaint;

  • function ListView_Arrange(hwndLV: HWND; Code: UINT): Bool;

  • function ListView_RedrawItems(hwndLV: HWND; iFirst, iLast: Integer): Bool;

I haven’t tried sorting the items because I don’t want them to be sorted. But most of the times they are sorted so sorting wouldn’t help much (if it will wrap them, which I don’t believe it will).

What I use now:

procedure TForm.WMExitSizeMove(var Message: TMessage);
var
   i, p: Integer;
   ListItem: TListItem;
   c: array of string;
   b: array of Boolean;
begin
   if Showing and (PreviousWidth <> Width) then
   begin
      p := ListView.ItemIndex;
      SetLength(c, ImageList.Count);
      SetLength(b, ImageList.Count);
      for i := 0 to ImageList.Count - 1 do
      begin
         c[i] := ListView.Items[i].Caption;
         b[i] := ListView.Items[i].Selected;
      end;
      ListView.Items.BeginUpdate;
      ListView.Clear;
      for i := 0 to ImageList.Count - 1 do
      begin
         ListItem := ListView.Items.Add;
         ListItem.Caption := c[i];
         ListItem.ImageIndex := i;
         ListItem.Selected := b[i];
      end;
      ListView.ItemIndex := p;
      ListView.Items.EndUpdate;
      SetLength(c, 0);
      SetLength(b, 0);
      PreviousWidth := Width;
   end;
   inherited;
end;

But, as you notice, it’s not that fast for a large amount of items.
Could you please help me find a better way…?

Thank you.

I use Delphi 7.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T05:59:30+00:00Added an answer on May 26, 2026 at 5:59 am

    The listview can do that for you automatically.
    Somewhere in your code ( perhaps in formcreate) insert the following:

    listview.IconOptions.AutoArrange := true;
    

    Or you can set it in the properties window as well.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a ListView of items that need to be checkable/uncheckable. I have set
For Honeycomb, I have set my listview items to use the ?android:attr/activatedBackgroundIndicator style so
I have a ListView where each item has a checkbox. Initially there are no
I have a ListView and set a SimpleAdapter to show some formated items, then
I have Created a ListView and set a background image.Everything goes fine except I
I have a listview with custom rows. In imageView1 I set an image, but
I have a ListView that is filled with a dynamic set of data each
I have a listView, and ech item of listView has textView. I have set
I have a listview that needs to be multiple choice (i.e each list item
I have a ListView control set up in details mode with 5 columns. It

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.