Menu

straight c cobol example grid thanks

J McNamara
2024-10-19
2024-10-27
  • J McNamara

    J McNamara - 2024-10-19

    cobc -x -o my_program init.cob $(pkg-config --cflags --libs ncurses) -static
    $> ./NcursesInlineCExample.exe

    this above... or this below... does not produce a grid

    $> cobc -x -o NcursesInlineCExample init.cob -lncurses -static
    $> ./NcursesInlineCExample.exe

    it just kind of waits out there hanging around not doing anything...

    IDENTIFICATION DIVISION.
    PROGRAM-ID. NcursesInlineCExample.

           ENVIRONMENT DIVISION.
           CONFIGURATION SECTION.
    
           DATA DIVISION.
           WORKING-STORAGE SECTION.
           01  WS-RETURN-CODE    PIC S9(9) COMP.
    
           LINKAGE SECTION.
           01  C-RETURN-CODE     PIC S9(9) COMP.
    
           PROCEDURE DIVISION.
           MAIN-PROCEDURE.
               PERFORM C-INITIALIZE-NCURSES.
               IF WS-RETURN-CODE < 0
                   DISPLAY "Failed to initialize ncurses."
               ELSE
                   PERFORM C-SHOW-GRID
                   PERFORM C-WAIT-FOR-KEY
               END-IF.
               PERFORM C-FINALIZE-NCURSES.
               STOP RUN.
    
           C-INITIALIZE-NCURSES.
               CALL 'initscr' USING C-RETURN-CODE.
    
           C-SHOW-GRID.
               CALL 'mvprintw' USING 1 1 "+---+---+".
               CALL 'mvprintw' USING 2 1 "| 1 | 2 |".
               CALL 'mvprintw' USING 3 1 "+---+---+".
               CALL 'mvprintw' USING 4 1 "| 3 | 4 |".
               CALL 'mvprintw' USING 5 1 "+---+---+".
               CALL 'refresh'.
    
           C-WAIT-FOR-KEY.
               CALL 'getch'.
    
           C-FINALIZE-NCURSES.
               CALL 'endwin'.
    

    its the call to mvprintw that isnt executing right away thanks

    jim

    Sent with Proton Mail secure email.

     
  • Chuck Haatvedt

    Chuck Haatvedt - 2024-10-19

    In my opinion calling curses functions directly from gnucobol is not supported or recommended.

    per the pdcursesmod documentation which I'm most familiar with, a "refresh" call is needed to update the physical terminal screen.

             Chuck Haatvedt
    
     
    • J McNamara

      J McNamara - 2024-10-19

      Hi Chuck-

      I will try to do some kind of refresh call. Thank you so much.

      I am going to ride it out with cygwin. I like it a lot better than mingw and dont want both environments on my PC taking up space.

      Not only that I am using cygwin for other things a bit in the recent past.

      thanks for the assistance!

      jim

      Sent with Proton Mail secure email.

      On Saturday, October 19th, 2024 at 6:07 PM, Chuck H. chaat@users.sourceforge.net wrote:

      In my opinion calling curses functions directly from gnucobol is not supported or recommended.

      per the pdcursesmod documentation which I'm most familiar with, a "refresh" call is needed to update the physical terminal screen.

      Chuck Haatvedt


      straight c cobol example grid thanks


      Sent from sourceforge.net because you indicated interest in https://sourceforge.net/p/gnucobol/discussion/help/

      To unsubscribe from further messages, please visit https://sourceforge.net/auth/subscriptions/

       
      • J McNamara

        J McNamara - 2024-10-19

        Chuck,

        ummhh i did a refresh 2 different ways.

        I am looking at trying to have a way to draw a grid layout on a cobol screen without typing
        everything by hand.

        Chatgpt wants to use calls to ncurses.

        I am stuck, any idea?

        thanks

        Sent with Proton Mail secure email.

        On Saturday, October 19th, 2024 at 6:23 PM, J McNamara masticon@users.sourceforge.net wrote:

        Hi Chuck-

        I will try to do some kind of refresh call. Thank you so much.

        I am going to ride it out with cygwin. I like it a lot better than mingw and dont want both environments on my PC taking up space.

        Not only that I am using cygwin for other things a bit in the recent past.

        thanks for the assistance!

        jim

        Sent with Proton Mail secure email.

        On Saturday, October 19th, 2024 at 6:07 PM, Chuck H. chaat@users.sourceforge.net wrote:

        In my opinion calling curses functions directly from gnucobol is not supported or recommended.

        per the pdcursesmod documentation which I'm most familiar with, a "refresh" call is needed to update the physical terminal screen.

        Chuck Haatvedt


        straight c cobol example grid thanks


        Sent from sourceforge.net because you indicated interest in https://sourceforge.net/p/gnucobol/discussion/help/

        To unsubscribe from further messages, please visit https://sourceforge.net/auth/subscriptions/


        straight c cobol example grid thanks


        Sent from sourceforge.net because you indicated interest in https://sourceforge.net/p/gnucobol/discussion/help/

        To unsubscribe from further messages, please visit https://sourceforge.net/auth/subscriptions/

         
        • Simon Sobisch

          Simon Sobisch - 2024-10-20

          Don't use ChatGPT for COBOL as it is one of the parts where it performs worst...

          For drawing checkout the NEWS entry for the control (?) attribute added, which allows you to use curses drawing without direct calls.

          You'd also find the closed-implemented feature request on this on SF under "tickets".

          Am 20. Oktober 2024 00:37:37 MESZ schrieb J McNamara masticon@users.sourceforge.net:

          Chuck,

          ummhh i did a refresh 2 different ways.

          I am looking at trying to have a way to draw a grid layout on a cobol screen without typing
          everything by hand.

          Chatgpt wants to use calls to ncurses.

          I am stuck, any idea?

          thanks

          Sent with Proton Mail secure email.

          On Saturday, October 19th, 2024 at 6:23 PM, J McNamara masticon@users.sourceforge.net wrote:

          Hi Chuck-

          I will try to do some kind of refresh call. Thank you so much.

          I am going to ride it out with cygwin. I like it a lot better than mingw and dont want both environments on my PC taking up space.

          Not only that I am using cygwin for other things a bit in the recent past.

          thanks for the assistance!

          jim

          Sent with Proton Mail secure email.

          On Saturday, October 19th, 2024 at 6:07 PM, Chuck H. chaat@users.sourceforge.net wrote:

          In my opinion calling curses functions directly from gnucobol is not supported or recommended.

          per the pdcursesmod documentation which I'm most familiar with, a "refresh" call is needed to update the physical terminal screen.

          Chuck Haatvedt


          straight c cobol example grid thanks


          Sent from sourceforge.net because you indicated interest in https://sourceforge.net/p/gnucobol/discussion/help/

          To unsubscribe from further messages, please visit https://sourceforge.net/auth/subscriptions/


          straight c cobol example grid thanks


          Sent from sourceforge.net because you indicated interest in https://sourceforge.net/p/gnucobol/discussion/help/

          To unsubscribe from further messages, please visit https://sourceforge.net/auth/subscriptions/


          straight c cobol example grid thanks


          Sent from sourceforge.net because you indicated interest in https://sourceforge.net/p/gnucobol/discussion/help/

          To unsubscribe from further messages, please visit https://sourceforge.net/auth/subscriptions/

           
  • László Erdős

    László Erdős - 2024-10-26

    Hi,

    I don't know exactly what you want, but if you use curses, then it is better to use screen-sections. If you want paging, listing functionality with a "grid" you can check the programs here:
    https://sourceforge.net/p/gnucobol/contrib/HEAD/tree/trunk/samples/DBsample/

    See example7 and the screenshots.

    László

     

Anonymous
Anonymous

Add attachments
Cancel