Tab Merge - a new feature in eXpress++
Posted: Mon Jun 04, 2012 10:28 am
Before releasing build 257, I am hoping to get some feedback on a new feature I have added to eXpress++.
Many of you are familiar with DC_MergeGetLists() and the need for this function.
This was added as a necessity after Tom Liehr visited me in Boise, ID about 11 years ago.
It solved a lot of performance problems for eXpress++ users, but it was a bit cumbersome to use for some because it often required passing a lot of local variables by reference.
I got an idea a few days ago after working on a customer's app that took far too long to create a dialog. He had hundreds of objects on 6 tabpages. His code was written in such a way that it would take longer than I wanted to move code around and use DC_MergeGetLists(). Also, there was a problem with resizing. If a tabpage is resized before being clicked on, then the objects on that tabpage are not placed properly.
I believe that I have developed a much simpler solution to both problems.
I have added a new MERGECHILDREN clause to the @..DCTABPAGE command.
This causes DCREAD GUI to ignore creating items in the GetList which are children of a tabpage that uses this clause. The child objects will be created only after the tab is clicked on for the first time. A new ::createChildren() method calls DCREAD GUI to build the child objects on the tabpage if they are not already created.
The advantage of this feature is that a simple clause can be added to exisiting applications to give them improved performance when creating dialogs with tabpages.
To test this feature, here is a download that contains a new DCLIPX.DLL (compiled in build 355) and a DCDIALOG.CH file. The download also contains a sample program.
http://donnay-software.com:8080/donnay/tabmerge.zip
Unzip the tabmerge.zip in your \exp19\samples\tabpage folder and run TABMERGE.EXE.
Look at the below code. It is a sample program that demonstrates this new feature. If you comment out the MERGECHILDREN clauses and rebuild TABMERGE.XPJ, you will see that the load time is much longer.
#INCLUDE "dcdialog.CH"
Many of you are familiar with DC_MergeGetLists() and the need for this function.
This was added as a necessity after Tom Liehr visited me in Boise, ID about 11 years ago.
It solved a lot of performance problems for eXpress++ users, but it was a bit cumbersome to use for some because it often required passing a lot of local variables by reference.
I got an idea a few days ago after working on a customer's app that took far too long to create a dialog. He had hundreds of objects on 6 tabpages. His code was written in such a way that it would take longer than I wanted to move code around and use DC_MergeGetLists(). Also, there was a problem with resizing. If a tabpage is resized before being clicked on, then the objects on that tabpage are not placed properly.
I believe that I have developed a much simpler solution to both problems.
I have added a new MERGECHILDREN clause to the @..DCTABPAGE command.
This causes DCREAD GUI to ignore creating items in the GetList which are children of a tabpage that uses this clause. The child objects will be created only after the tab is clicked on for the first time. A new ::createChildren() method calls DCREAD GUI to build the child objects on the tabpage if they are not already created.
The advantage of this feature is that a simple clause can be added to exisiting applications to give them improved performance when creating dialogs with tabpages.
To test this feature, here is a download that contains a new DCLIPX.DLL (compiled in build 355) and a DCDIALOG.CH file. The download also contains a sample program.
http://donnay-software.com:8080/donnay/tabmerge.zip
Unzip the tabmerge.zip in your \exp19\samples\tabpage folder and run TABMERGE.EXE.
Look at the below code. It is a sample program that demonstrates this new feature. If you comment out the MERGECHILDREN clauses and rebuild TABMERGE.XPJ, you will see that the load time is much longer.
#INCLUDE "dcdialog.CH"
Code: Select all
FUNCTION Main()
LOCAL GetList[0], oTab1, oTab2, oTab3, oTab4, aData[25,18], i, j, ;
GetOptions
FOR i := 1 TO 25
FOR j := 1 TO 18
aData[i,j] := Space(10)
NEXT
NEXT
@ 0,0 DCTABPAGE oTab1 CAPTION 'Tab 1' SIZE 190, 30 ;
RESIZE DCGUI_RESIZE_RESIZEONLY
CreateGets(@oTab1,GetList,aData)
@ 0,0 DCTABPAGE oTab2 CAPTION 'Tab 2' RELATIVE oTab1 ;
MERGECHILDREN ;
RESIZE DCGUI_RESIZE_RESIZEONLY
CreateGets(@oTab2,GetList,aData)
@ 0,0 DCTABPAGE oTab3 CAPTION 'Tab 3' RELATIVE oTab2 ;
MERGECHILDREN ;
RESIZE DCGUI_RESIZE_RESIZEONLY
CreateGets(@oTab3,GetList,aData)
@ 0,0 DCTABPAGE oTab4 CAPTION 'Tab 4' RELATIVE oTab3 ;
MERGECHILDREN ;
RESIZE DCGUI_RESIZE_RESIZEONLY
CreateGets(@oTab4,GetList,aData)
DCGETOPTIONS RESIZE RESIZEDEFAULT DCGUI_RESIZE_REPOSONLY
DCREAD GUI FIT TITLE 'Tab Merge Sample' OPTIONS GetOptions
RETURN nil
* ------------
PROC appsys ; RETURN
* -------------
STATIC FUNCTION CreateGets( oTab, GetList, aData )
LOCAL i, j, oStatic
@ 2,5 DCSTATIC TYPE XBPSTATIC_TYPE_RECESSEDBOX SIZE 170,25 OBJECT oStatic PARENT oTab
FOR i := 1 TO 20
FOR j := 1 TO 15
@ i+2,j*10 DCGET aData[i,j] PARENT oStatic
NEXT
NEXT
RETURN nil