ibmi-brunch-learn

Announcement

Collapse
No announcement yet.

Cursor Positioning after prompt

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Cursor Positioning after prompt

    I have a screen and an rpg program.

    In the screen i have 3 fields each one on a separate line (line 1,2,3).
    When I prompt field in line 2 the cursor goes back to line 1. I need it to stay at line 2 or go to line 3. How can this be done?


    Thank you.

  • #2
    Re: Cursor Positioning after prompt

    hi,

    Use Position Cursor(PC) in field keywords for the field make it on there....

    Comment


    • #3
      Re: Cursor Positioning after prompt

      I am using DSPATR(PC) after defining each field.Is ther any other keyword?

      Comment


      • #4
        Re: Cursor Positioning after prompt

        hi,

        Use Position Cursor(PC) in field keywords for the particular field & make it on there....

        Comment


        • #5
          Re: Cursor Positioning after prompt

          Easy, if you don't want the cursor to go to field1, then protect field1.

          Comment


          • #6
            Re: Cursor Positioning after prompt

            I don't want to protect field 1, i want the cursor to appear on field 1 initially but when i select field 2 i want the cursor to stay at field 2 not go to field 1.
            As for Position Cursor(PC) is not a valid keyword

            Comment


            • #7
              Re: Cursor Positioning after prompt

              Hi

              Have you tried FLDCSRPRG
              LP Zdenko

              Comment


              • #8
                Re: Cursor Positioning after prompt

                FLDCSRPRG did not work the cursor is always returning to 1st field in the screen

                Comment


                • #9
                  Re: Cursor Positioning after prompt

                  You can use the DSPATR(PC) . When you want the cursor on field 2, you have to make sure the PC keyword for field 1 is turned off and field 2 is turned on. If PC is turned on for both fields, then Field1 will still get the cursor, since it is likely listed first.
                  Michael Catalani
                  IS Director, eCommerce & Web Development
                  Acceptance Insurance Corporation
                  www.AcceptanceInsurance.com
                  www.ProvatoSys.com

                  Comment


                  • #10
                    Re: Cursor Positioning after prompt

                    Originally posted by MichaelCatalani View Post
                    You can use the DSPATR(PC) . When you want the cursor on field 2, you have to make sure the PC keyword for field 1 is turned off and field 2 is turned on. If PC is turned on for both fields, then Field1 will still get the cursor, since it is likely listed first.
                    IOW condition the DSPATR(PC) with an indicator on the fields, set the indicator on for the field you want the cursor to appear on with the other indicators off...
                    I'm not anti-social, I just don't like people -Tommy Holden

                    Comment


                    • #11
                      Re: Cursor Positioning after prompt

                      Maybe this will do the trick for you

                      Use these 2 keywords in you displayfile

                      RTNCSRLOC(*WINDOW &LIN &POS &WLIN &WPOS)
                      CRSLOC(WLIN WPOS)

                      Comment


                      • #12
                        Re: Cursor Positioning after prompt

                        Originally posted by tomholden View Post
                        IOW condition the DSPATR(PC) with an indicator on the fields, set the indicator on for the field you want the cursor to appear on with the other indicators off...
                        Correct, I just refuse to use the word "indicator" anymore.
                        Michael Catalani
                        IS Director, eCommerce & Web Development
                        Acceptance Insurance Corporation
                        www.AcceptanceInsurance.com
                        www.ProvatoSys.com

                        Comment


                        • #13
                          Re: Cursor Positioning after prompt

                          Hi,

                          to reposition on the field after an F4 is quite easy and can be realized without any indicator.
                          1. You have to define the file status data struckture in your D-Specs and accociate it in the F-Specs with the display file.
                          In position 370-371 the current cursor postion (before F4) will be returned as binary/integer. Position 370 represents the row, while 371 represents the column.
                          2. Before F4 move these information into the fields you defined as cursror location (CSRLOC).
                          3. If after F4 a EXTMFT is executed the cursor is positioned to this field.
                          4. After F4 clear the CSRLOC fields.

                          Example DDS
                          PHP Code:
                          A          R MyFormat
                          A                                      CF04
                          A                                      RTNCSRLOC
                          (&R1RCDN &R1FELD)       
                          A                                      CSRLOC(RXCSZE     RXCSSP)           
                          A            R1RCDN        10A  H                     
                          A            R1FELD        10A  H            
                          A            RXCSZE         3S 0H     
                          A            RXCSSP         3S 0H       
                          ... Field Definition 
                          Example RPG:
                          PHP Code:
                          FMyDSPF    CF   E             WORKSTN INFDS(DspfSDS
                          *----------------------------------------------------------------
                          D DspfSDS         DS                  Qualified   
                          D   FKey                369    369                 
                          D   Row                 370    370I 0             
                          D   Col                 371    371I 0        

                          *----------------------------------------------------------------
                           /
                          Free
                              DoW 1
                          =1;
                                 
                          ExFmt MyFormat;
                                 
                          Clear RXCSZE;       //Cursor Row
                                 
                          Clear RXCSSP;       //Cursor Column
                                 
                          Select;
                                 
                          When DSPFSDS.FKey F03 or DSPFSDS.FKey F12;
                                      
                          Leave;
                                 
                          When DSPFSDS.FKey F04;
                                       
                          RXCSZE DSPFSDS.Row;
                                       
                          RXCSSP DSPFSDS.Col
                                      
                          Select;
                                      
                          When R1Feld 'MYFLD1';
                                           
                          //Execute Matchcode for MYFLD1;
                                      
                          When R1Feld 'MYFLD2;
                                      ....
                                      EndSL;
                                      Iter;
                                EndSL
                          ....
                             Enddo    
                           /End-Free 
                          Birgitta

                          Comment

                          Working...
                          X