Overblog
Suivre ce blog Administration + Créer mon blog
20 février 2006 1 20 /02 /février /2006 10:38

Purpose

This is a Java Bean that allows to add buttons on the current Forms canvas at runtime.

Add GUI component 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



Partager cet article
Repost0
16 février 2006 4 16 /02 /février /2006 16:23

Purpose

This is a JavaBean component that allows to edit a HTML styled text field.
You can use the Ctrl+B, Ctrl+I and Ctrl+U keys to toggle some simple attributes like Bold, Italic and Underline.



Html Pane


The java code

Get the source code here


Forms configuration

. Copy the htmlpane.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,……,htmlpane.jar


Implementation Class property

     oracle.forms.fd.HtmlPane


The properties you can set

Set the text

Set_Custom_Property( 'BL.BEAN_AREA', 1, 'SET_TEXT', 'html text' ) ;



Set the editable flag

Set_Custom_Property( 'BL.BEAN_AREA', 1, 'SET_EDIT', 'true|false' ) ;



The properties you can get

Get the HTML text

Varchar2 := Get_Custom_Property( 'BL.BEAN_AREA', 1, 'GET_TEXT' ) ;


The events you can raise from the Bean

     BEAN_QUITTED

raised when the Bean lose the focus to prevent Forms that its content may have changed.


The sample dialog

     . Download the htmlpane.zip file
     . Unzip the file
     . Edit your /forms/server/formsweb.cfg file
     . Open the HTML_PANE.fmb module (Oracle Forms 9.0.2)
     . Compile all and run the module





Partager cet article
Repost0
15 février 2006 3 15 /02 /février /2006 21:52

Purpose

Here is a (very) simple HTML browser.



This JavaBean component allows to browse some simple HTML pages inside the Oracle Forms frame.
It may be a good way to browse into local documents, like documentation html pages.

You can click on the hyperlinks to navigate through the content.



The Java code

Get the source code here


Forms configuration

     . Copy the htmlbrowser.jar file in the /forms/java directory
        This .jar file must be signed
     . Edit the /forms/server/formsweb.cfg file to add the jar file to the archive_jini variable

         archive_jini=f90all_jinit.jar,……,htmlbrowser.jar



Implementation Class property

     oracle.forms.fd.HtmlFrame


The properties you can set

The url to display

Set_Custom_Property( 'BLOCK.BEAN_AREA', 1, 'SETURL', 'new_url' ) ;

The HTML content to display

Set_Custom_Property( 'BLOCK.BEAN_AREA', 1, 'SETCONTENT', 'html_content' ) ;

Where html_content must be valid HTML source like : '<html><body><b>Hello there</b></body></html>'


The sample dialog

     . Download the htmlbrowser.zip file
     . Unzip the file
     . Edit your /forms/server/formsweb.cfg file
     . Open the HTML_BROWSER.fmb module (Oracle Forms 9.0.2)
     . Compile all and run the module




Partager cet article
Repost0
14 février 2006 2 14 /02 /février /2006 18:02

Purpose

Here is a Java Bean component to read the Forms applet parameters

Applet Properties


The java code

Get the source code here


Forms configuration

Copy the appletproperties.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,……,appletproperties.jar



Implementation Class property

     oracle.forms.fd.AppletProperties


Properties you can set

The parameter you want to read

Set_Custom_Property( 'BLOCK.BEAN_AREA', 1, 'SET_PARAM', 'param_name' ) ;
e.g.
Set_Custom_Property( 'BL.BEAN', 1, 'SET_PARAM', 'colorScheme' ) ;


Properties you can read

Get all the properties in a string

Varchar2 := Get_Custom_Property( 'BLOCK.BEAN_AREA', 1, 'GET_INFOS' ) ;

Get a particular property

Varchar2 := Get_Custom_Property( 'BL.BEAN', 1, 'GET_PARAM' ) ;
(assume that you have just set this property before with the SET_PARAM ID.)


The sample dialog

     . Download the appletproperties.zip file
     . Unzip the file
     . Edit your /forms/server/formsweb.cfg file
     . Open the APPLETPROPERTIES.fmb module (Oracle Forms 9.0.2)
     . Compile all and run the module






Partager cet article
Repost0
9 février 2006 4 09 /02 /février /2006 15:54

Purpose

This is a Javabean component that displays a JTable inside/outside of a Forms module.
It allows saving the data modified through the JTable into the database.

(A special version - fjtable16.jar - permits to sort the JTable on any column, if you use the Sun Java Plug-in 1.6 or later)


JTable inside
JTable inside




The java code


FJTable.java


Forms configuration

  • . Copy the fjtable.jar file in the /forms/java directory
    (If you use the Sun JRE 1.6, use the fjtable16.jar instead that allows sorting the JTable)
  • . Edit the /forms/server/formsweb.cfg file to add the jar file to the archive and archive_jini tags

with JInitiator or Sun Plug-in < 1.6
archive_jini=
f90all_jinit.jar,……,fjtable.jar

archive=f90all_jinit.jar,……,fjtable.jar

with Sun Plug-in >= 1.6
archive_jini=
f90all_jinit.jar,……,fjtable16.jar

archive=f90all_jinit.jar,……,fjtable16.jar



Implementation Class property

    oracle.forms.fd.FJTable



Properties you can set


The horitontal/vertical lines

Set_Custom_Property( 'BL1.JTABLE', 1, 'SET_HORIZONTAL_LINE', 'true|false' ) ;
Set_Custom_Property( 'BL1.JTABLE', 1, 'SET_VERTICAL_LINE', 'true|false' ) ;


The data separator's character

Set_Custom_Property( 'BL1.JTABLE', 1, 'SETSEPARATOR', 'char_separator' ) ;

e.g.
Set_Custom_Property( 'BL1.JTABLE', 1, 'SETSEPARATOR', '^' ) ;


The table frame bounds (for seperate frame)

set_custom_property( 'BLOCK.BEAN_ITEM', 1, 'SETBOUNDS', 'x,y,w,h');


The header colors

set_custom_property( 'BLOCK.BEAN_ITEM', 1, 'SETHEADBG', 'rgb color');
set_custom_property( 'BLOCK.BEAN_ITEM', 1, 'SETHEADFG', 'rgb color');

e.g.
set_custom_property( 'BLOCK.BEAN_ITEM', 1, 'SETHEADFG', '255,0,128');


The selected area colors

