Topic: SF
Hi Jeff,
There appears to be an issue with the way Appgraphics implements dlgrequesttext(). For example, if it is used to enter a text password of exactly the same length as it is dimensioned, then the password is truncated by two characters. This would be problem when trying to enter a correct password since the requested text would not equal the original password. The issue does not occur when the dimension of the entered password text is increased by two characters (dim(text(n + 2)). I've attached a simple example below which produces the following results.
!--- Simply Fortran v3.39
!--- OUTPUT: CHARACTER(30) :: txt
My initial text is 123456789012345678901234567890
My initial text length is 30
Request was successful: T
My requested text is 1234567890123456789012345678
My requested ADJUSTL(text) is 1234567890123456789012345678
My requested TRIM(text) is 1234567890123456789012345678
My requested text length is 28
Initial text does not equal requested text: Failure!
Regards,
Frank
SF Code:
PROGRAM REQUEST_TEXT
USE APPGRAPHICS, ONLY: dlgrequesttext, dlgrequestpassword
IMPLICIT NONE
INTEGER, PARAMETER :: n = 30 !-- if set to 32, cTXT len_trim = 30
CHARACTER(n) :: cTXT, cTEXT
CHARACTER(n) :: cTITLE, cLBL
LOGICAL :: bYN
cTITLE = "My Title:"
cLBL = "Enter text:"
cTXT = &
"123456789012345678901234567890"
cTEXT = TRIM(ADJUSTL( cTXT ))
PRINT *, 'My initial text is ', TRIM( cTXT )
PRINT *, 'My initial text length is ', LEN_TRIM( cTXT )
PRINT *
bYN = dlgrequesttext( cTXT, cTITLE, cLBL, .FALSE. )
!bYN = dlgrequestpassword( cTXT, cTITLE, cLBL )
IF (bYN) THEN
PRINT *, 'Request was successful:', bYN
PRINT *, 'My requested text is ', REPEAT(' ',9), cTXT
PRINT *, 'My requested ADJUSTL(text) is ', ADJUSTL( cTXT )
PRINT *, 'My requested TRIM(text) is ', REPEAT(' ',3), TRIM( cTXT )
PRINT *, 'My requested text length is ', REPEAT(' ',3), LEN_TRIM( cTXT )
ELSE
PRINT *, 'Request was unsuccessful:', bYN
PRINT *, 'My requested text is unchanged: ', ADJUSTL( cTXT )
PRINT *, 'My text length is:', LEN_TRIM( cTXT )
END IF
PRINT *
IF (ADJUSTL(cTXT) /= ADJUSTL(cTEXT)) THEN
PRINT *, 'Initial text does not equal requested text: Failure!'
ELSE
PRINT *, 'Initial text equals requested text: Success!'
END IF
RETURN
!--- OUTPUT:
! My initial text is 123456789012345678901234567890
! My initial text length is 30
!
! Request was successful: T
! My requested text is 1234567890123456789012345678
! My requested ADJUSTL(text) is 1234567890123456789012345678
! My requested TRIM(text) is 1234567890123456789012345678
! My requested text length is 28
!
! Initial text does not equal requested text: Failure!
!
END PROGRAM REQUEST_TEXT