Kbase P107509: Why doesn't the ENTRY statement does not work for screen-values?
Autor |
  Progress Software Corporation - Progress |
Acesso |
  Público |
Publicação |
  10/08/2005 |
|
Status: Unverified
GOAL:
Why doesn't the ENTRY statement does not work for screen-values?
FIX:
Using the ENTRY statement as shown in the following code will not replace the SCREEN-VALUE of the widget with a new value:
ASSIGN SomeWidget:SCREEN-VALUE = 'A,_,C'.
ENTRY(2,SomeWidget:SCREEN-VALUE) = 'B'.
At first glance this would appear to be an issue, however, the ENTRY statement is actually working correctly. When this statement is executed the first thing that happens is that the SomeWidget:SCREEN-VALUE reference is resolved (since it is not an actual CHARACTER or LONGCHAR variable). The resolving of this statement causes a temporary (internal) string variable to be created. Next, element number 2 of the temporary string variable is determined and that element is replaced by the letter 'B'. What is not obvious is that the ENTRY function requires a variable with a type of CHARACTER or LONGCHAR for the second parameter and these are NOT the same thing as a widget:attribute which returns a string.
The following shows one alternative way to write the above code so that it works as one would expect:
ASSIGN SomeWidget:SCREEN-VALUE = 'A,_,C'. /* we will leave this the same just for kicks */
ASSIGN SomeWidget. /* this causes the screen value to be assigned to the underlying variable */
ENTRY(2,SomeWidget) = 'B'. /* replacement takes effect and result is stored back in underlying variable */
DISPLAY SomeWidget WITH SomeFrame. /* updated string is redisplayed on the screen */