Welcome to the SRP Forum! Please refer to the SRP Forum FAQ post if you have any questions regarding how the forum works.
Performance issue
I seem to have having some performance issues which I dont think I had previously with this control. V 4.1.8
There is not a lot of data, 20 columns and 50 rows.
I traced it so some code below.
CALL Set_Property(TableControl,"REDRAW",0)
ColumnList=Get_Property(TableControl,"OLE.ColumnList")
ColCount=DCOUNT(ColumnList,@FM)
For Column=1 TO ColCount
ColName=ColumnList
LOCATE ColName IN ITEM<11> USING @VM SETTING POS THEN
Width =ITEM<12,POS>
Visible=ITEM<13,POS>
CALL Set_Property(TableControl,"OLE.ColumnWidth[":Column:"]",Width)
CALL Set_Property(TableControl,"OLE.ColumnVisible[":Column:"]",Visible)
END
NEXT Column
The two set properties for Width and Visible seem to take a while, maybe 5-10 seconds. Even with Redraw set to zero.
Any issues or thoughts please.
Colin
There is not a lot of data, 20 columns and 50 rows.
I traced it so some code below.
CALL Set_Property(TableControl,"REDRAW",0)
ColumnList=Get_Property(TableControl,"OLE.ColumnList")
ColCount=DCOUNT(ColumnList,@FM)
For Column=1 TO ColCount
ColName=ColumnList
LOCATE ColName IN ITEM<11> USING @VM SETTING POS THEN
Width =ITEM<12,POS>
Visible=ITEM<13,POS>
CALL Set_Property(TableControl,"OLE.ColumnWidth[":Column:"]",Width)
CALL Set_Property(TableControl,"OLE.ColumnVisible[":Column:"]",Visible)
END
NEXT Column
The two set properties for Width and Visible seem to take a while, maybe 5-10 seconds. Even with Redraw set to zero.
Any issues or thoughts please.
Colin
Comments
The code is adjusting the info on the screen based on view settings.
2. I just ran a benchmark test
CALL SRP_Stopwatch("Reset")
CALL SRP_Stopwatch("Start", "SRP")
CALL Set_Property(TableControl,"REDRAW",0)
ColumnList=Get_Property(TableControl,"OLE.ColumnList")
ColCount=DCOUNT(ColumnList,@FM)
For Column=1 TO ColCount
ColName=ColumnList
LOCATE ColName IN ITEM<11> USING @VM SETTING POS THEN
Width =ITEM<12,POS>
Visible=ITEM<13,POS>
CALL Set_Property(TableControl,"OLE.ColumnWidth[":Column:"]",Width)
CALL Set_Property(TableControl,"OLE.ColumnVisible[":Column:"]",Visible)
END
NEXT Column
CALL SRP_Stopwatch("Stop", "SRP")
CALL SRP_Stopwatch("Show", "SRP")
Just out of curiosity, does the data have to be loaded before you set the column widths?
ColumnList=Get_Property(TableControl,"OLE.ColumnList")
ColCount=DCOUNT(ColumnList,@FM) This tells me that there are @fm in ColumnList
ColName=ColumnList therefore Colname contains @fm values
LOCATE ColName IN ITEM<11> USING @VM SETTING POS THEN if so then how would this worrk
I was wrong, there are actually 56 columns.
I also commented out the setting of the Width, and it seems like the Visible property is the one causing most of the degrade.
The data has to be there, it is populated on create, and then views manipulate the content, sort, group, columns etc.
CALL SRP_Stopwatch("Reset")
CALL Set_Property(TableControl,"REDRAW",0)
ColumnList=Get_Property(TableControl,"OLE.ColumnList")
ColCount=DCOUNT(ColumnList,@FM)
For Column=1 TO ColCount
ColName=ColumnList
LOCATE ColName IN ITEM<11> USING @VM SETTING POS THEN
Width =ITEM<12,POS>
Visible=ITEM<13,POS>
CALL SRP_Stopwatch("Start", "SRP")
CALL Set_Property(TableControl,"OLE.ColumnWidth[":Column:"]",Width)
CALL Set_Property(TableControl,"OLE.ColumnVisible[":Column:"]",Visible)
CALL SRP_Stopwatch("Stop", "SRP")
END
NEXT Column
CALL SRP_Stopwatch("Show", "SRP")
The code is OK, but the paste into the formum seemed to have changed
ColName = ColumnList < Column , 1 >
It is as above, I added spaces all over the place in this post so that the forum shows.
Seems the posting is not exact for the code pasted.
CALL Set_Property(TableControl,"REDRAW",0) ColumnList=Get_Property(TableControl,"OLE.ColumnList") ColCount=DCOUNT(ColumnList,@FM) For Column=1 TO ColCount ColName=ColumnList<Column,1> LOCATE ColName IN ITEM<11> USING @VM SETTING POS THEN Width =ITEM<12,POS> Visible=ITEM<13,POS> CALL Set_Property(TableControl,"OLE.ColumnWidth[":Column:"]",Width) CALL Set_Property(TableControl,"OLE.ColumnVisible[":Column:"]",Visible) END NEXT Column
I did not know how to do that.
CALL SRP_Stopwatch("Reset") CALL Set_Property(TableControl,"REDRAW",0) ColumnList=Get_Property(TableControl,"OLE.ColumnList") ColCount=DCOUNT(ColumnList,@FM) For Column=1 TO ColCount ColName=ColumnList<Column,1> LOCATE ColName IN ITEM<11> USING @VM SETTING POS THEN Width =ITEM<12,POS> Visible=ITEM<13,POS> CALL SRP_Stopwatch("Start", "SRP") CALL Set_Property(TableControl,"OLE.ColumnWidth[":Column:"]",Width) CALL Set_Property(TableControl,"OLE.ColumnVisible[":Column:"]",Visible) CALL SRP_Stopwatch("Stop", "SRP") END NEXT Column CALL SRP_Stopwatch("Show", "SRP")
What bemuses me though is that I think this is recent. I would have noticed this on the earlier versions, ie when I wrote this code in the first place.
I am assuming the data remains in tact and associated with the revised ColumnList property.
This is why I didn't suggest the AutoPopulate property. I didn't think it was applicable.
Some interesting results here.
I used the OLE.AutoPopulate and it did not make much difference, but with the OI REDRAW disabled I can see the columns changing, and slowly.
I then included both the REDRAW and OLE.AutoPopulate together and it works fine now. 32 ms for the 56 updates.
This seems like a sort of logical progression. Problem solved, essentially the change views is instantaneous.
CALL Set_Property(TableControl,"REDRAW",0) CALL Set_Property(TableControl,"OLE.AutoPopulate",0) CALL Set_Property(TableControl,"OLE.AutoPopulate",1) CALL Set_Property(TableControl,"REDRAW",1)