PlanetSquires Forums

Support Forums => Other Software and Code => Topic started by: Rolf Brandt on March 19, 2007, 07:11:07 AM

Title: FF_ListView_SetSelectedItem Problem
Post by: Rolf Brandt on March 19, 2007, 07:11:07 AM
In my Cheetah dbManager app I tried using the FF_ListView_SetSelectedItem function to navigate through the records. The function does move to the desired record, but it doesn't scroll the grid to it, if the record is not in the current display of the Listview.

Am I doing something wrong (most probably the case), or is there a workaround?

I used the SendKeys functions of William Burns in the meantime, which does the job.
http://www.powerbasic.com/support/forums/Forum7/HTML/001682.html (http://www.powerbasic.com/support/forums/Forum7/HTML/001682.html)


Select Case wID 
'Navigator buttons     
Case IDC_FORM1_TOOLBAR1_FIRST
FF_ListView_SetSelectedItem (HWND_FORM1_LISTVIEW1, 0)
Case IDC_FORM1_TOOLBAR1_PREVIOUS
FF_ListView_SetSelectedItem (HWND_FORM1_LISTVIEW1, a& - 1)
Case IDC_FORM1_TOOLBAR1_NEXT
FF_ListView_SetSelectedItem (HWND_FORM1_LISTVIEW1, a& + 1)
Case IDC_FORM1_TOOLBAR1_LAST
FF_ListView_SetSelectedItem (HWND_FORM1_LISTVIEW1, a& - 1)
End Select



Full source code of the project is here:
http://www.rbsoft.info/pb/dbman.html (http://www.rbsoft.info/pb/dbman.html)
http://www.rbsoft.info/pb/dbman.zip (http://www.rbsoft.info/pb/dbman.zip)

Thank you in advance
Rolf

Title: Re: FF_ListView_SetSelectedItem Problem
Post by: TechSupport on March 19, 2007, 02:10:07 PM
Maybe you could set the focus and then call ListView_EnsureVisible

ListView_EnsureVisible (BYVAL hWndLV AS DWORD, BYVAL i AS LONG, BYVAL fPartialOK AS INTEGER)

Parameters

hwndLV: Handle to the list view control.

i: Index of the list view item.

fPartialOK: Value specifying whether the item must be entirely visible. If this parameter is TRUE, no scrolling occurs if the item is at least partially visible.

Return Values: Returns TRUE if successful or FALSE otherwise.

Title: Re: FF_ListView_SetSelectedItem Problem
Post by: Rolf Brandt on March 19, 2007, 03:03:31 PM
Great, works absolutely perfect!

Once more thank you for the quick - no, I should say INSTANT - help.

Rolf