This discussion is archived
1 2 Previous Next 17 Replies Latest reply: Jan 27, 2013 10:32 AM by 982158 RSS

change the color of the text item

982158 Newbie
Currently Being Moderated
Hi,
I have 3 text items in my text form, I want When the cursor in a text item the color of the item will be changed.
Note:
I have already created a visual attribute.
  • 1. Re: change the color of the text item
    Amatu Allah Guru
    Currently Being Moderated
    979155 wrote:
    Hi,
    I have 3 text items in my text form, I want When the cursor in a text item the color of the item will be changed.
    Note:
    I have already created a visual attribute.
    Hi
    1.For trigger function u can use
    when new item instance
    item level
    2.search forms on line help for
    set item property > visual attribute
    this id used multi records only
    set item instance property for single record
    Then u can specify the name of the visual attribute which will display the color u pre_ determined what ever number of item related to whatever number visual attribute
    using with the when new item instance trigger _item level

    Amatu Allah
  • 2. Re: change the color of the text item
    HamidHelal Guru
    Currently Being Moderated
    979155 wrote:
    Hi,
    I have 3 text items in my text form, I want When the cursor in a text item the color of the item will be changed.
    Note:
    I have already created a visual attribute.
    So, Do you able to assign the visual attribute ? assuming when you click in a test item that item color will change, right ?

    If yes, try this, Create two visual attribute name My_Favorite_Named_Attribute and set background property to any color and other is NORMAL and set background property white.

    Create WHEN-NEW-ITEM-INSTANCE trigger at block level and write following code..
    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,'My_Favorite_Named_Attribute'); --- set your favorite color
    END; 
    Hope this works...


    Hamid


    If someone's response is helpful or correct, please mark it accordingly.*
  • 3. Re: change the color of the text item
    942420 Newbie
    Currently Being Moderated
    Write Below Code in WHEN-NEW-ITEM-INSTANCE Trigger

    DECLARE
    cur_block Varchar2(30);
    cur_item Varchar2(30);

    lv_va_name     Varchar2(30);
    BEGIN
         cur_block :=:system.cursor_block;
         cur_item :=:system.cursor_item;
    lv_va_name     :='VA_Attribute; -- VA_Attribute is visual Attribute defined by you
              IF Get_Item_Property(cur_item,item_type) IN ('TEXT ITEM') THEN
              Set_item_instance_property(cur_item,current_record,visual_attribute,lv_va_name);
              END IF;
         
    END;

    Hope This will Help You.
  • 4. Re: change the color of the text item
    982158 Newbie
    Currently Being Moderated
    Hi,
    thank you for the answer
    I also want when the cursor leaves an item text color back "white"
  • 5. Re: change the color of the text item
    HamidHelal Guru
    Currently Being Moderated
    979155 wrote:
    Hi,
    thank you for the answer
    I also want when the cursor leaves an item text color back "white"
    Yes..my example do this for you.. Check the code.

    Hope this helps


    Hamid


    Mark correct/helpful to help others to get right answer(s).*
  • 6. Re: change the color of the text item
    982158 Newbie
    Currently Being Moderated
    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"*
  • 7. Re: change the color of the text item
    HamidHelal Guru
    Currently Being Moderated
    979155 wrote:
    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"*
    Walikum as salam O rahmatillah
    set the button Keyboard Navigable Property to No and try


    Hope this works..
  • 8. Re: change the color of the text item
    982158 Newbie
    Currently Being Moderated
    same problem :/
    the code:
    :emp.id:=null;
    :emp.ename:=null;
    :emp.sal:=null;
    set_item_property('clear',navigable,property_false);
    go_item('emp.id');
  • 9. Re: change the color of the text item
    HamidHelal Guru
    Currently Being Moderated
    979155 wrote:
    same problem :/
    the code:
    :emp.id:=null;
    :emp.ename:=null;
    :emp.sal:=null;
    set_item_property('clear',navigable,property_false);
    go_item('emp.id');
    try alter native.. in button, write
    go_block('emp');
    clear_block(no_validate);
    Hope this works...


    Hamid
  • 10. Re: change the color of the text item
    982158 Newbie
    Currently Being Moderated
    the same problem with this code : :(
    go_block('emp');
    clear_block(no_validate);


    I'll post this problem in the forum ;)

    Edited by: 979155 on 25 janv. 2013 09:54
  • 11. Re: change the color of the text item
    Amatu Allah Guru
    Currently Being Moderated
    hi
    pls try

    item_name := ` ` ;

    for the button u can set keyboard navigable to no
    or works with enable property mentioned to no i mean u can do it code block level if not item level works there.
    in some cases we recorder items in object navigator

    AMatu Allah
  • 12. Re: change the color of the text item
    982158 Newbie
    Currently Being Moderated
    I changed "navigable" to no and "enabled" to no too, but the problem remains.
    where I must put this instruction : item_name := ` ` ; ?
  • 13. Re: change the color of the text item
    Amatu Allah Guru
    Currently Being Moderated
    hi
    i supposed the code with null is not working ...
    so this was aother way to clear items

    sounds ur button is located before these items in the object navigator so...
    i suggest eith u put form items before the button o better create a non db block for the button and put ur code above using
    go_block('block_name');
    ...
    and create a new button put urn code in and remove the old button.

    Note: here i would like just to clear something to u;the creation of the button in the layout canvas doesn't really mean the right location for the button's order in relation to thh form's item regarding the actual selected block where u want reside ur button in.
    more over perhaps u have old triggers that affects on the behaviour of the cursor or whatever pls clear any desired ones...

    best regards :-)

    Amatu Allah
  • 14. Re: change the color of the text item
    982158 Newbie
    Currently Being Moderated
    I created another block (not based) which I created a new button, but the problem persists
    the code:
    go_block('emp');
    clear_block(no_validate);

    =>the cursor remains at the new button
1 2 Previous Next

Legend

  • Correct Answers - 10 points
  • Helpful Answers - 5 points