Problem
Screen-1 has cursor at 1740
Accepting screen-2, cursor is still on 1740 and not on the first field of screen-2
CBL_SET_CSR_POS etc. seem to be ignored.
So what is the trick ?
Thanks Erich
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hi Simon
I was assuming it is a beginners problem and known within the expert group....
please find some quick and ugly code attached
without screenio
Erich
I compiled to test the program mouse-01.cbl.
The compilation is successful but the program does not correctly manage the DISPLAY or the ACCEPT statements. I don't understand why.
Unfortunately now any other compilation generates .exe programs that give one of two error see screenshots and do not manage DISPLAY and ACCEPT.
Is it possible that just by compiling the sourcemouse-01.cbl now no other program works correctly anymore ?
No, the only way that this can happen would be that the compile command has gone banana and created some bad files (cobcrun, libcob) somewhere. Check your OCIDE preferences including "check compiler" and its output pane for the compilation details, also test with external console instead of the pycode one (setting in preferences).
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hello Eugenio,
Indeed a strange situation, but there are more strange things going on.
Take screen 2 of program mouse-01 and put some text in first line. say enter
than put some more text into first line say enter
you will see that your added text is left adjustet and the beginning of
the old text overwritten.
This happen in a dozen programs I recently wrote.
It even happens that what you added pops up in another filed of the screen.
While playing around the situation gets stable ......
I tried a lot of things f.i. changing field attributs, filling blancs etc.
but could not find a cobol way to get a work around.
maybe we need ncurses- specialists
Thanks for testing Erich
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I have a suspicion.
In your Procedure Division program, at the beginning, you entered a paragraph calling it "main".
Could this have confused the compiler ?
What's even stranger is that now I can't compile any other program that uses DISPLAY and ACCEPT with pdcurses !!!
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
ncursesw is totally fine; you just have to take care of different curses versions when you directly CALL curses functions (which of course should be wrapped into a single COBOL program, not placed into multiple ones).
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
In did not tested this myself but you may have misunderstood the way SCREENACCEPTing works: an ENTER ends the ACCEPT, to move between fields you will either TAB or, if you set the AUTO attribute, automatically swap to the next field after the last character of the field is reached.
You can set the position with a variable used with the CURSOR IS clause, but if you do so you then always have to set (and possibly query) it before/after ACCEPT.
Is this solved for you or should we investigate this further?
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Thanks Simon,
I learned
1. mouse and CURSOR_IS can be used both in the same program
2. If I do not set the cursor on a new screen it will pop up the position where the mouse was on the screen which was accepted before, which means the automatic - first input field of screen -
is probably switched off by the mouse function
The CURSOR IS clause has nothing to do with the mouse. Those are independent, apart from "depending on the mouse flags the mouse can adjust the cursor position" and therefore also the variable referenced by that clause.
As soon as you use the CURSOR IS clause it has total control over the position. If you want to say "do whatever is done when that clause is not active" before an ACCEPT you can simply MOVE ZERO TO YOUR-CURSOR-POS (it then will be ignored for a field accept and will position to the first input field on screen accept).
Note: There's one "gotcha" which is documented in libcob/screenio.c and will be "solved" one day, likely with a dialect option:
note: COBOL 2002 states that in [the case that the position does not match any field] the CURSOR clause is ignored, while MicroFocus and ACUCOBOL-GT [say position to] "the nearest field"
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
The CURSOR IS clause has nothing to do with the mouse...................
very helpful I will keep this in mind ........and work straight away
Thanks Erich
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Problem
Screen-1 has cursor at 1740
Accepting screen-2, cursor is still on 1740 and not on the first field of screen-2
CBL_SET_CSR_POS etc. seem to be ignored.
So what is the trick ?
Thanks Erich
The trick for useful responses is often to provide a minimal example to test with / adjust with ;-)
Hi Simon
I was assuming it is a beginners problem and known within the expert group....
please find some quick and ugly code attached
without screenio
Erich
Another question !
wolud it be o.k. to use mouse and setcursor functions
on the same screen or should one use only one of them ?
Thanks Erich
Very strange situation
I compiled to test the program mouse-01.cbl.
The compilation is successful but the program does not correctly manage the DISPLAY or the ACCEPT statements. I don't understand why.
Unfortunately now any other compilation generates .exe programs that give one of two error see screenshots and do not manage DISPLAY and ACCEPT.
Is it possible that just by compiling the sourcemouse-01.cbl now no other program works correctly anymore ?
Last edit: Eugenio Di Lorenzo 2021-07-25
No, the only way that this can happen would be that the compile command has gone banana and created some bad files (cobcrun, libcob) somewhere. Check your OCIDE preferences including "check compiler" and its output pane for the compilation details, also test with external console instead of the pycode one (setting in preferences).
Hello Eugenio,
Indeed a strange situation, but there are more strange things going on.
Take screen 2 of program mouse-01 and put some text in first line. say enter
than put some more text into first line say enter
you will see that your added text is left adjustet and the beginning of
the old text overwritten.
This happen in a dozen programs I recently wrote.
It even happens that what you added pops up in another filed of the screen.
While playing around the situation gets stable ......
I tried a lot of things f.i. changing field attributs, filling blancs etc.
but could not find a cobol way to get a work around.
maybe we need ncurses- specialists
Thanks for testing Erich
Forgot the pictures
sorry one more
I have a suspicion.
In your Procedure Division program, at the beginning, you entered a paragraph calling it "main".
Could this have confused the compiler ?
What's even stranger is that now I can't compile any other program that uses DISPLAY and ACCEPT with pdcurses !!!
I will check the main thing ...
I am compiling all day no problems using DEBIAN 11
pdcurses I understand is for windows
my cobc -info
shows ncursesw
can anybody out there say if it is ok ?
ncursesw is totally fine; you just have to take care of different curses versions when you directly
CALL
curses functions (which of course should be wrapped into a single COBOL program, not placed into multiple ones).In did not tested this myself but you may have misunderstood the way
SCREEN
ACCEPT
ing works: an ENTER ends theACCEPT
, to move between fields you will either TAB or, if you set theAUTO
attribute, automatically swap to the next field after the last character of the field is reached.You can set the position with a variable used with the
CURSOR IS
clause, but if you do so you then always have to set (and possibly query) it before/afterACCEPT
.Is this solved for you or should we investigate this further?
Thanks Simon,
I learned
1. mouse and CURSOR_IS can be used both in the same program
2. If I do not set the cursor on a new screen it will pop up the position where the mouse was on the screen which was accepted before, which means the automatic - first input field of screen -
is probably switched off by the mouse function
This is ok for me
That's not 100% correct.
CURSOR IS
clause has nothing to do with the mouse. Those are independent, apart from "depending on the mouse flags the mouse can adjust the cursor position" and therefore also the variable referenced by that clause.CURSOR IS
clause it has total control over the position. If you want to say "do whatever is done when that clause is not active" before anACCEPT
you can simplyMOVE ZERO TO YOUR-CURSOR-POS
(it then will be ignored for a field accept and will position to the first input field on screen accept).Note: There's one "gotcha" which is documented in libcob/screenio.c and will be "solved" one day, likely with a dialect option:
The CURSOR IS clause has nothing to do with the mouse...................
very helpful I will keep this in mind ........and work straight away
Thanks Erich