Menu

mouse and more screens

2021-07-19
2021-07-29
  • Erich Mueller

    Erich Mueller - 2021-07-19

    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

     
  • Simon Sobisch

    Simon Sobisch - 2021-07-20

    The trick for useful responses is often to provide a minimal example to test with / adjust with ;-)

     
  • Erich Mueller

    Erich Mueller - 2021-07-20

    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

     
  • Anonymous

    Anonymous - 2021-07-20

    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

     
  • Eugenio Di Lorenzo

    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
    • Simon Sobisch

      Simon Sobisch - 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).

       
  • Erich Mueller

    Erich Mueller - 2021-07-25

    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

     
  • Erich Mueller

    Erich Mueller - 2021-07-25

    Forgot the pictures

     
  • Erich Mueller

    Erich Mueller - 2021-07-25

    sorry one more

     
  • Eugenio Di Lorenzo

    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 !!!

     
  • Erich Mueller

    Erich Mueller - 2021-07-25

    I will check the main thing ...
    I am compiling all day no problems using DEBIAN 11

     
  • Erich Mueller

    Erich Mueller - 2021-07-25

    pdcurses I understand is for windows
    my cobc -info
    shows ncursesw
    can anybody out there say if it is ok ?

     
    • Simon Sobisch

      Simon Sobisch - 2021-07-25

      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).

       
  • Simon Sobisch

    Simon Sobisch - 2021-07-25

    In did not tested this myself but you may have misunderstood the way SCREEN ACCEPTing 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?

     
  • Erich Mueller

    Erich Mueller - 2021-07-26

    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

          WHEN  "02"
          MOVE 15 TO CSRLL  *> must !!!!
          MOVE 05 TO CSRCC  *> otherwise Cursor is where mouse was
                                                                   *> on previous screen
          ACCEPT FORM2 END-ACCEPT
    
          END-EVALUATE
    

    This is ok for me

     
    • Simon Sobisch

      Simon Sobisch - 2021-07-28

      That's not 100% correct.

      1. 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.
      2. 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"

       
  • Erich Mueller

    Erich Mueller - 2021-07-29

    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

     

Anonymous
Anonymous

Add attachments
Cancel