Problem:
The article "Modernize DialogSystem Applications with Windows XP Visual Style controls" see: http://www.microfocus.com/mfnewsletter/technicalarticles/20050701-002.asp showed how to get the modern looking XP style for DialogSystem screen sets
NOTE: A .PDF version of this document is available through the link at the bottom of this page and includes screen shots and tables which further explain the topic.
Resolution:
Enlarging the entry field by a factor of 4, you can see a line in a dark colour at the top and on the left site - in a light colour at the bottom and to the right:
Also the list box shows such lines. These lines are the inherited 3D effect from the standard layout of the entry fields.
To switch it off, you need to manipulate the layout of each entry field (and each list box) by class library methods in the following way:
In Dialog System:
Even if the demo only contains one entry field and one list box, the following chapters demonstrates, how to handle a certain amount of objects (e.g. 50 entry fields - 10 list boxes).
The Windows operating system handles of the entry fields and the list boxes have to be determined by the function MOVE-OBJECT-HANDLE after they were created.
Therefore, the best place for the move-object-handle-dialog is in the handling of the WINDOW-CREATED-event of each window.
In the data block
NR-OF-EF-HANDLES 9 9.0
ALL-EF-HANDLES 50
EF-HANDLE C 4.0
NR-OF-LB-HANDLES 9 9.0
ALL-LB-HANDLES 10
LB-HANDLE C 4.0
In the global dialog
* This CALLOUT loads the NetExpress
* API Class Library
* NOTE this must always occur before
* any function which causes the creation
* of a window.
CALLOUT-PARAMETER 1 CONFIG-FLAG $NULL
CALLOUT-PARAMETER 2 CONFIG-VALUE $NULL
MOVE 15 CONFIG-FLAG
MOVE 1 CONFIG-VALUE
CALLOUT "dsrtcfg" 3 $PARMLIST
In "Windows Created" of windows containing entry fields of list boxes
WINDOW-CREATED
MOVE 1 NR-OF-EF-HANDLES
MOVE-OBJECT-HANDLE EF1 EF-HANDLE(1)
* add more entry fields if needed
MOVE 1 NR-OF-LB-HANDLES
MOVE-OBJECT-HANDLE LB1 LB-HANDLE(1)
* add more list boxes if needed
MOVE 7 EXIT-FLAG
RETC
REFRESH-OBJECT WIN-01
In COBOL:
An object reference has to be created for the window handle using the class method "fromhandle". Before you can do so, the byte ordering has to be changed from the dialog system internal format COMP-X to the operating system format COMP-5.
move EF-HANDLE(cnt) to Temp-Handle
invoke TextEntry "fromHandle"
using Temp-Handle
returning Temp-OBJ-REF
Now we can call the object method "noBorder" to switch-off the 3D effect:
invoke Temp-OBJ-REF "noBorder"
In the Class-Control paragraph
class-control.
TextEntry is class "txtentry"
listbox is class "listbox"
.
In the working-storage section.
01 cnt PIC S9(9) comp-5.
01 Temp-Handle PIC S9(9) comp-5.
01 Temp-Obj-Ref object reference.
In the procedure division, handling the RETC from Dialog System
if Exit-Flag = 7
move 0 to exit-flag
perform varying cnt from 1 by 1
until cnt > Nr-Of-Ef-Handles
or cnt > 50
move EF-HANDLE(cnt) to Temp-Handle
invoke TextEntry "fromHandle"
using Temp-Handle
returning Temp-OBJ-REF
invoke Temp-OBJ-REF "noBorder"
end-perform
*
perform varying cnt from 1 by 1
until cnt > Nr-Of-Lb-Handles
or cnt > 10
move LB-HANDLE(cnt) to Temp-Handle
invoke ListBox "fromHandle"
using Temp-Handle
returning Temp-OBJ-REF
invoke Temp-OBJ-REF "noBorder"
end-perform
end-if
In the attached demo, a toggle is implemented on the push-button, which switches the 3D effect on and off on a button-pressed event.
Please be aware, that the 3D effect is switched off also on Windows systems without the XP Visual Style. The disappearing of the lines in XP Visual Style may improve the layout, but please review the layout on standard layout, e.g. Windows 2000.



