Dear FF users,
The LVN_ITEMCHANGED notification is very useful to update in the status-bar the number of lines selected by a user in a ListView control.
'--------------------------------------------------------------------------------
Function TASKS_TASKSLV_LVN_ITEMCHANGED ( _
ControlIndex As Long, _ ' index in Control Array
hWndForm As Dword, _ ' handle of Form
hWndControl As Dword, _ ' handle of Control
ByVal lpNMV As NM_LISTVIEW Ptr _ ' pointer to NM_LISTVIEW
) As Long
' update the number of selected lines
FF_StatusBar_SetText(HWND_TASKS_STATUSBAR, 1, Format$(ListView_GetSelectedCount(HWND_TASKS_TASKSLV))+" line(s) selected")
End Function
But this code below cause the status-bar to flicker when I initially load the ListView with thousands of lines.
So here is my question: Is there a way to disable temporarily the LVN_ITEMCHANGED notification, when I load data in a Listview control to avoid the status bar to flicker ?
Any ideas ? Thanks,
Jean-Pierre
Could you FF_Control_ShowState( HWND_FORM1_STATUSBAR, %SW_HIDE ) the statusbar prior to loading the
listview and then FF_Control_ShowState( HWND_FORM1_STATUSBAR, %SW_SHOW )
when loading complete?
This is not what you are after, but it avoids flicker.
You can disable redrawing with
SendMessage HWND_TASKS_STATUSBAR, %WM_SETREDRAW, %FALSE, 0
before loading the items and enable it later with
SendMessage HWND_TASKS_STATUSBAR, %WM_SETREDRAW, %TRUE, 0
Pat, Jose,
Thanks a lot for your ideas; I'll give them a try.
Jean-Pierre
Create a global variable, say, "gAllowNotifications". Set it to TRUE only after all of your listview items have loaded.
'--------------------------------------------------------------------------------
Function TASKS_TASKSLV_LVN_ITEMCHANGED ( _
ControlIndex As Long, _ ' index in Control Array
hWndForm As Dword, _ ' handle of Form
hWndControl As Dword, _ ' handle of Control
ByVal lpNMV As NM_LISTVIEW Ptr _ ' pointer to NM_LISTVIEW
) As Long
If IsFalse(gAllowNotifications) Then Exit Function
' update the number of selected lines
FF_StatusBar_SetText(HWND_TASKS_STATUSBAR, 1, Format$(ListView_GetSelectedCount(HWND_TASKS_TASKSLV))+" line(s) selected")
End Function