1 2 Previous Next 19 Replies Latest reply: Jan 27, 2013 6:50 PM by Amatu Allah Neveen Ebrahim RSS

    make the cursor at an item

    Goldray
      Hi (Salam Alaykom),
      I have a button "clear" , I want when the button is clicked the items will be cleared and the cursor is at the first item, here is the code:
      :emp.id:=null;
      :emp.ename:=null;
      :emp.sal:=null;
      go_item('emp.id');

      *=>but the problem that the item changes color, but the cursor remains at the button "clear"*

      NOTE:
      I used the "when-new-item-instance" trigger to change the color of text items
        • 1. Re: make the cursor at an item
          HamidHelal
          979155 wrote:
          Hi (Salam Alaykom),
          walikum as salam
          I have a button "clear" , I want when the button is clicked the items will be cleared and the cursor is at the first item, here is the code:
          :emp.id:=null;
          :emp.ename:=null;
          :emp.sal:=null;
          go_item('emp.id');
          Not need of this, simply issue of
          go_block('emp');
          clear_block;
          *=>but the problem that the item changes color, but the cursor remains at the button "clear"*
          does your button in the same block ? means button also in the emp block or any other block ? EMP block is tabular ??
          Do you have when-new-record-instance trigger at emp block ? if yes what is the code ?
          NOTE:
          I used the "when-new-item-instance" trigger to change the color of text items
          Hope you are using the trigger at Block level


          What is your form design ? i mean how may block and layout style..?


          Hamid

          Edited by: HamidHelal on Jan 26, 2013 12:32 AM
          • 2. Re: make the cursor at an item
            Goldray
            with this code:
            go_block('emp');
            clear_block;

            the system shows me alert message (same post when i want insert record):
            *"do you want to save the changes"*

            indications:
            I used a block based, the button "clear" to block appatient "EMP", it is a form (not tabular), i do not used when-new-record-trigger and the form contains only one block(EMP)
            • 3. Re: make the cursor at an item
              HamidHelal
              979155 wrote:
              with this code:
              go_block('emp');
              clear_block;

              the system shows me alert message (same post when i want insert record):
              *"do you want to save the changes"*

              indications:
              I used a block based, the button "clear" to block appatient "EMP", it is a form (not tabular), i do not used when-new-record-trigger and the form contains only one block(EMP)
              Ok.

              In the Object Navigator, where block,item and trigger are shows, Confirm the clear button are place at bottom/last place.
              Now write at when-button-press trigger
              clear_block(no_validate);
              Hope it works..
              • 4. Re: make the cursor at an item
                Goldray
                button "clear" already in last place
                with this code:
                clear_block(no_validate);

                *=> color item text changes but the cursor remains at the button "clear"*
                • 5. Re: make the cursor at an item
                  HamidHelal
                  979155 wrote:
                  button "clear" already in last place
                  with this code:
                  clear_block(no_validate);

                  *=> color item text changes but the cursor remains at the button "clear"*
                  Lets debug..
                  make comments all other code except the button code and then try ? what 's the result ?

                  Hope this helps


                  Hamid
                  • 6. Re: make the cursor at an item
                    Goldray
                    when i Debugged,
                    after a click on the button "clear" the cursor is at the first item text
                    Note:
                    i added message in the other code ,exemple :in when-new-item-instance trigger

                    Edited by: 979155 on 25 janv. 2013 12:20
                    • 7. Re: make the cursor at an item
                      HamidHelal
                      979155 wrote:
                      when i Debugged,
                      after a click on the button "clear" the cursor is at the first item text
                      Sounds good. It's working now.

                      Where you write the New-Item-instance-Trigger ??

                      Lets remove comments portion by portion and find out which code make interrupt on the issue.

                      Post the problem code or correct by yourself


                      Hope this helps...

                      Hamid

                      Edited by: HamidHelal on Jan 26, 2013 2:33 AM
                      • 8. Re: make the cursor at an item
                        Goldray
                        I knew why the cursor has become at the first item text because when I click on email button "clear" message is displayed (my own message I put the code in the last item before the button located "clear", this message is: message ('hello'); / / in when-validate-item trigger
                        So this message is displayed when I click "ok", the cursor will be at the first item
                        • 9. Re: make the cursor at an item
                          HamidHelal
                          979155 wrote:
                          I knew why the cursor has become at the first item text because when I click on email button "clear" message is displayed (my own message I put the code in the last item before the button located "clear", this message is: message ('hello'); / / in when-validate-item trigger
                          So this message is displayed when I click "ok", the cursor will be at the first item
                          It's not clear to me.

                          but when-validate-item trigger doesn't effect on clear_block(no_validate);

                          Which code interrupts ?

                          If your are asking that, when the message display and you press ok then cursor goes to first item, it's not possible directly from when-validate-item trigger as it's only support unrestricted built-ins but go_item(); is restricted builtin.


                          Hope this helps


                          Hamid

                          Edited by: HamidHelal on Jan 26, 2013 2:42 AM
                          • 10. Re: make the cursor at an item
                            Goldray
                            when I deleted the message I upgraded to the when-validate-item trigger, the cursor remains at the button "clear" but when I restored the (message) the cursor is at the first text item!
                            • 11. Re: make the cursor at an item
                              Goldray
                              Salam Alaykom,
                              I'm sure the problem is in the code level when-new-block-instance trigger, because when I added this code instruction "go_item(..)"... the cursor always become at first item ("id").

                              code when-new-block-instance trigger:
                              DECLARE
                                   cur_itm VARCHAR2(80);
                                   cur_itm1 VARCHAR2(80) := :system.cursor_item;
                                   cur_block VARCHAR2(80) := :System.Cursor_Block;
                              BEGIN
                                   cur_itm := Get_Block_Property( cur_block, FIRST_ITEM );
                                   WHILE ( cur_itm IS NOT NULL ) LOOP
                                   cur_itm := cur_block||'.'||cur_itm;
                                   Set_Item_Instance_Property( cur_itm, CURRENT_RECORD, VISUAL_ATTRIBUTE,'NORMAL'); --- set white background
                                   cur_itm := Get_Item_Property( cur_itm, NEXTITEM );
                                   END LOOP;
                                   Set_Item_Instance_Property( cur_itm1, CURRENT_RECORD, VISUAL_ATTRIBUTE,'code'); --- set my favorite color
                                   *go_item('id'); --instruction added*

                              END;

                              =>I hope that it can help us
                              • 12. Re: make the cursor at an item
                                HamidHelal
                                979155 wrote:
                                Salam Alaykom,
                                Walikum as salam o rahmatillah
                                I'm sure the problem is in the code level when-new-block-instance trigger,
                                I said in several post that the trigger used should be when-New-Item-instance Trigger at Block-Level not when-New-Block-Instance

                                Change the trigger ad problem will gone.


                                Hope it works...


                                Hamid
                                • 13. Re: make the cursor at an item
                                  Amatu Allah Neveen Ebrahim
                                  pls try
                                  to remove when validate item first run and test or disable it temporary keep the code in when new item instance as hamid said, use
                                  clear_form(no_validate);
                                  have made the form generation after each step pls do it is v important to make the changes take place then run and test after each change u make
                                  AMatu Allah

                                  Edited by: Amatu Allah on Jan 27, 2013 12:07 AM
                                  • 14. Re: make the cursor at an item
                                    Goldray
                                    salam alaykom
                                    I used when-new-item-instance trigger, not when-new-block-instance trigger (typo)
                                    1 2 Previous Next