Jump to content


  • Content Count

  • Joined

  • Last visited

Community Reputation

0 Neutral
  1. giomach

    Behaviour of TListView (Delphi XE)

    Thanks for taking the trouble to give this explanation. I've also noticed that, in virtual mode, every item of a ListView has the same Top value of maxint. So its not possible to scroll to a numbered item by using their Items[index].Top property, but the method using DisplayRect (drBounds).Top, mentioned earlier in this thread, works.
  2. giomach

    Behaviour of TListView (Delphi XE)

    I see now ... I should be working with the StringList rather than with ListView.Items. That never occurred to me. In virtual mode, what about code like ListItem := WordListView.FindCaption (0, 'a', true, true, false); WordListView.Scroll (0, ListItem.DisplayRect (drBounds).Top); For example, do I need to replace FindCaption by a search of the StringList? By way of explanation, it was while trying to debug such code that I became concerned about what was happening to ListItem, leading me to display its Index value. Although I no longer need to do this, it is still disconcerting that (in virtual mode) its value can change in the way that my test program showed. Thanks for pointing me in the right direction. @emailx45: I didn't explain it well. I am happy with non-virtual mode. My problem was with virtual mode, the change in value of ListItem between the two lines where its value was displayed.
  3. giomach

    Behaviour of TListView (Delphi XE)

    The right source file this time — hopefully. WNExploreUnit.pas
  4. giomach

    Behaviour of TListView (Delphi XE)

    Sorry, wrong source file. The right one will be posted asap.
  5. giomach

    Behaviour of TListView (Delphi XE)

    This simple test program places a number of strings in a single-column ListView. I don't understand why it behaves differently in virtual and non-virtual modes. In non-virtual mode, the strings are added directly to the ListView. In virtual mode, they are placed in a StringList, and linked from there to the ListView. When the strings are in place, the first item of the ListView is assigned to a local TListItem variable. Then another item (the 7th for example) is accessed (its caption is read and displayed). Then we look at the local TListItem again. In non-virtual mode, it has not changed. But in virtual mode, it now contains the 7th item, not the first. Is this expected behaviour? If so, why? Source and output attached. WNExploreUnit.pas [Sorry this file was wrong. See further message for the right file.]
  6. giomach

    Highlight a specific popup menu item?

    I've been looking for a sticky popup solution, and this looks very promising. I've downloaded and run StickyPopupMenuSimulation 3.zip. I want to use hotkeys in the menu, and I have put a & on each menu item, Test &1, Test &2. There are two small problems. 1. When the menu appears, the hotkeys are not underlined. Underlining appears when a hotkey is pressed, and disappears again when a menuitem is clicked with the mouse. 2. When a hotkey for item 1 (say) is pressed, item1 is highlighted. If the mouse now hovers over item2, item2 is highlighted, but item1 also remains highlighted until the mouse is clicked. Hopefully this will not be hard to fix. I'm using Delphi XE2, update 1.