Navigation: How To's and Troubleshooting > How to… >====== How to Update an Icon Check Box in EIP Mode ====== | |
The release of Clarion 6 introduced a new Edit-in-Place interface which allows better control of column types in a list box. One of those types is a check box interface, implemented through the EditCheckClass object. Instead of a standard entry field that is used in EIP mode, a check box control is used in its place.
Edit-In-Place using EditCheckClass template interface
Problem:
During the edit cycle on each list box line, a check box icon will not be updated until the record (or row) has been saved. This is confusing to a user who unchecks the Edit-In-place check box control, moves to the next column, and does not see the icon check box change state.
Goal of this FAQ:
To update the icon checkbox used while editing, and before the record (row) is saved.
Solution:
The embedded source code added below is used to change the icon on a browse using the values in the associated queue, which have not been updated yet to the primary table (in this example, a check box).
The solution is to add a few lines of source code to the BRW1::EIPManager.TakeAccepted method just after the parent call. The same code used to change the icon for each column is used, but we need to reference the browse queue elements. For example,
IF (fieldname = 1)
would be changed to:
IF (BRW1.Q.fieldname = 1)
where fieldname is a value that controls the display of an icon type, and BRW1.Q is the instance prefix of the Browse Box control template
Also the queue fields needs to be changed to reference the parent browse object(SELF to BRWx)
SELF.Q.fieldname_Icon = 1
to
BRW1.Q.fieldname_Icon = 1
Icon files used in a browse box are set in the BRW1.SetQueueRecord method.
So, the following code:
IF (fieldname = 1)
SELF.Q.fieldname_Icon = 1 ! Set icon from icon list
ELSE
SELF.Q.fieldname_Icon = 2 ! Set icon from icon list
END
should be copied to BRW1::EIPManager.TakeAccepted after parent call embed point as follows:
IF (BRW1.Q.fieldname = 1)
BRW1.Q.fieldname_Icon = 1 ! Set icon from icon list
ELSE
BRW1.Q.fieldname_Icon = 2 ! Set icon from icon list
END
The following image shows a real world implementation:
If you are using the Clarion template chain instead of ABC, the embed point and solution is exactly the same, with a minor change to the naming conventions:
IF (Queue:Browse:1.BRW1::fieldname = 1)
Queue:Browse:1.BRW1::fieldname:Icon = 1 ! Set icon from icon list
ELSE
Queue:Browse:1.BRW1::fieldname:Icon = 2 ! Set icon from icon list
END
Finally, if you are still using the Original EIP implementation (which was only available in the ABC templates), the technique is still the same, but the embed point changes:
IF (BRW1.Q.fieldname = 1)
BRW1.Q.fieldname_Icon = 1 ! Set icon from icon list
ELSE
BRW1.Q.fieldname_Icon = 2 ! Set icon from icon list
END
This code will get inserted into the following embed as shown: