I use Windows 10 version 22H2, GnuCOBOL package GC32M-BDB-x64 by Arnold Trembley, Windows Terminal with command prompt profile, font Cascadia Code size 10, codepage 850 and I have 236 columns and 66 lines on my screen.
I would like to change the screen layout depending on the size of the screen.
But... CBL_GET_SCR_SIZE gives (only) 20 columns and (the correct) 66 lines.
See attached program MYSCREENSIZE.cob
Am I doing something wrong or is it CBL_GET_SCR_SIZE?
You are absolutely right Eugenio, accept works fine, get_scr-size fails.
But I want to know the screen size without pushing a key.
I don't think that is possible with an accept. Am I right?
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
subtract 1 from no-of-lines giving wlines-1.
subtract 2 from no-of-lines giving wlines-2.
subtract 3 from no-of-lines giving wlines-3.
display "line64" at line wlines-1 col 001 end-display.
display "line65" at line wlines-2 col 001 end-display.
display "line66" at line wlines-3 col 001 end-display.
It could just be that "CBL_GET_SCR_SIZE" does not work in windoz, at least as you have installed it etc.
With the accept omitted in place I changed the width of terminal wider after the 1st display block and then pressing return and the 2nd display shows correct values.
This was using terminal program QTerminal v1.4 in Mageia v9 X64.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
the CBL_GET_SCR_SIZE and CBL_SET_SCR_SIZE functions are implemented using the CURSES functionality. So if a CURSES window has not been iniitialized by using extended screen i/o functionality it will fail.
We could discuss with Simon to determine the appropriate behavior when these fuctions encounter this condition.
Chuck Haatvedt
ps... I've worked on the implementation of these so I'm somewhat familiar on how they work under the covers.
I'll do some testing of this when I get some time.
Last edit: Chuck Haatvedt 2024-06-03
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Anonymous
Anonymous
-
2024-06-04
The very first statement in program myscrnsize2.cob is :
"display " " erase eos at 001001 with background-color 0 end-display."
so initialization is done. Right?
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Also there should be an explicit warning that this function will not deliver the correct results if the lines or columns exceed 255.
I'm considering to have the function inspect the variables passed from COBOL and work with BINARY-SHORT UNSIGNED as an option. I still need to do some analysis of this potential option.
Chuck Haatvedt
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hi!
I use Windows 10 version 22H2, GnuCOBOL package GC32M-BDB-x64 by Arnold Trembley, Windows Terminal with command prompt profile, font Cascadia Code size 10, codepage 850 and I have 236 columns and 66 lines on my screen.
I would like to change the screen layout depending on the size of the screen.
But... CBL_GET_SCR_SIZE gives (only) 20 columns and (the correct) 66 lines.
See attached program MYSCREENSIZE.cob
Am I doing something wrong or is it CBL_GET_SCR_SIZE?
Sorry, I forgot : I also use pdcurses-wincon.dll.
After 2 weeks more than 50 views but no reaction. Am I the only one with this problem?
Change fields No-Of-Lines and No-Of-ColUMNS to PIC 999 value zero.
Then try again.
Just in case bin-char is being truncated and there is no reason for using binary any way and removes the need for the intermediate move.
This is not what is written in
"GnuCOBOL Programmer’s Guide For Version 3.2 [28 July 2023 at 234:55 GMT.] and for 4.0 (partial & tentative only)"
point "8.2.36. CBLGETSCRSIZE".
Anyway, I changed the program as you suggested and it doesn't work. Now both the number of lines and the number of columns are wrong.
See attached png file.
Could you test if it works with ACCEPT?
See Programmers Guide at 7.8.1.6 ACCEPT FROM Screen-Info
example:
ACCEPT works fine. GET_SCR_SIZE fails.
see attached screenshot and attached program
Last edit: Eugenio Di Lorenzo 2024-05-23
You are absolutely right Eugenio, accept works fine, get_scr-size fails.
But I want to know the screen size without pushing a key.
I don't think that is possible with an accept. Am I right?
No, I'm wrong. Omit the "accept omitted" in the program and that's it. Thanks!
The program works under Linux in both cases with and without the accept omitted but I did modify the display line64,65 & 66 lines to :
in WS :
01 wlines-1 pic 999.
01 wlines-2 pic 999.
01 wlines-3 pic 999.
at end block of 1st displays :
subtract 1 from no-of-lines giving wlines-1.
subtract 2 from no-of-lines giving wlines-2.
subtract 3 from no-of-lines giving wlines-3.
display "line64" at line wlines-1 col 001 end-display.
display "line65" at line wlines-2 col 001 end-display.
display "line66" at line wlines-3 col 001 end-display.
It could just be that "CBL_GET_SCR_SIZE" does not work in windoz, at least as you have installed it etc.
With the accept omitted in place I changed the width of terminal wider after the 1st display block and then pressing return and the 2nd display shows correct values.
This was using terminal program QTerminal v1.4 in Mageia v9 X64.
The presence or absence of ACCEPT OMITTED has nothing to do with it.
I believe a bug ticket should be opened for CBL_GET_SCR_SIZE.
Correct - nothing to do with the secondary ACCEPT.
It is totally related to Windoz and the implementation.
On 23/05/2024 19:05, Eugenio Di Lorenzo wrote:
Until the bug is resolved would an environment variable suffice?
SET / EXPORT SCR_SIZE=24x80, 132x43. . .
I think someone should open a bug ticket for the above documented incorrect behavior of
CBL_GET_SCR_SIZEthe CBL_GET_SCR_SIZE and CBL_SET_SCR_SIZE functions are implemented using the CURSES functionality. So if a CURSES window has not been iniitialized by using extended screen i/o functionality it will fail.
We could discuss with Simon to determine the appropriate behavior when these fuctions encounter this condition.
Chuck Haatvedt
ps... I've worked on the implementation of these so I'm somewhat familiar on how they work under the covers.
I'll do some testing of this when I get some time.
Last edit: Chuck Haatvedt 2024-06-03
The very first statement in program myscrnsize2.cob is :
"display " " erase eos at 001001 with background-color 0 end-display."
so initialization is done. Right?
The programmers guide is incorrect, the format should be
the value of binary 236 in a signed field is Negative 20
when corrected it displays as it should
Last edit: Chuck Haatvedt 2024-06-05
Fixed.
On 05/06/2024 04:27, Chuck H. wrote:
I have also changed same for :
CBL_GC_SET_SCR_SIZE
CBL_GET_CSR_POS
CBL_SET_CSR_POS.
On 05/06/2024 04:27, Chuck H. wrote:
ok. thanks for the solution !
now we need to open a bug ticket for the programmers guide.
I will take care of it.
Also there should be an explicit warning that this function will not deliver the correct results if the lines or columns exceed 255.
I'm considering to have the function inspect the variables passed from COBOL and work with BINARY-SHORT UNSIGNED as an option. I still need to do some analysis of this potential option.
Perfect!