Add buttons on the current canvas at runtime
By francois degrelle on Friday, March 27 2015, 14:39 - PJC - Javabean - Permalink
Purpose
This is a Java Bean that allows to add buttons on the current Forms canvas at runtime.
The Java code
Get the source code here
Forms configuration
. Copy the additem.jar file in the /forms/java directory
. Edit the /forms/server/formsweb.cfg file to add the jar file to the archive_jini variable
archive_jini=f90all_jinit.jar,……,additem.jar
Implementation Class property
oracle.forms.fd.AddItem
The properties you can set
Add a button
Set_Custom_Property( 'BLOCK.BEAN_ITEM', 1, 'ADD_BUTTON', 'button_settings' ) ;
Where button_settings is :
num_button, label, action_name, pos X, pos Y, Width, Height
e.g.
Set_Custom_Property( 'BL.BEAN', 1, 'ADD_BUTTON', '1,Button 1, BT1,10,10,100,20' ) ;
Note
: Notice that the Java coordinates are allways in pixels. So be careful
if your form module coordinate system is set to a different setting
(Points, Centimeters of Inch for example)
Set the Font
Set_Custom_Property( 'BLOCK.BEAN_ITEM', 1, 'SET_FONT', 'font_name,size' ) ;
e.g.
Set_Custom_Property( 'BL.BEAN', 1, 'SET_FONT', 'Arial,10' ) ;
Set the background and foreground colors
Set_Custom_Property( 'BLOCK.BEAN_ITEM', 1, 'SET_FG_COLOR', 'r,g,b' ) ;
Set_Custom_Property( 'BLOCK.BEAN_ITEM', 1, 'SET_BG_COLOR', 'r,g,b' ) ;
The properties you can get
Get the last pressed button's action name
Varchar2 := Get_Custom_Property( 'BLOCK.BEAN_AREA', 1, 'GET_BT_PRESSED' ) ;
The events you can raise to Forms
A button have been pressed
BUTTONPRESSED
The sample dialog
. Download the additem.zip file
. Unzip the file
. Edit your /forms/server/formsweb.cfg file
. Open the ADD_ITEM1.fmb module (Oracle Forms 9.0.2)
. Compile all and run the module