Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion Groups
Database Servers
DB2InformixIngresMS SQLOraclePervasive.SQLPostgreSQLProgressSybase
Desktop Databases
FileMakerFoxProMS AccessParadox
General
General DB TopicsDatabase Theory
Related Topics
Java Development.NET DevelopmentVB DevelopmentMore Topics ...

Database Forum / FoxPro / Library Construction Kit Api / November 2006

Tip: Looking for answers? Try searching our database.

SendMessage to Speedup ListView

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Abhay Sobti - 27 Oct 2006 12:24 GMT
Hello Everyone,

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)
AA - 27 Oct 2006 13:15 GMT
Try
Thisform.LockScreen=.T.

-Anders

> Hello Everyone,
>
[quoted text clipped - 17 lines]
>
> =SendMessage(THIS.Lv.hWnd, WM_SETREDRAW ,.F.,0)
Abhay Sobti - 28 Oct 2006 06:34 GMT
Tried Visible=.F. , and also LockScreen.
Not much affect

Abhay

> Try
> Thisform.LockScreen=.T.
[quoted text clipped - 22 lines]
>>
>> =SendMessage(THIS.Lv.hWnd, WM_SETREDRAW ,.F.,0)
AA - 29 Oct 2006 17:25 GMT
If you're working in VFP you can fill a ListBox control with 3000 AddItem or
AddListItem calls in a loop, times the number of columns, or with a single
line setting RecordSource to a multidimensionsl array or to a cursor.
-Anders

> Tried Visible=.F. , and also LockScreen.
> Not much affect
[quoted text clipped - 27 lines]
>>>
>>> =SendMessage(THIS.Lv.hWnd, WM_SETREDRAW ,.F.,0)
Samir Ibrahim - 02 Nov 2006 08:51 GMT
I have tried this

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

> Tried Visible=.F. , and also LockScreen.
> Not much affect
[quoted text clipped - 27 lines]
>>>
>>> =SendMessage(THIS.Lv.hWnd, WM_SETREDRAW ,.F.,0)
Abhay Sobti - 03 Nov 2006 13:12 GMT
Thanks Samir,

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

>I have tried this
>
[quoted text clipped - 39 lines]
>>>>
>>>> =SendMessage(THIS.Lv.hWnd, WM_SETREDRAW ,.F.,0)
Jack Jackson - 27 Oct 2006 15:16 GMT
>Hello Everyone,
>
[quoted text clipped - 17 lines]
>
>=SendMessage(THIS.Lv.hWnd, WM_SETREDRAW ,.F.,0)

I don't know about the Listiviw, but with the TreeView setting its
Visible property to .F. speeds it up considerably.
Alex.K - 27 Nov 2006 02:00 GMT
Samir,

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

----- Original Message -----
From: Abhay Sobti
Newsgroups: microsoft.public.fox.vfp.lck-api
Sent: Friday, November 03, 2006 5:12 AM
Subject: Re: SendMessage to Speedup ListView

Thanks Samir,

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

>I have tried this
>
[quoted text clipped - 41 lines]
>>>>
>>>> =SendMessage(THIS.Lv.hWnd, WM_SETREDRAW ,.F.,0)
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.