Suivre ce blog
Editer l'article Administration Créer mon blog
9 décembre 2006 6 09 /12 /décembre /2006 11:56

Here is a Java bean that allows to capture the mouse events and display the properties and methods of the clicked component.

Mouse events

Right-click on a component to display its properties and methods.

The Java code


The implementation class of the Bean Item


The methods you can call

  • Enable/disable mouse event capture

Set_Custom_Property('BLOCK.ITEM', 1, 'SETEVENT', 'parameter');

where parameter is:

   event name,boolean

e.g. :

Set_Custom_Property('BL.BEAN', 1, 'SETEVENT', 'PRESS=FALSE' ) ;         

event name can be one of the following:

  - MOVE (mouse move)
  - EXIT (mouse exit)
  - PRESS (mouse button pressed)
  - REL (mouse button released)
  - ENTER (mouse enter)
  - CLICK (mouse click)

   By default, the MOVE event is disabled.

  • Enable/disable all mouse events

Set_Custom_Property('BLOCK.ITEM', 1, 'ALLOWEVENT', 'true|false');

The event raised by the bean


This event is raised by the bean to inform Forms that a mouse event has occured.
4 properties are provided:

  - MSGEVENT : event raised (mouse enter, exit, click, move, press)
  - MSGITEM : class name of the component
  - MSGCOORD : coordinates of the mouse pointer
  - MSGBTMOUSE : mouse button number

  IF (eventName='SENDMSG') THEN
      -- get the mouse message --
      eventValues := get_parameter_list(:system.custom_item_event_parameters);
      get_parameter_attr(eventValues,'MSGEVENT',eventValueType, LC$Event);
      get_parameter_attr(eventValues,'MSGITEM',eventValueType, LC$Item);
      get_parameter_attr(eventValues,'MSGCOORD',eventValueType, LC$Coord);
      get_parameter_attr(eventValues,'MSGBTMOUSE',eventValueType, LC$Button);
      LC$Msg := LC$Event
             || ' object=' || LC$Item
             || ' at ' || LC$Coord
             || ' mouse=' || LC$Button ;
      Message(LC$Msg, no_acknowledge) ;
      Synchronize ; 


This event is raised by the bean to inform Forms that the property and method information of the component has been sent.
In the sample dialog, this information is stored in a Text item, then displayed via the Edit_TextItem() Forms built-in.
It can be displayed by right-clicking on anywhere on the screen.

Mouse events

      -- get the component properties --      
      eventValues := get_parameter_list(:system.custom_item_event_parameters);
      get_parameter_attr(eventValues,'MSGPROPS',eventValueType, LC$Msg);
      :BL.PROPERTIES := Replace(LC$Msg, '/n', CHR(10));
      Set_Custom_Property('BL.BEAN', 1, 'ALLOWEVENT', 'false' ) ;
      edit_textitem ;
      Set_Custom_Property('BL.BEAN', 1, 'ALLOWEVENT', 'true' ) ;
   END IF;

The sample dialog

     . Download the handlemouseevent.zip file
     . Unzip the file
     . copy the handlemouseevent.jar file in the <ORACLE_HOME>/forms/java directory
     . Edit your /forms/server/formsweb.cfg file to add this jar file
     . Open the MOUSEEVENT.fmb module (Oracle Forms 10.1.2)
     . Compile all and run the module

Partager cet article

Published by Oracle Forms community - dans Bean - general
commenter cet article


JÞrn Hansen 28/06/2007 16:23

Found out: I am using jre 1.6. If I remove the combo box, it works. This is a known error, http://www.oratransplant.nl/index.php?s=stringcomparator

JÞrn Hansen 28/06/2007 10:46

I have tried to run the example, but gets the same error over and over. I have signed the jar-file.
I tried to recompile the java-file myself. This was ok. But I still get the same error.
Has anyone seen this before?
RegisterWebUtil - Loading WebUtil Version, native.Forms Applet version is : oracle/bali/share/sort/StringComparator at java.lang.Class.getDeclaredMethods0(Native Method) at java.lang.Class.privateGetDeclaredMethods(Unknown Source) at java.lang.Class.getDeclaredMethod(Unknown Source) at java.awt.Component.isCoalesceEventsOverriden(Unknown Source) at java.awt.Component.isCoalesceEventsOverriden(Unknown Source) at java.awt.Component.access$100(Unknown Source) at java.awt.Component$2.run(Unknown Source) at java.awt.Component$2.run(Unknown Source) at java.security.AccessController.doPrivileged(Native Method) at java.awt.Component.checkCoalescing(Unknown Source) at java.awt.Component.(Unknown Source) at java.awt.Container.(Unknown Source) at oracle.ewt.lwAWT.LWComponent.(Unknown Source) at oracle.ewt.lwAWT.LWDataSourceChoice.(Unknown Source) at oracle.ewt.lwAWT.LWChoice.(Unknown Source) at oracle.ewt.comboBox.ComboBox.(Unknown Source) at oracle.ewt.comboBox.ComboBox.(Unknown Source) at oracle.forms.ui.VComboBox.(Unknown Source) at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source) at java.lang.reflect.Constructor.newInstance(Unknown Source) at java.lang.Class.newInstance0(Unknown Source) at java.lang.Class.newInstance(Unknown Source) at oracle.forms.handler.UICommon.instantiate(Unknown Source) at oracle.forms.handler.UICommon.onCreate(Unknown Source) at oracle.forms.handler.PopListItem.onCreate(Unknown Source) at oracle.forms.handler.ComboBoxItem.onCreate(Unknown Source) at oracle.forms.engine.Runform.onCreateHandler(Unknown Source) at oracle.forms.engine.Runform.processMessage(Unknown Source) at oracle.forms.engine.Runform.processSet(Unknown Source) at oracle.forms.engine.Runform.onMessageReal(Unknown Source) at oracle.forms.engine.Runform.onMessage(Unknown Source) at oracle.forms.engine.Runform.sendInitialMessage(Unknown Source) at oracle.forms.engine.Runform.startRunform(Unknown Source) at oracle.forms.engine.Main.createRunform(Unknown Source) at oracle.forms.engine.Main.start(Unknown Source) at sun.applet.AppletPanel.run(Unknown Source) at java.lang.Thread.run(Unknown Source)class oracle.forms.ui.FormDesktopContainer

Oracle Forms community 28/06/2007 16:40

Interesting to know. Thanks ;o)Francois