I know this is a VB forum, but my question pertains to VFP. I am trying to
stop a ListView from redrawing itself as I am inserting 3000 ListItems.
However, the following code does not prevent it from redrawing. Can you
Help?
Abhay Sobti
#DEFINE WM_SETREDRAW 11
DECLARE INTEGER SendMessage IN user32 INTEGER hWnd,;
INTEGER Msg,;
INTEGER wParam,;
INTEGER lParam
=SendMessage(THIS.Lv.hWnd, WM_SETREDRAW ,.T.,0)
** Now I populate the ListBox
=SendMessage(THIS.Lv.hWnd, WM_SETREDRAW ,.F.,0)
-Anders
"Abhay Sobti" <ab...@stansoftware.com> skrev i meddelandet
news:erJ6czb%23GHA...@TK2MSFTNGP02.phx.gbl...
I don't know about the Listiviw, but with the TreeView setting its
Visible property to .F. speeds it up considerably.
Abhay
"AA" <A@A> wrote in message news:OfEIpGc%23GHA...@TK2MSFTNGP03.phx.gbl...
"Abhay Sobti" <ab...@stansoftware.com> skrev i meddelandet
news:eSy65Ll%23GHA...@TK2MSFTNGP05.phx.gbl...
thisform.listview.visible = .F.
thisform.listview.enable = .F.
* then populate the list view with 100 recoreds * 114 field
thisform.listview.visible = .T.
thisform.listview.enable = .T.
the speed was 2 min 42 sec and after it was 5 sec
Samir ibrahim
"Abhay Sobti" <ab...@stansoftware.com> wrote in message
news:eSy65Ll%23GHA...@TK2MSFTNGP05.phx.gbl...
Yes ! There is a difference in speed. But my listview has only 3 columns
with 2000 rows. The difference is not really substantial.
thanks anyway
"Samir Ibrahim" <samir....@wilcopm.com> wrote in message
news:u4OynRl$GHA....@TK2MSFTNGP02.phx.gbl...
Try this:
Add a BeginUpdate and a EndUpdate Method to the ListView..
Add new properties WasSorted and ViewStyle
in the PROCEDURE BeginUpdate:
WITH THIS
** To try and speed up the loading process:
** 1) Turn off sorting
** 2) Disable the control
** 3) Change the View style to 3 - List
.Visible = .F.
.WasSorted = .Sorted
.Object.Sorted = .F.
.Object.Enabled = .F.
.ViewStyle = .Object.View
.Object.View = lvwList
SendMessage(.hWnd, WM_SETREDRAW, 0, 0)
LockWindowUpdate(.hWnd)
ENDWITH
in the PROCEDURE EndUpdate:
WITH THIS
.Object.Sorted = .WasSorted
.Object.Enabled = .T.
.Object.View = .ViewStyle
SendMessage(.hWnd, WM_SETREDRAW, 1, 0)
LockWindowUpdate(0)
.Visible = .T.
ENDWITH
The issue the following on loading:
Thisform.yourListView.BeginUpdate
-- Load all your items...
Thisform.yourListView.EndUpdate
FYI: In your SendMessage use integer values for boolean
Hope this helps.
- Alex
Thanks Samir,
thanks anyway