PlanetSquires Forums

Support Forums => Other Software and Code => Topic started by: JR Heathcote on March 02, 2006, 12:03:35 PM

Title: A couple of listview questions
Post by: JR Heathcote on March 02, 2006, 12:03:35 PM
In Firefly how do I determine if a particular row in a listview control is visible, or has been scrolled out of range?

How do I determine if the listview vertical scrollbar is visible or not?
Title: A couple of listview questions
Post by: TechSupport on March 02, 2006, 07:29:49 PM

Function FF_ListView_IsLineVisible( ByVal hWndControl As Dword, _
                                   ByVal nLineNum As Long _
                                   ) As Long

  If IsWindow( hWndControl) = 0 Then Exit Function
   
  Local nFirstLine    As Long
  Local nItemsPerPage As Long

  nFirstLine    = ListView_GetTopIndex( hWndControl )
  nItemsPerPage = ListView_GetCountPerPage( hWndControl )
   
  If ( nLineNum >= nFirstLine ) And _
     ( nLineNum <= nFirstLine + nItemsPerPage ) Then
     Function = %TRUE
  End If
                                                 
End Function


You can use the function ListView_EnsureVisible to ensure that a line of yours is made to be visible.
Title: A couple of listview questions
Post by: TechSupport on March 02, 2006, 07:35:07 PM
Not sure what the best way it is to check for the scroll bar visibility but you can try the following:

Function FF_ListView_IsScrollbarVisible( ByVal hWndControl As Dword ) As Long

  If IsWindow( hWndControl) = 0 Then Exit Function
   
  Local nItemCount    As Long
  Local nItemsPerPage As Long

  nItemCount    = ListView_GetItemCount( hWndControl )
  nItemsPerPage = ListView_GetCountPerPage( hWndControl )
   
  If ( nItemCount > nItemsPerPage ) Then
     Function = %TRUE
  End If
                                                 
End Function