Kbase P116835: How to simulate automatic word-wrap in the SmartDataBrowser FILL-IN fields?
Autor |
  Progress Software Corporation - Progress |
Acesso |
  Público |
Publicação |
  20/06/2006 |
|
Status: Unverified
GOAL:
How to simulate automatic word-wrap in the SmartDataBrowser FILL-IN fields?
FIX:
1. Add the following variable definitions in the Definition section of the SmartDataViewer:
/* *************************** Definitions ************************** */
DEFINE VARIABLE cOriginalFillIn AS CHARACTER NO-UNDO.
DEFINE VARIABLE cModifiedFillIn AS CHARACTER NO-UNDO.
DEFINE VARIABLE cLastSavedWord AS CHARACTER NO-UNDO.
DEFINE VARIABLE iLastBlankPositon AS INTEGER NO-UNDO.
2. Create an initializeObject procedure override to set the FILL-IN fields' DISABLE-AUTO-ZAP and AUTO-RETURN properties to TRUE:
PROCEDURE initializeObject :
/*------------------------------------------------------------------------------
Purpose: Super Override
Parameters:
Notes:
------------------------------------------------------------------------------*/
/* Code placed here will execute PRIOR to standard behavior. */
RUN SUPER.
/* Code placed here will execute AFTER standard behavior. */
DEFINE VARIABLE hHandleVariable AS HANDLE NO-UNDO.
DEFINE VARIABLE hFieldHandle AS HANDLE NO-UNDO.
ASSIGN
hHandleVariable = FRAME {&FRAME-NAME}:HANDLE
hHandleVariable = hHandleVariable:FIRST-CHILD.
IF hHandleVariable:TYPE = "FIELD-GROUP" THEN
hFieldHandle = hHandleVariable:FIRST-CHILD.
REPEAT WHILE VALID-HANDLE( hFieldHandle ):
IF hFieldHandle:TYPE = "FILL-IN" THEN DO:
ASSIGN
hFieldHandle:DISABLE-AUTO-ZAP = TRUE
hFieldHandle:AUTO-RETURN = TRUE.
END.
hFieldHandle = hFieldHandle:NEXT-SIBLING.
END.
END PROCEDURE.
3. Create a frame LEAVE trigger to adjust the current FILL-IN SCREEN-VALUE if we are in the middle of a word and to save partial word to be as the first part in the next FILL-IN:
ON LEAVE OF FRAME F-Main
ANYWHERE DO:
IF SELF:TYPE = "FILL-IN" AND LENGTH(SELF:SCREEN-VALUE) = 30 THEN DO:
ASSIGN
cOriginalFillIn = SELF:SCREEN-VALUE
iLastBlankPositon = MAX(R-INDEX (cOriginalFillIn, CHR(32)),R-INDEX (cOriginalFillIn, CHR(13)))
cLastSavedWord = SUBSTRING(cOriginalFillIn, iLastBlankPositon + 1, LENGTH(cOriginalFillIn))
cModifiedFillIn = SUBSTRING(cOriginalFillIn, 1, iLastBlankPositon)
SELF:SCREEN-VALUE = cModifiedFillIn.
END.
END.
4. Create a frame ENTRY trigger to make the saved partial word the first part of the new FILL-IN (unless it is the very first FILL-IN) and position the cursor at the end of the partial word:
ON ENTRY OF FRAME F-Main
ANYWHERE DO:
IF SELF:TYPE = "FILL-IN" THEN DO:
IF SELF:TAB-POSITION = 1 THEN cLastSavedWord = "".
SELF:SCREEN-VALUE = cLastSavedWord.
APPLY 'END' TO SELF.
END.
END.