Press "Enter" to skip to content

Working With Push Buttons In Oracle Forms

Managing push buttons at run time in Oracle Forms is very simple and in this tutorial you will learn to enable or disable the buttons, making visible and invisible buttons and will learn to change the label text of a button.
In the below mentioned examples I am using toggle functionality for buttons, means if the button is enabled or visible then it will be disable or invisible by using Get_Item_Property and Set_Item_Property commands.
Below is the screen shot of the form and you can download the form from the following link:
Push Buttons example for Oracle Forms
To perform this functionality I used buttons and written the When-Button-Pressed trigger to make the changes in other button’s functionality.
The following is the code:

Making Button Toggle Enable / Disable

Begin
If Get_Item_Property(‘control.pb_endb’, enabled) = ‘FALSE’ Then
Set_Item_Property(‘control.pb_endb’, enabled, Property_True);
Else
Set_Item_Property(‘control.pb_endb’, enabled, Property_False);
End if;
End;

Making Button Toggle Visible / Invisible

Begin
If Get_Item_Property(‘control.pbvs’, Visible) = ‘FALSE’ Then
Set_Item_Property(‘control.pbvs’, Visible, Property_True);
— Make enable also
Set_Item_Property(‘control.pbvs’, Enabled, Property_True);
Else
Set_Item_Property(‘control.pbvs’, Visible, Property_False);
End if;
End;

Changing Label Text

Begin
If :control.txtbuttonlbl Is Not Null Then
Set_Item_Property(‘control.pblbl’, Label, :control.txtbuttonlbl);
End if;
End;