Forms 11g : PJCs sending back custom events to Forms
By francois degrelle on Friday, March 27 2015, 15:28 - PJC - Javabean - Permalink
Purpose
Here
is a Forms 11g Pluggable Java Component that allows sending back to the
Forms application each key pressed in a Text Item (single or
multi-line).
The single-line PJC extends the VTextField class.
The multi-line PJC extends the VTextArea class.
This PJC can only work with the Forms 11g version. It won't work with any older version like 10g or 9i.
The implementation class of the single-Line Text Item
oracle.forms.fd.KeyPressedTextItem
The implementation class of the multi-Line Text Item
oracle.forms.fd.KeyPressedTextArea
The methods you can call
Set the Java Console logging mode (true/false)
Set_Custom_Property('BLOCK.ITEM',1,'LOG','true|false');
By default, the logging mode is set to false.
e.g.:
-- set the logging on --
Set_Custom_Property( 'BL.TEXTITEM', 1, 'LOG', 'true' ) ;
The event fired by the PJCs
KEY_PRESSED
It is constituted by 3 parameters to get the key code, the key char and the key modifier.
To know what text item has just fired the event, ask the :SYSTEM.CURSOR_ITEM variable.
When-Custom-Item-Event:
DECLARE
eventName varchar2(30) := :system.custom_item_event;
eventValues ParamList;
eventValueType number;
LC$Code varchar2(25); -- code
LC$Char varchar2(25); -- char
LC$Modif varchar2(25); -- modifier
BEGIN
IF (eventName='KEY_PRESSED') THEN
eventValues := get_parameter_list(:system.custom_item_event_parameters);
get_parameter_attr(eventValues,'KEY_CODE',eventValueType, LC$Code);
get_parameter_attr(eventValues,'KEY_CHAR',eventValueType, LC$Char);
get_parameter_attr(eventValues,'KEY_MODIFIER',eventValueType, LC$Modif);
:BL.RESULT := :System.cursor_item || ' Key pressed:'|| LC$Code || ' (' || LC$Char||') '||' modif:'||LC$Modif ;
Synchronize ;
END;
The sample dialog
. Download the KeyPressed.zip file
. Unzip the file
. copy the keypressed.jar file in the <ORACLE_HOME>\Middleware\as_1\forms\java directory
. Edit your formsweb.cfg file to add the keypressed.jar to the archive tag.
<WEBLOGIC_HOME>\Middleware\user_projects\domains\ClassicDomain\config\fmwconfig\servers\WLS_FORMS\applications\formsapp_11.1.1\config\formsweb.cfg
. Open the KEYPRESSED11g.fmb module (Oracle Forms 11g)
. Compile all and run the module