Adsense Ad

Monday, 12 February 2018

Oracle Forms: Progress Bar Solution - 3

Based on the percentage match

You can do this by using 2 nondatabase text fields. First - BACK- with lower border and white background, indicating range of bar, and second PROG, with i.e. red backgroud, without border, which drawing progress. In this simple example bar is growing on each button pressed till variable get 100%. Presented solution rely on covering backgroud item (BACK) by foregroud item (PROG) that width depending on percentage variable.

Progress bar block:

BAR

- PCG - text field, non canvas, number(4), default 0, Your percetage variable

- START - button, canvas

- BACK - text field, same canvas, non value, i.e. 229x29 (w x h)

- PROG - text field, same canvas, cover BACK item on layout, non value, i.e. 227 x 26 (w x h)

WHEN-NEW-FORM-INSTANCE:

Set_Item_Property('BAR.PROG',width,0);

(BAR.START) WHEN-BUTTON-PRESSED

declare
w_bar number(4);
begin 

--static increase by 20% on each button press till 100% 

if :BAR.PCG < 100 then
  :BAR.PCG := :BAR.PCG+20;
end if;

w_bar := trunc((:BAR.PCG*(Get_Item_Property('BAR.BACK',width)-2))/100);
Set_Item_Property('BAR.PROG',width,w_bar); 
end;

No comments: