Overblog Tous les blogs Top blogs Technologie & Science Tous les blogs Technologie & Science
Editer l'article Suivre ce blog Administration + Créer mon blog
MENU

This is a bunch of tips and techniques related to Oracle PL/SQL and Forms.

Publicité

Mouse events and Java reflexion

Purpose

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

     HandleMouseEvent.java



The implementation class of the Bean Item

     oracle.forms.fd.HandleMouseEvent


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

  • SENDMSG

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 ;
      clear_message;
      Message(LC$Msg, no_acknowledge) ;
      Synchronize ; 


  • SENDPROPS

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


   ELSIF (eventName='SENDPROPS') THEN
      -- 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' ) ;
      Go_Item('BL.PROPERTIES');
      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

Publicité
Retour à l'accueil
Partager cet article
Repost0
Pour être informé des derniers articles, inscrivez vous :
Commenter cet article
J
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
Répondre
J
I have tried to run the example, but gets the same error over and over. I have signed the jar-file.<br /> I tried to recompile the java-file myself. This was ok. But I still get the same error.<br /> Has anyone seen this before?<br />  <br /> RegisterWebUtil - Loading WebUtil Version 10.1.2.0proxyHost=nullproxyPort=0connectMode=HTTP, native.Forms Applet version is : 10.1.2.0java.lang.NoClassDefFoundError: 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
Répondre
O
Interesting to know. Thanks ;o)Francois