set_custom_property( 'BLOCK.BEAN_ITEM', 1, 'SET_SELECTION_BACKGROUND', 'rgb color');
set_custom_property( 'BLOCK.BEAN_ITEM', 1, 'SET_SELECTION_FOREGROUND', 'rgb color');

e.g.
set_custom_property( 'BLOCK.BEAN_ITEM', 1, 'SET_SELECTION_BACKGROUND', '255,0,128');

 

The number of columns/rows of the table

Set_Custom_Property( 'BL1.JTABLE', 1, 'SETARRAYSIZE', 'cols,rows' ) ;

This method must be used first, before defining header, datas, format, etc.


The columns header

set_custom_property( 'BLOCK.BEAN_ITEM', 1, 'SETHEADER', 'col1[^coln]');

e.g.
set_custom_property( 'BLOCK.BEAN_ITEM', 1, 'SETHEADER', 'EmpNO^Ename^DeptID);



Set the data

set_custom_property( 'BLOCK.BEAN_ITEM', 1, 'SETDATA', 'data1[^datan]');

To seperate the data, use the separator indicated in the SETSEPARATOR() method.

e.g.
set_custom_property( 'BLOCK.BEAN_ITEM', 1, 'SETDATA', '1^Hello there^2000);


Set the relative cell value

set_custom_property( 'BLOCK.BEAN_ITEM', 1, 'SET_CELL_VALUE', '-sep-Row-sep-Cell-sep-data[-sep-set_focus]');

-sep- is the separator character used in the method. It must be indicated at the very first character, then after, used in the string to seperate the values.
Row is the row number (starts with 1)
Cell is the cell number (starts with 1)
set_focus (not required) set the focus to the cell if true 

e.g.
Set_Custom_Property( 'BL1.JTABLE', 1, 'SET_CELL_VALUE', '^1^3^new data' ) ;
Set_Custom_Property( 'BL1.JTABLE', 1, 'SET_CELL_VALUE', '|1|3|new data' ) ;
-- set the cell value then move the focus to this cell --
Set_Custom_Property( 'BL1.JTABLE', 1, 'SET_CELL_VALUE', '^1^3^new data^true' ) ;


Set the current cell Value

set_custom_property( 'BLOCK.BEAN_ITEM', 1, 'SET_CURRENT_CELL_VALUE', 'data');

It uses the current selected cell.

e.g.
Set_Custom_Property( 'BL1.JTABLE', 1, 'SET_CURRENT_CELL_VALUE', 'new data' ) ;


The table title (for seperate frame)

set_custom_property( 'BLOCK.BEAN_ITEM', 1, 'SETTITLE', 'the_title');

 

The default date format (java format)

Set_Custom_Property( 'BL1.JTABLE', 1, 'SET_DATE_FORMAT', 'format' ) ;

e.g.
Set_Custom_Property( 'BL1.JTABLE', 1, 'SET_DATE_FORMAT', 'dd/MM/yyyy' ) ;

You must use a Java format compatible with the PL/SQL one to avoid insertion/update error at commit time.
Here is a When-New-Form-Instance code sample used for this purpose:

 -- Java format masks --
 :GLOBAL.LC$DJavaFormat := 'dd/MM/yyyy' ; // date format
 :GLOBAL.LC$NJavaFormat := '#0.00' ;      // numeric format
 :GLOBAL.LC$IJavaFormat := '##########' ; // integer format
 -- PL/SQL format masks --
 :GLOBAL.LC$DPLSFormat  := 'dd/mm/yyyy' ;
 :GLOBAL.LC$NPLSFormat  := '999,990.00' ;
 :GLOBAL.LC$NUMSEPARATORS := '.,' ;   

  set_application_property(PLSQL_DATE_FORMAT, :GLOBAL.LC$DPLSFormat);
  set_application_property(BUILTIN_DATE_FORMAT, :GLOBAL.LC$DPLSFormat);
  forms_ddl('ALTER SESSION SET NLS_DATE_FORMAT = '''|| :GLOBAL.LC$DPLSFormat || '''');
  forms_ddl('ALTER SESSION SET NLS_NUMERIC_CHARACTERS = '''|| :GLOBAL.LC$NUMSEPARATORS || '''');
  Set_Custom_Property( 'BL1.JTABLE', 1, 'SET_DECIMAL_SEPARATORS', :GLOBAL.LC$NUMSEPARATORS ) ;
  Set_Custom_Property( 'BL1.JTABLE', 1, 'SET_DATE_FORMAT', :GLOBAL.LC$DJavaFormat ) ;


The default number format (java format)

Set_Custom_Property( 'BL1.JTABLE', 1, 'SET_NUM_FORMAT', 'format' ) ;

e.g.
Set_Custom_Property( 'BL1.JTABLE', 1, 'SET_NUM_FORMAT', '###,##0.00' ) ;


The numeric separators

Set_Custom_Property( 'BL1.JTABLE', 1, 'SET_DECIMAL_SEPARATORS', 'decimal_character,group_character' ) ;

e.g.
Set_Custom_Property( 'BL1.JTABLE', 1, 'SET_DECIMAL_SEPARATORS', '.,' ) ;

 

The column types

Set_Custom_Property( 'BL1.JTABLE', 1, 'SET_COLS_TYPE', 'type[,type[,...]]' ) ;

each column can have a type description, CHAR, INTEGER, NUMBER, IMAGE or DATE
If this method is not used, the default type is CHAR for every column.

e.g.
Set_Custom_Property( 'BL1.JTABLE', 1, 'SET_COLS_TYPE', 'CHAR^INTEGER^CHAR^CHAR^DATE^NUMBER' ) ;

 

The column moving property

Set_Custom_Property( 'BL1.JTABLE', 1, 'SET_REORDER_COLUMNS', 'true|false' ) ;


e.g.
Set_Custom_Property( 'BL1.JTABLE', 1, 'SET_REORDER_COLUMNS', 'false' ) ;

 

The column resizing property

Set_Custom_Property( 'BL1.JTABLE', 1, 'SET_RESIZE_COLUMNS', 'true|false' ) ;


e.g.
Set_Custom_Property( 'BL1.JTABLE', 1, 'SET_RESIZE_COLUMNS', 'false' ) ;

 

The row height

Set_Custom_Property( 'BL1.JTABLE', 1, 'SET_ROW_PROPERTY', 'HEIGHT|new_size' ) ;


e.g.
Set_Custom_Property( 'BL1.JTABLE', 1, 'SET_ROW_PROPERTY', 'HEIGHT|40' ) ;

 

The cell property

Set_Custom_Property( 'BL1.JTABLE', 1, 'SET_CELL_PROPERTY', 'column_name|property_set' ) ;

note : the columns must have been defined by the SETHEADER method, before you can use the SET_CELL_PROPERTY method.

property_set could be one of the following:

  • ENABLE : true or false
  • FORMAT : format mask (Java syntax)
  • ALIGNMENT : LEFT or CENTER or RIGHT
  • FONT : font_name | font_size | font_wheight (N, B, I, BI)
  • BG_COLOR : red_value,green_value,blue_value
  • FG_COLOR : red_value,green_value,blue_value
  • WIDTH : width_in_pixel
  • MIN_WIDTH : minimum width allowed for the column
  • MAX_WIDTH : maximum width allowed for the column
  • RESIZE : true or false
  • TITLE : new_title

Because you can have commas in the property value (in number format for instance), the separator character is | (alt-124) for this method.

e.g.
Set_Custom_Property( 'BL1.JTABLE', 1, 'SET_CELL_PROPERTY', 'MGR|ENABLE|false' ) ;
Set_Custom_Property( 'BL1.JTABLE', 1, 'SET_CELL_PROPERTY', 'SAL|FORMAT|0,000,000.00' ) ;
Set_Custom_Property( 'BL1.JTABLE', 1, 'SET_CELL_PROPERTY', 'HIREDATE|ALIGNMENT|CENTER' ) ;
Set_Custom_Property( 'BL1.JTABLE', 1, 'SET_CELL_PROPERTY', 'EMPNO|FONT|Tahoma|14|B' ) ;
Set_Custom_Property( 'BL1.JTABLE', 1, 'SET_CELL_PROPERTY', 'HIREDATE|BG_COLOR|230,230,255' ) ;
Set_Custom_Property( 'BL1.JTABLE', 1, 'SET_CELL_PROPERTY', 'EMPNO|WIDTH|50' ) ;
Set_Custom_Property( 'BL1.JTABLE', 1, 'SET_CELL_PROPERTY', 'EMPNO|MIN_WIDTH|40' ) ;
Set_Custom_Property( 'BL1.JTABLE', 1, 'SET_CELL_PROPERTY', 'EMPNO|MAX_WIDTH|100' ) ;
Set_Custom_Property( 'BL1.JTABLE', 1, 'SET_CELL_PROPERTY', 'EMPNO|TITLE|New title' ) ;
Set_Custom_Property( 'BL1.JTABLE', 1, 'SET_CELL_PROPERTY', 'EMPNO|RESIZE|false' )


The data colors

-- background color --
Set_Custom_Property( 'BL1.JTABLE', 1, 'SETDATABG', '255,255,255' ) ;
-- foreground color --
Set_Custom_Property( 'BL1.JTABLE', 1, 'SETDATAFG', '0,0,0' ) ;


The image size

Use this method to scale the images retrieved from the database.
This method has to be used before the data are fetched, so before using the Set_Data() method.

-- Image width 200 pixel and keep height aspect ratio --
Set_Custom_Property( 'BL1.JTABLE', 1, 'SET_IMAGE_SIZE', '200,-1' ) ;
-- prepare column width for images -- 
Set_Custom_Property( 'BL1.JTABLE', 1, 'SET_ROW_PROPERTY', 'HEIGHT|80' ) ;
Set_Custom_Property( 'BL1.JTABLE', 1, 'SET_CELL_PROPERTY', 'PHOTO|WIDTH|200' ) ;


Send an image to the Java Bean (JTable)

Use this method to send the content of a Blob database column, supposed to store an image.
The process is split into 3 phases:

  • prepare the Java Bean to process the image by giving its JTable coordinates (Row,Cell)
  • send the chunks of data to the Bean
  • stop the sending process

---------------------
--  send an image  --
---------------------

-- prepare the SQL order to select the required database row --
LC$Query := 'Select PHOTO From IMAGES Where PK=12';
-- query the database --
If Pkg_Read_Blob_Image.Select_Blob(LC$Query) Then
   -- set the JTable image index --
   -- e.g. Row 1, Cell 2         --
   Set_Custom_Property( 'BL1.JTABLE', 1, 'SET_IMAGE', '[INDEX_IMAGE],1,2) ;
   Loop
      -- get image chunk from the Blob column --
      LC$Image := Pkg_Read_Blob_Image.Get_B64_Chunk ;
      If LC$Image Is Not Null Then
         -- send chunk to the Java Bean --
         Set_Custom_Property( 'BL1.JTABLE', 1, 'SET_IMAGE', LC$Image ) ;
      Else
         -- stop the sending process --
         Set_Custom_Property( 'BL1.JTABLE', 1, 'SET_IMAGE', '[END_IMAGE]' ) ;
         Exit ;
      End if ;
   End loop ;
End if ;
       

Needs the PKG_READ_BLOB_IMAGE given package compiled under the corresponding Oracle user.

- The Blob column is selected with the Select_Blob() package's function (the given SELECT order must retrieve one and only one row).
- The chunks of data are read from the Blob column with the Get_B64_Chunk() package's function.


The grid color

set_custom_property( 'BLOCK.BEAN_ITEM', 1, 'SETGRIDFG', '120,120,40');


The table updatable flag

set_custom_property( 'BLOCK.BEAN_ITEM', 1, 'SETUPDATE', 'true|false');


Init (reset all values)

set_custom_property( 'BLOCK.BEAN_ITEM', 1, 'INIT', '');


Set the cell coordinate we want to get the value

set_custom_property( 'BLOCK.BEAN_ITEM', 1, 'SETCELLPOS', 'row,cell');

row and cell start with 1 (cell can be given by name as well as position).


Set the row coordinate we want to get the values

set_custom_property( 'BLOCK.BEAN_ITEM', 1, 'SETROWPOS', 'row');

row starts with 1.

 


Get the current column name (title)

v_colname := get_custom_property( 'BLOCK.BEAN_ITEM', 1, 'GETCELLNAME');
 

 


Show the table

set_custom_property( 'BLOCK.BEAN_ITEM', 1, 'SHOW', 'seperate_flag');

seperate_flag can be true or false



Special JRE 16 version properties


Total line


Add a total line at table bottom


-- total line operator labels --
Set_Custom_Property( 'BL1.JTABLE', 1, 'SET_TOTAL_LINE_LABELS', 'COUNT=Count,SUM=Sum,AVG=Average,MAX=Min,MIN=Max' ) ;

-- total line operators --
Set_Custom_Property( 'BL1.JTABLE', 1, 'SET_TOTAL_LINE', 'col1=COUNT,col2=SUM,col3=AVG' ) ;

Operators allowed:

  • COUNT
  • SUM
  • AVG
  • MAX
  • MIN


Only COUNT can be used on non-numeric columns.
This method must be used after the table header is defined.


Headers' height


Set the main table header height


Set_Custom_Property( 'BL1.JTABLE', 1, 'SET_HEADER_HEIGHT', '20' ) ;

 Set the total table header height

Set_Custom_Property( 'BL1.JTABLE', 1, 'SET_TOTAL_HEADER_HEIGHT', '0' ) ;

  

Check Boxes

-- Set the checkbox property for a column --
Set_Custom_Property( 'BL1.JTABLE', 1, 'SET_CELL_PROPERTY', 'col5|CHECKBOX|O,N' ) ;

parameter is: column_name | CHECKBOX | value_when_checked,value_when_unchecked

This methods has to be used after the SETHEADER() and SET_COLS_TYPE() methods, but before the SETDATA() method.

e.g.:s
...
-- Set the hearders' columns
Set_Custom_Property( 'BL1.JTABLE', 1, 'SETHEADER', ... ) ; 
-- Set the hearders' columns type
Set_Custom_Property( 'BL1.JTABLE', 1, 'SET_COLS_TYPE', ... ) ;
-- Set the checkbox property --
Set_Custom_Property( 'BL1.JTABLE', 1, 'SET_CELL_PROPERTY', 'col5|CHECKBOX|O,N' ) ;

-- set the DATA --
Set_Custom_Property( 'BL1.JTABLE', 1, 'SETDATA', ... ) ;
Set_Custom_Property( 'BL1.JTABLE', 1, 'SETDATA', ... ) ;
...


General table background color

Set_Custom_Property( 'BL1.JTABLE', 1, 'SETTABLEBG', '200,255,255' ) ; 


Maximim column width 

Indicates that none of the columns can exceed the given size (in pixel)

Set_Custom_Property( 'BL1.JTABLE', 1, 'SET_COLS_MAX_WIDTH', '200' ) ; 

 

Filter

This is usefull to filter the data displayed in the table.

Set_Custom_Property( 'BL1.JTABLE', 1, 'SET_FILTER', '[colname,]regex|null' ) ;

filter on "C" for all column:
Set_Custom_Property( 'BL1.JTABLE', 1, 'SET_FILTER', 'C' ) ;

filter on "C" for COL1 column:
Set_Custom_Property( 'BL1.JTABLE', 1, 'SET_FILTER', 'COL1,C' ) ;

regex must be a valid Regular Expression.

Use the special value 'null' to clear the filter

 

You can test these new properties by running the JTABLE16.fmb provided in the zip file.
It uses the "FJTABLE_TEST" table, that you can find the creation script (fjtable_test.sql) in the zip too.
Use the fjtable16.jar file in your /forms/java folder and archive tag.


 

Properties that can be read

Get a particular cell value (located by the SETCELLPOS property)

varchar2 := get_custom_property( 'BLOCK.BEAN_ITEM', 1, 'GETCELLVAL');


Get a particular row values (located by the SETROWPOS property)

varchar2 := get_custom_property( 'BLOCK.BEAN_ITEM', 1, 'GETROWVAL');


Get the list of changed rows

varchar2 := get_custom_property( 'BLOCK.BEAN_ITEM', 1, 'GET_ROWS_CHANGED');

This list is comma delimited. you can get the tokens by using the provided Forms' PKG_TABLE.Split() function.

 


Events raised

A cell has been updated : POST_CHANGE
A row has been selected : NEW_RECORD_INSTANCE
A cell has been selected : NEW_ITEM_INSTANCE
Mouse clicked : WHEN-MOUSE-CLICK
Mouse doubleclicked : WHEN-MOUSE-DOUBLECLICK

You can know what cell has been edited through the TABLE_EVENT_MSG parameter:

When-Custom-Item-Event:

DECLARE
   
    eventName varchar2(30) := :system.custom_item_event;
    eventValues ParamList;
    eventValueType number;
    LC$Value  varchar2(256);
   
BEGIN
   
   IF (eventName='POST_CHANGE') THEN
      eventValues := get_parameter_list(:system.custom_item_event_parameters);
      get_parameter_attr(eventValues,'TABLE_EVENT_MSG',eventValueType, LC$Value);
      Clear_Message;
      Message('POST-CHANGE:'|| LC$Value);
      Synchronize ;           
   ElsIf (eventName='NEW_RECORD_INSTANCE') THEN
      eventValues := get_parameter_list(:system.custom_item_event_parameters);
      get_parameter_attr(eventValues,'TABLE_EVENT_MSG',eventValueType, LC$Value);
      :GLOBAL.CURRENT_ROW := LC$Value ;
      Clear_Message;
      Message('When-New-Record-Instance:'|| LC$Value);
      Synchronize ;
   ElsIf (eventName='NEW_ITEM_INSTANCE') THEN
      eventValues := get_parameter_list(:system.custom_item_event_parameters);
      get_parameter_attr(eventValues,'TABLE_EVENT_MSG',eventValueType, LC$Value);
      :GLOBAL.CURRENT_CELL := LC$Value ;
      Clear_Message;
      Message('When-New-Item-Instance:'|| LC$Value);
      Synchronize ;
   End if ;  
   If (eventName='WHEN-MOUSE-DOUBLECLICK') THEN
      eventValues := get_parameter_list(:system.custom_item_event_parameters);
      get_parameter_attr(eventValues,'TABLE_EVENT_MSG',eventValueType, LC$Value);
      Clear_Message;
      Message('When-Mouse-DoubleClick:'|| LC$Value);
      Synchronize ;                 
   ElsIf (eventName='WHEN-MOUSE-CLICK') THEN
      eventValues := get_parameter_list(:system.custom_item_event_parameters);
      get_parameter_attr(eventValues,'TABLE_EVENT_MSG',eventValueType, LC$Value);
      Clear_Message;
      Message('When-Mouse-Clicked:'|| LC$Value);
      Synchronize ;                 
   END IF;

   
END;


The sample dialog

  • Download the JTable.zip file
  • Unzip the JTable.zip file
  • Compile both PKG_READ_BLOB_IMAGE.pks and PKG_READ_BLOB_IMAGE.pkb scripts in the database
  • Copy the fjtable.jar file in your /forms/java/ directory (the JAR file must be signed)
    (use the fjtable13.jar in the archive_jini if you use the JInitiator)
  • Edit your /forms/server/formsweb.cfg file
  • Open the JTABLE.fmb module (Oracle Forms 9.0.2)
  • Compile all and run the module


_bug_fck

Partager cet article
Repost0
9 février 2006 4 09 /02 /février /2006 10:10

Purpose

This is a Javabean component that allows to intercept each key typed in a text field


Key Typed

Then, there is no need to use a Forms timer to intercept each key typed.

The java code


      Get the Java code here


Forms configuration

  • . Copy the keytyped.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,……,keytyped.jar

 
Implementation Class property

    oracle.forms.fd.KeyTyped



Properties that can be set

The text of the item

set_custom_property( 'BLOCK.BEAN_ITEM', 1, 'SETTEXT', 'the_text');


The position of the cursor


set_custom_property( 'BLOCK.BEAN_ITEM', 1, 'SETPOS', 'n');


The colors of the item


set_custom_property( 'BLOCK.BEAN_ITEM', 1, 'SETBG', 'rgb value');
set_custom_property( 'BLOCK.BEAN_ITEM', 1, 'SETFG', 'rgb value');

e.g.
set_custom_property( 'BLOCK.BEAN_ITEM', 1, 'SETBG', '200,10,0');


Properties that can be read

The text of the item

get_custom_property( 'BLOCK.BEAN_ITEM', 1, 'GETTEXT', '');


The last character typed


get_custom_property( 'BLOCK.BEAN_ITEM', 1, 'GETCHAR', '');



The keyboard state modifier

get_custom_property( 'BLOCK.BEAN_ITEM', 1, 'GETMODIFIER', '');




Events that can be raised by the bean

A character was typed

KEYTYPED


The sample dialog

  • . Download the KeyTyped.zip file
  • . Unzip the KeyTyped.zip file
  • . Copy the keytyped.jar file in your /forms/java/ directory
  • . Edit your /forms/server/formsweb.cfg file
  • . Open the KEYTYPED.fmb module (Oracle Forms 9.0.2)
  • . Compile all and run the module

     



Partager cet article
Repost0
7 février 2006 2 07 /02 /février /2006 10:27

Purpose

This is a Javabean component that allows to replace the internal Oracle Forms’ timer


Bean Timer

The java code


package oracle.forms.demo;

import oracle.forms.handler.IHandler;
import oracle.forms.ui.CustomEvent;
import oracle.forms.properties.ID;
import oracle.forms.ui.VBean;

import oracle.forms.engine.Main;
import oracle.forms.engine.*;
import oracle.forms.handler.*;

public class Timer extends VBean implements Runnable
{
    static Thread runner ;
    static int seconds = 0 ;
    static IHandler mHandler;
    protected static final ID TIMEREXPIRED   = ID.registerProperty("TimerExpired");
    protected static final ID pInitTimer     = ID.registerProperty("initTimer");
    protected static final ID pStartTimer    = ID.registerProperty("Start");
    protected static final ID pStopTimer     = ID.registerProperty("Stop");

    public Timer()
    {
      super();
    }

    public void init(IHandler handler)
    {
      super.init(handler);
      mHandler = handler;
      System.out.println("*** oracle.forms.demo.Timer Init ***") ;
    }     

    private void startTimer()
    {
      if (runner == null )
      {
        runner = new Thread(this);
        runner.start();
      }
    }
   
    private static void stopTimer()
    {
      if (runner != null )
      {
        runner = null;
      }
    }   

    public void run()
    {
      Thread theThread = Thread.currentThread();
      while (runner == theThread)
      {
        try{
        Thread.sleep(seconds);
        } catch (InterruptedException e) { }
        dispatch_event() ;
      }
    }   
   
    public boolean setProperty(ID _ID, Object _args)
    {
     if(_ID==pInitTimer)
     {
       System.out.println("milliseconds=" + (String)_args) ;      
       seconds = new Integer((String)_args).intValue() ;
       return true;      
      }

     else if (_ID == pStartTimer)
     {
        System.out.println("Start") ;      
        startTimer() ;
        return true;
     }

     else if (_ID == pStopTimer)
      {
        stopTimer() ;
        return true;
      }    
     else
        {
          return true;
        }     
    }

    public void dispatch_event()
    {
        CustomEvent ce = new CustomEvent(mHandler, TIMEREXPIRED);
        dispatchCustomEvent(ce);
    }
}


Forms configuration

  • . Copy the bean_timer.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,……,bean_timer.jar

 
Implementation Class property

    oracle.forms.demo.Timer



Properties that can be set

The frequency of expiration

set_custom_property( 'BLOC3.BEAN_ITEM', 1, 'initTimer', 'number_of_milliseconds');


Start the timer

set_custom_property( 'BLOCK.BEAN', 1, 'Start', '');


Stop the timer


set_custom_property( 'BLOCK.BEAN', 1, 'Stop', '');


The sample dialog

  • . Download the beantimer.zip file
  • . Unzip the beantimer.zip file
  • . Copy the beantimer.jar file in your /forms/java/ directory
  • . Edit your /forms/server/formsweb.cfg file
  • . Open the bean_timer.fmb module (Oracle Forms 9.0.2)
  • . Compile all and run the module

      

This dialog allows to enter the frequency of the timer, start (showing the time in real-time) and stop the timer. 
The code that captures the java event is located in the WHEN-CUSTOM-ITEM-EVENT trigger of the bean item.



When-Custom-Item-Event
:BLOCK2.HEURE := SYSDATE ;
Synchronize ;
Partager cet article
Repost0
3 février 2006 5 03 /02 /février /2006 17:30

Purpose

This bean allows to display buttons with a html content.
The content can be text or image.


On the screenshot below, we can see a button with an image that comes from an internet url
(<img src="http://....">)


HtmlButton

The java code


package oracle.forms.fd;

import java.awt.*;
import java.awt.event.*;

import java.util.StringTokenizer;
import javax.swing.JButton;
import oracle.forms.ui.CustomEvent;
import oracle.forms.ui.VBean;
import oracle.forms.ui.VButton;
import oracle.ewt.button.PushButton;
import oracle.forms.handler.IHandler;
import oracle.forms.properties.ID;
import oracle.forms.properties.Property;

/**
 * A javabean to display buttons with HTML content
 *
 * @author Francois Degrelle
 * @version 1.0
 */

public class HtmlButton  extends VBean implements ActionListener
{
  public final static ID SetLabel      = ID.registerProperty("SETLABEL"); 
  public final static ID SetBG         = ID.registerProperty("SETBACKGROUND");   
  public final static ID WBP           = ID.registerProperty("BUTTONPRESSED");   
  private IHandler  m_handler; 
  protected JButton b1  ;
 
  public HtmlButton()
  {
     super();
     b1 = new JButton(""); 
     b1.setActionCommand("push");
     b1.addActionListener(this);
     add(b1) ;

  }
     
  public void actionPerformed(ActionEvent e) {
        CustomEvent ce = new CustomEvent(m_handler, WBP);
        dispatchCustomEvent(ce);
    }
   
  public void init(IHandler handler)
  {
    m_handler = handler;
    super.init(handler);
  }     
 
 
  public boolean setProperty(ID property, Object value)
  {
    if (property == SetLabel)
    {
      String label = value.toString().trim();
      b1.setLabel(label);
      return true;
    }
    else if (property == SetBG)
    {
      String color = value.toString().trim();
      int r=-1, g=-1, b=-1, c=0 ;
      StringTokenizer st = new StringTokenizer(color,",");
      while (st.hasMoreTokens()) {
               c = new Integer((String)st.nextToken()).intValue()  ;
               if( (c <0) || (c > 255) ) c = 0 ;
               if( r == -1 ) r = c ;
               else if( g == -1 ) g = c ;
               else if( b == -1 ) b = c ;
             }
      b1.setBackground( new Color(r, g, b)) ;
      return true;
    }
    else
    {
     return super.setProperty(property, value);
    }
  }
 
}


Forms configuration

  • Copy the htmlbutton.jar file in the /forms/java directory
  • Sign the htmlbutton.jar file with your own certificate
  • Edit the /forms/server/formsweb.cfg file to add the jar file to the archive_jinit variable
archive_jini=f90all_jinit.jar,……,htmlbutton.jar


Implementation Class property

    oracle.forms.fd.HtmlButton
 



Properties that can be set

The background color of the button

Set_Custom_Property( 'BLOC3.BEAN_ITEM',1, 'SETBACKGROUND','rgb_color' ) ;


The label


Set_Custom_Property( ‘BLOCK.BEAN_ITEM’, ‘SETLABEL’, ‘the_label’ ) ;



The sample dialog

  • Download the htmlbutton.zip file
  • Unzip the htmlbutton.zip file
  • Copy the htmlbutton.jar file in your /forms/java/ directory
  • Edit your /forms/server/formsweb.cfg file
  • Open the HTML_BUTTON.fmb module (Oracle Forms 9.0.2)
  • Compile all and run the module

      

The code that set the button properies is located in the When-New-Form-Instance trigger

 -------------------
  --  Text button  --
  -------------------
 -- Set the background color --
  Set_Custom_Property( 'BLOC3.BEAN',1, 'SETBACKGROUND','143,161,253' ) ;
 
  -- Set the label --
  LC$ButLabel := '<html><center>'
  || '<font size=5 color=#ff0000>Co<font size=5 color=#00ff00>lo<font size=5 color=#0000ff>red</u></b></font>'
  || '<br><font size=3 color=#ffff00><b>HTML B</b><i>utton</i></font>'  ;
 
  Set_Custom_Property( 'BLOC3.BEAN',1, 'SETLABEL', LC$ButLabel ) ;
 
  --------------------
  --  Image button  --
  --------------------
 -- Set the background color --
  Set_Custom_Property( 'BLOC3.BEAN2',1, 'SETBACKGROUND','255,255,255' ) ;
  LC$ButLabel := '<html><table border="1"><tr><td align="center" valign="center"><img src="
http://fdtool.free.fr/forms-pjc-bean/tmp/will.jpg" height="80" width="80" align="middle"></td></tr></table>' ;
  Set_Custom_Property( 'BLOC3.BEAN2',1, 'SETLABEL', LC$ButLabel ) ;





Partager cet article
Repost0
3 février 2006 5 03 /02 /février /2006 15:24

Purpose

When you want to load images from the client machine to the database, you would like
to choose the right image file with a preview of each image.

This is a Javabean component that allows to display a JfileChooser dialog box with image preview.
It also allows to display at the same time different file types.



ImageFileChooser

The java code


Get the complete code here


Forms configuration

  • Copy the GetImageFileName.jar file in the /forms/java directory
  • Sign the GetImageFileName.jar file with your own certificate
  • Edit the /forms/server/formsweb.cfg file to add the jar file to the archive_jinit variable
archive_jini=f90all_jinit.jar,……,GetImageFileName.jar


Registring the bean

- Open the form
- Add a javabean component to any block
- Register the bean (be sure that it is not in a When-New-Form-Instance trigger, or use a timer)

 



FBean.Register_Bean('BLOCK.BEAN_ITEM',1,'oracle.forms.fd.GetImageFileName');

 

 


Invoke the bean's GetFile() function


image_file_name := FBean.Invoke_char('BLOCK.BEAN_ITEM',1,'GetFile','"Dialog box title","start directory"');

 e.g.


 

 

 :BL1.File := FBean.Invoke_char('BL1.IMAGEPICKER',1,'GetFile','"Select an image file name","M:\"');


The sample dialog

  • Download the imagefilechooser.zip file
  • Unzip the imagefilechooser.zip file
  • Copy the imagefilechooser.jar file in your /forms/java/ directory
  • Edit your /forms/server/formsweb.cfg file
  • Open the IMAGEFILECHOOSER.fmb module (Oracle Forms 9.0.2)
  • Compile all and run the module

     
Partager cet article
Repost0
2 février 2006 4 02 /02 /février /2006 17:11

Purpose

This bean allows to display a Jslider component in your Forms application.


JSlider bean

The java code


 package oracle.forms.fd;

import java.awt.*;
import java.awt.event.*;
import java.util.StringTokenizer;
import javax.swing.JSlider;
import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener;
import oracle.forms.ui.CustomEvent;
import oracle.forms.ui.VBean;
import oracle.forms.handler.IHandler;
import oracle.forms.properties.ID;

/**
 * A javabean to display Sliders in Forms
 *
 * @author Francois Degrelle
 * @version 1.0
 */


public class Slider  extends VBean implements ChangeListener
{
  public final static ID SetBG         = ID.registerProperty("SETBGCOLOR");    
  public final static ID SetFG         = ID.registerProperty("SETFGCOLOR");      
  public final static ID ValueChanged  = ID.registerProperty("VALUECHANGED");    
  public final static ID SetBounds     = ID.registerProperty("SETBOUNDS");      
  public final static ID SetValue      = ID.registerProperty("SETVALUE");          
  public final static ID GetValue      = ID.registerProperty("GETVALUE");        
  private IHandler  m_handler;  

  static int iValue = 0 ;             // current value variable
  protected JSlider slide  ;          // Slider pointer
  protected Color BGcolor, FGcolor  ; // Slider colors

  public Slider()
  {
    super();
    // create a new JSlider
    slide = new JSlider();

    slide.addChangeListener(this);
    slide.setPaintTrack(true);
    slide.setPaintTicks(true);
    slide.setPaintLabels(true);

    add(slide);
  }
 
  // Fires when the JSlider is modified
  public void stateChanged(ChangeEvent e) {
      JSlider source = (JSlider)e.getSource();
      if (!source.getValueIsAdjusting()) {
          iValue = (int)source.getValue();
          // Dispatch event
          CustomEvent ce = new CustomEvent(m_handler, ValueChanged);
          dispatchCustomEvent(ce);
      }
  }

  public void init(IHandler handler)
  {
    m_handler = handler;
    super.init(handler);
  }      

  public boolean setProperty(ID property, Object value)
  {

    if (property == SetBG) // Set the background color
    {
      String color = value.toString().trim();
      System.out.println("BG="+color) ;
      int c=0, i=0, r=0, g=0, b=0 ;
      StringTokenizer st = new StringTokenizer(color,",");
      while (st.hasMoreTokens()) {
               c = new Integer((String)st.nextToken()).intValue()  ;
               if( i == 0)  r = c;  
               if( i == 1 ) g = c ;
               if( i == 2 ) b = c ;
               i++;
             }      
      BGcolor = new Color(r,g,b);
      slide.setBackground(BGcolor);
      return true;
    }
    else if (property == SetFG) // Set the foreground color
    {
      String color = value.toString().trim();
      System.out.println("FG="+color) ;
      int c=0, i=0, r=0, g=0, b=0 ;
      StringTokenizer st = new StringTokenizer(color,",");
      while (st.hasMoreTokens()) {
               c = new Integer((String)st.nextToken()).intValue()  ;
               if( i == 0)  r = c;  
               if( i == 1 ) g = c ;
               if( i == 2 ) b = c ;
               i++ ;
             }      
      FGcolor = new Color(r,g,b);
      slide.setForeground(FGcolor);
      return true;
    }    
    else if (property == SetBounds) // Set the properties
    {
      String sBounds = value.toString().trim();
      int c=0, i=1 ;
      StringTokenizer st = new StringTokenizer(sBounds,",");
      while (st.hasMoreTokens()) {
            if( i == 1)
            {
               if ( st.nextToken().equals("H"))
                 slide.setOrientation(JSlider.HORIZONTAL);
               else
                 slide.setOrientation(JSlider.VERTICAL);
            }
            else
            {
               c = new Integer((String)st.nextToken()).intValue()  ;
               if( i == 2)  slide.setMinimum(c);  
               if( i == 3 ) slide.setMaximum(c);
               if( i == 4 ) slide.setMajorTickSpacing(c);
               if( i == 5 ) slide.setMinorTickSpacing(c);               
            }
             i++;
      }
      return true;
    }
    else if (property == SetValue) // Set the current value
    {
      slide.setValue(new Integer((String)value).intValue() );
      return true;
    }
    else
    {
     return super.setProperty(property, value);
    }
  }

  /**
   * Get the current value
   **/


  public Object getProperty(ID pId)
  {
    if (pId == GetValue)
    {
      return "" + iValue ;
    }
    else
    {
      return super.getProperty(pId);
    }
  }
 

}


Forms configuration

  • Copy the Slider.jar file in the /forms/java directory
  • Sign the Slider.jar file with your own certificate
  • Edit the /forms/server/formsweb.cfg file to add the jar file to the archive_jinit variable
archive_jini=f90all_jinit.jar,……,Slider.jar


Implementation Class property

    oracle.forms.fd.Slider
 



Properties that can be set

The background color of the slider

Set_Custom_Property( BEAN_NAME, BEAN_NUMBER, 'SETBGCOLOR', 'rgb_color' ) ;

e.g.

Set_Custom_Property('BLK.ITEM_BEAN', 1, 'SETBGCOLOR', '255,0,255' ) ;


Information about the background property

If the background color of the bean is not setted, we use the canvas background color property.
If the canvas background color property is not setted, we have to know what colorscheme is currently in use

There is a package in the SLIDER.FMB module that store the RGB values for each colorscheme

-- Colorscheme RGB values --
GC$Teal Varchar2(15) := '115,142,140' ;
GC$Titanium Varchar2(15) := '99,101,99' ;
GC$Red Varchar2(15) := '156,130,123' ; 
GC$Khaki Varchar2(15) := '140,142,123' ; 
GC$Blue Varchar2(15) := '90,117,148' ;
GC$Olive Varchar2(15) := '107,113,99' ; 
GC$Purple Varchar2(15) := '123,113,140' ; 
GC$Blaf Varchar2(15) := '247,247,231' ;

-- Current colorscheme --
GC$CurScheme Varchar2(15) := '' ;


In the case of the use of a colorscheme, you have to indicate it as soon as possible (in a When-New-Form-Instance trigger)

-- ColorScheme used ? --
PKG_SLIDER.GC$CurScheme := PKG_SLIDER.GC$Blaf ;

In this example, i used the blaf colorscheme

The foreground color of the slider

Set_Custom_Property( BEAN_NAME, BEAN_NUMBER, 'SETFGCOLOR', 'rgb_color' ) ;

e.g.

Set_Custom_Property('BLK.ITEM_BEAN', 1, 'SETFGCOLOR', '0,0,0' ) ;

The properties of the slider

Set_Custom_Property( BEAN_NAME, BEAN_NUMBER, 'SETBOUNDS', PROPERTIES ) ;

Where properties are:

  • Orientation : could be H for a horizontal slider or V for a vertical slider
  • Max Value : the maximum value for the slider
  • Min Value : the minimum value for the slider
  • MajorTick : distance betwwen each principal graduations
  • MinorTick : distance betwwen each secondary graduations


e.g.

Set_Custom_Property('BLK.ITEM_BEAN', 1, 'SETBOUNDS', ' H,0,10,2,1 ' ) ;

The current value of the slider

Set_Custom_Property( BEAN_NAME, BEAN_NUMBER, 'SETVALUE', 'value' ) ;

e.g.

Set_Custom_Property('BLK.ITEM_BEAN', 1, 'SETVALUE', '5' ) ;


Properties that can be read


The current value of the slider

CHAR := Get_Custom_Property( BEAN_NAME, BEAN_NUMBER, 'GETVALUE' ) ;

e.g.

Value := Get_Custom_Property('BLK.ITEM_BEAN', 1, 'GETVALUE' ) ;



The sample dialog

  • Download the jslider.zip file
  • Unzip the jslider.zip file
  • Copy the Slider.jar file in your /forms/java/ directory
  • Edit your /forms/server/formsweb.cfg file
  • Open the SLIDER.fmb module (Oracle Forms 10.1.2)
  • Open the JSLIDER.fmb module (Oracle Forms 9.0.2)
  • Open the COLOR_SLIDER.fmb module (Oracle Forms 9.0.2)
This dialog allows to choose a color from Red, Green and Blue Jsliders
  • Compile all and run the module

     

The settings of the slider properties are grouped in the PKG_SLIDER package

PACKAGE PKG_SLIDER IS

  -- Colorscheme RGB values --
  GC$Teal      Varchar2(15) := '115,142,140' ;
  GC$Titanium  Varchar2(15) := '99,101,99' ;
  GC$Red       Varchar2(15) := '156,130,123' ; 
  GC$Khaki     Varchar2(15) := '140,142,123' ;       
  GC$Blue      Varchar2(15) := '90,117,148' ;
  GC$Olive     Varchar2(15) := '107,113,99' ; 
  GC$Purple    Varchar2(15) := '123,113,140' ;       
  GC$Blaf      Varchar2(15) := '247,247,231' ;

  -- Current colorscheme --
  GC$CurScheme Varchar2(15) := '' ;

  PROCEDURE    Init_Slider
  (
     PC$Name       IN VARCHAR2,
     PN$Num        IN PLS_INTEGER,
     PC$Bounds     IN VARCHAR2
  ) ;

  PROCEDURE Set_Value
  (
     PC$Name       IN VARCHAR2,
     PN$Num        IN PLS_INTEGER,
     PN$Value      IN NUMBER
  ) ; 

END;
 

PACKAGE BODY PKG_SLIDER IS

PROCEDURE    Init_Slider
  (
     PC$Name       IN VARCHAR2,
     PN$Num        IN PLS_INTEGER,
     PC$Bounds     IN VARCHAR2
  )
Is
      LC$CVBColor   Varchar2(20) := Get_Canvas_Property( Get_Item_Property( PC$Name, ITEM_CANVAS ), BACKGROUND_COLOR ) ;
      LC$CVFColor   Varchar2(20) := Get_Canvas_Property( Get_Item_Property( PC$Name, ITEM_CANVAS ), FOREGROUND_COLOR ) ;  
      LC$BGColor    Varchar2(20) := Get_Item_Property(PC$Name, BACKGROUND_COLOR) ;
      LC$FGColor    Varchar2(20) := Get_Item_Property(PC$Name, FOREGROUND_COLOR) ;     
      LC$Color      Varchar2(15) ;
Begin

-- BackGround color --
If LC$BGColor is not null Then
  LC$Color := Translate( LC$BGColor, '0123456789gbr','0123456789,,' ) ;
  Set_Custom_Property( PC$Name, PN$Num, 'SETBGCOLOR', LC$Color ) ;    
Elsif LC$CVBColor is not null Then
  LC$Color := Translate( LC$CVBColor, '0123456789gbr','0123456789,,' ) ;   
  Set_Custom_Property( PC$Name, PN$Num, 'SETBGCOLOR', LC$Color ) ;
Else
      LC$Color := PKG_SLIDER.GC$CurScheme ;
      Set_Custom_Property( PC$Name, PN$Num, 'SETBGCOLOR', LC$Color ) ;
End if ;

-- ForeGround color --
If LC$FGColor is not null Then
  LC$Color := Translate( LC$FGColor, '0123456789gbr','0123456789,,' ) ;
  Set_Custom_Property( PC$Name, PN$Num, 'SETFGCOLOR', LC$Color ) ;
Elsif LC$CVFColor is not null Then
  LC$Color := Translate( LC$CVFColor, '0123456789gbr','0123456789,,' ) ;   
  Set_Custom_Property( PC$Name, PN$Num, 'SETBGCOLOR', LC$Color ) ; 
End if ;

-- Bounds --
Set_Custom_Property( PC$Name, PN$Num, 'SETBOUNDS', PC$Bounds ) ;

End ;
 

-------------------------------------------
--  Set the current value of the Slider  --
-------------------------------------------
PROCEDURE Set_Value
  (
     PC$Name       IN VARCHAR2,
     PN$Num        IN PLS_INTEGER,
     PN$Value      IN NUMBER
  )
IS
BEGIN

  -- Initial value --
  Set_Custom_Property( PC$Name, PN$Num, 'SETVALUE', To_Char(PN$Value) ) ;

End Set_Value;

END;


So, in the When-New-Form-Instance trigger, you can set the slider settings:

-- ColorScheme used ? --
PKG_SLIDER.GC$CurScheme := PKG_SLIDER.GC$Blaf ;

-- Init the slider properties --
PKG_SLIDER.Init_Slider ( 'BL1.BEAN_SLIDER', 1, 'H,0,10,2,1' ) ;

-- Set current the value --
PKG_SLIDER.Set_Value   ( 'BL1.BEAN_SLIDER', 1, 5 ) ;



And get the current value with the When-Custom-Item-Event trigger created on the bean item:

-- Get new value --
:BL1.VAL := Get_Custom_Property( 'BL1.BEAN_SLIDER', 1, 'GETVALUE') ;
Partager cet article
Repost0