Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. Not getting the visible bottom index of the List Control in MFC?

Not getting the visible bottom index of the List Control in MFC?

Scheduled Pinned Locked Moved C / C++ / MFC
questionc++databasedesign
5 Posts 3 Posters 6 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S Offline
    S Offline
    SanjayK70
    wrote on last edited by
    #1

    Hello, In the list control, we have the function to get the top index in MFC, GetTopIndex(), but how can we have the index of the visible last row of the list control whether we scroll it or not? I am asking this question because I have to put a design on the bottom of the last row, even if I scroll it should stay on the last row's bottom. How should I refer to the last visible row programmatically? Thanks in advance.

    M J 2 Replies Last reply
    0
    • S SanjayK70

      Hello, In the list control, we have the function to get the top index in MFC, GetTopIndex(), but how can we have the index of the visible last row of the list control whether we scroll it or not? I am asking this question because I have to put a design on the bottom of the last row, even if I scroll it should stay on the last row's bottom. How should I refer to the last visible row programmatically? Thanks in advance.

      M Offline
      M Offline
      Michael_Davies
      wrote on last edited by
      #2

      If there's not a method for it loop from the first to the last item and when ItemIsVisible returns false break the loop the previous item was at the bottom.

      S 1 Reply Last reply
      0
      • S SanjayK70

        Hello, In the list control, we have the function to get the top index in MFC, GetTopIndex(), but how can we have the index of the visible last row of the list control whether we scroll it or not? I am asking this question because I have to put a design on the bottom of the last row, even if I scroll it should stay on the last row's bottom. How should I refer to the last visible row programmatically? Thanks in advance.

        J Offline
        J Offline
        Jochen Arndt
        wrote on last edited by
        #3

        The CListCtrl class provides the function GetCountPerPage()[^]:

        Quote:

        Calculates the number of items that can fit vertically in the visible area of a list view control when in list view or report view.

        Use that to calculate the index of the item visible on the bottom:

        int MyListCtrl::GetBottomIndex() const
        {
        int n = GetTopIndex() + GetCountPerPage() - 1;
        if (n >= GetItemCount())
        n = GetItemCount() - 1;
        return n;
        }

        S 1 Reply Last reply
        0
        • J Jochen Arndt

          The CListCtrl class provides the function GetCountPerPage()[^]:

          Quote:

          Calculates the number of items that can fit vertically in the visible area of a list view control when in list view or report view.

          Use that to calculate the index of the item visible on the bottom:

          int MyListCtrl::GetBottomIndex() const
          {
          int n = GetTopIndex() + GetCountPerPage() - 1;
          if (n >= GetItemCount())
          n = GetItemCount() - 1;
          return n;
          }

          S Offline
          S Offline
          SanjayK70
          wrote on last edited by
          #4

          Many thanks, i will try this one out!

          1 Reply Last reply
          0
          • M Michael_Davies

            If there's not a method for it loop from the first to the last item and when ItemIsVisible returns false break the loop the previous item was at the bottom.

            S Offline
            S Offline
            SanjayK70
            wrote on last edited by
            #5

            Thanks, but this is not serving my purpose! Thanks anyways

            1 Reply Last reply
            0
            Reply
            • Reply as topic
            Log in to reply
            • Oldest to Newest
            • Newest to Oldest
            • Most Votes


            • Login

            • Don't have an account? Register

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • World
            • Users
            • Groups