Sunday, August 30, 2009

Expand or Collapse an Item Value

--====================================================================
:global.wait := null;
:global.value := null;

The above varibale assign into New-Form-Instance trigger.
Also create a timer into New-Form-Instance trigger.
Then the following Procedure call from When-Timer-expired trigger
Ex: prc_increase_text('my_item',5); 

--====================================================================
procedure prc_increase_text(p_item in varchar2,p_iteration number) is
  
  v_item varchar2(100);
 v_display varchar2(1000);
 v_ini_value varchar2(100);
 v_char varchar2(1);
 v_length number;

begin

  copy(name_in(p_item),'global.value');
  v_length := length(:global.value);
  :global.wait:= :global.wait+1;
  
  if :global.wait = p_iteration then
  
  copy(:global.ini_value,p_item);
  set_item_property(p_item,foreground_color,'r100g100b50');
  :global.wait:=1;
  else
  if :global.wait = 1 then :global.ini_value:= :global.value; end if;

  for i in 1..v_length loop
  v_char := substr(:global.value,i,1);
  if v_char <> chr(32) then
  v_display := v_display||chr(32)||v_char;
  else 
  v_display := v_display||v_char;
  end if;
  end loop;
   
  --Display TEXT into the following item.
  --Change Visual Attribute.
  if mod(:global.wait,2)= 0 then
  set_item_property(p_item,foreground_color,'r100g100b50');
  v_item := rtrim(ltrim(v_display));
  copy(v_item,p_item); 
  else
  set_item_property(p_item,foreground_color,'r0g0b0');
  v_item := rtrim(ltrim(v_display));
  copy(v_item,p_item);  
  end if;
   
  end if;

  
exception
 when others then null;
end;

No comments:

Post a Comment