Get mouse position during Custom UI Draw event?

I am building a Custom UI for one of my plugin effect.
I want to get the mouse position during the Custom UI Draw event (PF_Event_DRAW), but cannot manage to get it.
From what I understand, it seems we can only get the mouse position during the events PF_Event_DRAG, PF_Event_DO_CLICK, and PF_Event_ADJUST_CURSOR.
I tried to use PFAppSuite4::PF_GetMouse() too, but this resulted in the error message "After Effects error: internal verification failure, sorry! {PF_GetMouse can only be called during valid events.}".
Therefore I want to store the mouse position during PF_Event_ADJUST_CURSOR, and use it later during PF_Event_DRAW.
Where can I store those values in a "clean" way (ensuring there will not be conflicts if two instances of the same effect are running, etc)?
Or is there an easier method to get the mouse position during a Custom UI Draw event?

//SequenceDataVars is the name of your data structure
//this is how you create the sequence data
out_data->sequence_data = PF_NEW_HANDLE(sizeof(SequenceDataVars));
SequenceDataVars *seqData =
(SequenceDataVars*)PF_LOCK_HANDLE(out_data->sequence_data);
//and now you can store stuff in it.
seqData->var1 = 7;
//after it's created, on other calls, you just do a simple cast
SequenceDataVars *seqData = *(SequenceDataVars **)out_data->sequence_data;
seqData->var1 = 100;
//this is how you delete it. (if you don't delete it, it will be saved with
the project, and loaded on the next session. (if you want)
PF_DISPOSE_HANDLE(out_data->sequence_data);
there's more to know, so look up SequenceSetup, SequenceSetdown, ect in the
sample project.

Similar Messages

  • Getting mouse position without a listener

    Hi all,
    I'm trying to achieve the equivalent of Component.getMousePosition() that Sun
    so kindly put into 1.5, without forcing all my users to immediately upgrade to 1.5.
    Any ideas? Just the normal relative-to-component mouse position is all I need, but I have to get it even if the mouse hasn't moved, so there are no events.
    Thanks a lot

    I guess the easiest way is still to use a MouseMotionListener that you could add to your top level container. You could then store the value of the last position and still be able to access it even if the mouse hasn't moved.
    You might also want to use the following method : SwingUtilities.convertPointFromScreen(Point p, Component c);

  • Getting mouse position into flash from JavaScript?

    Is there a way to get mouse coordinates in a browser that is
    cross browser compatible? I am able to track the mouse coordinates
    in all browsers except FireFox (Windows). In Windows firefox I can
    track the coordinates outside of the flash object but not inside
    the flash object. I am using the below script. Any help in this
    would be greatly appreciated. Thanks in advance.
    Regards,
    Beau

    I guess the easiest way is still to use a MouseMotionListener that you could add to your top level container. You could then store the value of the last position and still be able to access it even if the mouse hasn't moved.
    You might also want to use the following method : SwingUtilities.convertPointFromScreen(Point p, Component c);

  • Get mouse position outside application

    Hi,
    I need to know the position outside my java application, but I don't know on what I should add the MouseMotionListener. Any suggestions anyone?
    I'm running Microsoft Windows..
    Thanx,
    Jesse

    can't do that without JNI and a mouse hook.

  • Get Current Mouse Position

    Is there a way to get the current mouse position on the screen? Unfortunately, I cannot use a listener to provide the mouse position, because I don't know what components (if any) that the mouse is over. I am trying to draw in the glass pane during a drag and drop. During a drag and drop, the glass pane does not get mouseEntered or mouseMoved events (which I would have used to get the ouse position if I could). So I was hoping for a static method that I could use within the glass pane's paint method to give me the current absolute position of the mouse.

    a time ago i used the glasspane and the mousemotionlistener works perfect. you only should be sure to show ( setVisible(true) ) your glasspane. the best way is to look onto the java tutorial how they did it.
    link: http://java.sun.com/docs/books/tutorial/uiswing/components/rootpane.html
    tobais

  • How to get the input data on the arbitrary draw event ?

    Hi all,
    I'm trying to draw a histogram on a arbitrary parameter (just like the "Levels" effect). The draw part is well, but I have a problem with the input layer data (param[0]).
    All I have to do now is read the input data on the arbitrary draw event. But there's not the input pointer on the draw event. So I called the PF_CHECKOUT_PARAM() function to get the input data, and it works!
    When I test in AE, I created a layer A, and added some color correction effects to the layer A before added my effect to the layer A. The problem is the input layer my effect read is not the result of previous effects I applied before.
    Has anyway to read the latest input data in the arbitrary events ?
    Thanks.

    Hi shachar, nice to meet you!
    In another way, I created a sequence data like this:
    typedef struct {
        bool didRender;
        <some histogram data>;
    } Histogram;
    typedef struct {
        Histogram*  histograms;
    } my_sequence_data, *my_sequence_dataP, **my_sequence_dataH;
    my_sequence_data.histograms is an array with in_data->total_time / in_data->time_step items initialized during the sequence setup.
    During the render call, I cached  the calculated histogram at this current_time to the sequence->histograms[in_data->current_time / in_data->time_step], set the didRender = true.
    In this way, I have another problem with the AE cached image. I disabled a random previous effect on the effect panel, then the AE re-rendered my effect, the histogram changed (good). I enabled the effect again, and nothing change (bad )
    I try to force the AE re-rendering after the custom UI changed ( I tried with the event_extraP->evt_out_flags = PF_EO_HANDLED_EVENT; and params[HISTOGRAM_UI]->uu.change_flags |= PF_ChangeFlag_CHANGED_VALUE; on the click, drag events...) but it seem not works!
    Am I on the right way ?
    Thank you so much!

  • DnD - Get Drop Mouse Position

    I want to Drag some image file from a JList, and then drop it on a JPanel. The dropping on the panel functions. The problem is, i would like to get the position of the mouse, when the item is dropped on the panel. I use the panel to visualize graphics with Graphics2D, and the image dragged from the list should then be displayed at the position on the panel, where it is dropped. So how could i get this position? I have added a MouseListener to the panel, but it does not react on the mouse events which are caused by the DnD action.

    I am really helpless... Is this a stupid question or does nobody know the answer?
    I just want to get the mouse position of the drop, after a drag and drop.
    I found a MouseDragGestureRecognizer Class, but i am not able to implement. Actually i have just a JList, from which Strings are dragged, and a JPanel, on which the Strings are dropped.
    The drag and dropping functions, but i need the mouse position on the JPanel, when the String is dropped.

  • Mouse Position at dragDrop event

    I'm dragging and dropping items between canvas containers. When I drop an item, the dragDrop event fires. However, I can't seem to find the mouseX and mouseY values of the drop target container, at the point when the item is dropped. Once the mouseDown event fires to start the drag, it seems as though Flex stops capturing the mouseX and mouseY values.
    I put a mouseMove event listener on the container where I'm dropping, and as soon as the mouseDown event starts, the mouseMove event stops.
    I looked at mouseUp, and while that gives me the correct current mouse position, it is triggered after the dragDrop event, making it too late to use the x and y position of the item I dropped.
    How do I find where the point where I dropped the item?

    As soon as the mouseDown event is triggered, the mouseMove event no longer triggers. Thank you for the link. I've read that many times while working on this. What it doesn't address is the position of the item dropped. The only way I can think of to get around this is to listen for the mouseUp instead of the drapDrog event, but that should not be necessary. Use the code below, as an example. No matter where you drop the panel in the second canvas, it puts it at the y value of the mouse at the moment the doDrag (or mouseDown) event triggered.
    <?xml version="1.0"?>
    <mx:WindowedApplication xmlns:mx="http://www.adobe.com/2006/mxml" layout="horizontal">
        <mx:Script>
            <![CDATA[
                import mx.managers.DragManager;
                import mx.core.DragSource;
                import mx.events.DragEvent;
                import flash.events.MouseEvent;
                import mx.controls.Alert;
                private function mouseOverHandler(event:MouseEvent):void {
                    var dragInitiator:Panel=Panel(event.currentTarget);
                    var ds:DragSource = new DragSource();
                    ds.addData(dragInitiator, "format");
                    var PanelProxy:Panel = new Panel();
                    PanelProxy.height=myPanel.height;
                    PanelProxy.width=myPanel.width;               
                    DragManager.doDrag(dragInitiator, ds, event, PanelProxy, 0, 0, 1.00);
                private function dragEnterHandler(event:DragEvent):void {
                  if (event.dragSource.hasFormat("format"))
                    DragManager.acceptDragDrop(Canvas(event.currentTarget));
                private function dragOverHandler(event:DragEvent):void
                    if (event.dragSource.hasFormat("format")) {
                        if (event.ctrlKey) {                   
                            DragManager.showFeedback(DragManager.COPY);
                            return;
                        else {
                            DragManager.showFeedback(DragManager.MOVE);
                            return;
                    DragManager.showFeedback(DragManager.NONE);
                private function dragDropHandler(event:DragEvent):void {
                  if (event.dragSource.hasFormat("format")) {
                      var draggedPanel:Panel = event.dragSource.dataForFormat('format') as Panel;
                      var dropCanvas:Canvas = event.currentTarget as Canvas;
                      var newPanel:Panel = new Panel();
                      newPanel.x = 0;
                      newPanel.y = drpTgt.mouseY;
                      newPanel.height = draggedPanel.height;
                      newPanel.width = draggedPanel.height;
                      dropCanvas.addChild(newPanel);
                      Alert.show("Item Dropped at "+newPanel.y);
                private function dragCompleteHandler(event:DragEvent):void {
                    var draggedPanel:Panel =
                        event.dragInitiator as Panel;
                    var dragInitCanvas:Canvas =
                        event.dragInitiator.parent as Canvas;
                    if (event.action == DragManager.MOVE)
                        dragInitCanvas.removeChild(draggedPanel);
            ]]>
        </mx:Script>
        <mx:Canvas
            width="250" height="500" 
            borderStyle="solid"
            backgroundColor="#DDDDDD">
            <mx:Panel id="myPanel" x="10" y="192" width="150" height="150" layout="absolute" title="Test Panel" mouseMove="mouseOverHandler(event);" dragComplete="dragCompleteHandler(event);"/>
        </mx:Canvas>
        <mx:Canvas id="drpTgt"
            width="250" height="500" 
            borderStyle="solid"
            backgroundColor="#DDDDDD"
            dragEnter="dragEnterHandler(event);"
            dragOver="dragOverHandler(event);"
            dragDrop="dragDropHandler(event);" horizontalScrollPolicy="on">       
        </mx:Canvas>
    </mx:WindowedApplication>

  • [JS] Get Mouse Cursor Position

    I have looked through the documentation and forums here and haven't found any reference to getting the cursor mouse position. I see info about text cursor position, but I am looking to capture the coordinates of mouse position. Is that possible with JavaScript (ExtendScript)?
    Thanks for any help you can offer.
    Dan

    I want the script to create a specific sized picture frame on the page. It would be cool to make it at the current mouse position. Yes I can draw the frame myself, but I am trying to automate a tedious process, so having the script create the frame with all the proper options such as size and style will speed things up. I can create it in the middle of the page with the script, and then drag it into position manually, but it would be even better to use the mouse position when the script creates the frame.
    Maybe an AppleScript could get the mouse position?
    But then how would I pass that to my JavaScript?

  • Get mouse cursor position

    hello,
    how can i get the position of the mousecursor (in x, y coords relative to the complete screen) if its not invoked by a mouse event (else its easy with event.getX / Y ())?
    cu,
    cpio

    maybe u can get yur cursor position wif a ruler? dun b dumb. u cant get the xypos anyother way. But ofcos if u like the hard way, u can always use another app to capture the mouse positon n let it inform yur main Java app, thru local ports or even use JNI. N i dun c y anyone will wan to do it this way. it oready defeats the purpose of using Java.

  • Get the mouse position

    If I have a frame and some panels on the frame, it seems I should not add the mouselisteners to the frame, but the panels. Now I can receive the mouse events. But when I try to get the mouse's position, they are the position's related to each panel. How can I get the positions associated with the frame?
    Thanks!

    public class MyFrame exyends JFrame implements MouseListener
    implement all the methods of Interface MouseListener
    e.g.
    public void mouseClicked (MouseEvent e)
    System.out.println("CLICKED AT " + e.getX() + "," + e,getY());

  • Can i get mouse location and event outside JFrame?

    Can i get mouse location and event outside JFrame?
    any related link or document? thx~

    what I figure out from your question is that, you want to get the coordinates even if the mouse is not directly interacting with any of the java components of your application.
    I would consider this as an interaction with the OS so that it sends a call to your java program as well when ever the mouse event occurs. If you use JNI to catch system events, I think it should work.

  • Mouse position gets reset randomly from slide to slide

    Hi,
    I have a software demo that I'm working on (Captivate 5). From slide to slide, usually Captivate uses the start position of the mouse based on the end position of the mouse on the previous slide. But sometimes it seems to lose that position, and starts the mouse at the top left of the screen. Is there any way to change that starting position, or fix this little bug?
    Thanks,
    Joel

    I'm having a similar problem.  I've found that my mouse position changes to top left on all slides immediately following a FMR slide.  I've tried to manually reposition the mouse origin by drag-and-drop and right-click/align to..., but neither work.
    I've installed the 12/10 patch.
    Any suggestions?
    Thanks.

  • Bitmap Rotation According to Mouse Position?

    Hi,
    I am working on a 2d computer graphics project, and I need a good function to rotate a Bitmap 360 degree according to my mouse position.
    for example: 

    Hi,
    I am working on a 2d computer graphics project, and I need a good function to rotate a Bitmap 360 degree according to my mouse position.
    for example: 
    Hello,
    To rotate that image, we need to deal with the following tips.
    1. The image size.
    If the area for that image rotated is not big enough, it will just lose some parts of that image.
    Here is a nice code shared in this thread
    http://stackoverflow.com/questions/5199205/how-do-i-rotate-image-then-move-to-the-top-left-0-0-without-cutting-off-the-imag/5200280#5200280.
    private Bitmap RotateImage(Bitmap b, float Angle)
    // The original bitmap needs to be drawn onto a new bitmap which will probably be bigger
    // because the corners of the original will move outside the original rectangle.
    // An easy way (OK slightly 'brute force') is to calculate the new bounding box is to calculate the positions of the
    // corners after rotation and get the difference between the maximum and minimum x and y coordinates.
    float wOver2 = b.Width / 2.0f;
    float hOver2 = b.Height / 2.0f;
    float radians = -(float)(Angle / 180.0 * Math.PI);
    // Get the coordinates of the corners, taking the origin to be the centre of the bitmap.
    PointF[] corners = new PointF[]{
    new PointF(-wOver2, -hOver2),
    new PointF(+wOver2, -hOver2),
    new PointF(+wOver2, +hOver2),
    new PointF(-wOver2, +hOver2)
    for (int i = 0; i < 4; i++)
    PointF p = corners[i];
    PointF newP = new PointF((float)(p.X * Math.Cos(radians) - p.Y * Math.Sin(radians)), (float)(p.X * Math.Sin(radians) + p.Y * Math.Cos(radians)));
    corners[i] = newP;
    // Find the min and max x and y coordinates.
    float minX = corners[0].X;
    float maxX = minX;
    float minY = corners[0].Y;
    float maxY = minY;
    for (int i = 1; i < 4; i++)
    PointF p = corners[i];
    minX = Math.Min(minX, p.X);
    maxX = Math.Max(maxX, p.X);
    minY = Math.Min(minY, p.Y);
    maxY = Math.Max(maxY, p.Y);
    // Get the size of the new bitmap.
    SizeF newSize = new SizeF(maxX - minX, maxY - minY);
    // ...and create it.
    Bitmap returnBitmap = new Bitmap((int)Math.Ceiling(newSize.Width), (int)Math.Ceiling(newSize.Height));
    // Now draw the old bitmap on it.
    using (Graphics g = Graphics.FromImage(returnBitmap))
    g.TranslateTransform(newSize.Width / 2.0f, newSize.Height / 2.0f);
    g.RotateTransform(Angle);
    g.TranslateTransform(-b.Width / 2.0f, -b.Height / 2.0f);
    g.DrawImage(b, 0, 0);
    return returnBitmap;
    2. The location of that control which displays that image.
    If we use a picturebox, and set its sizemode to autosize like the following line, then if you just want to rotate that image to show, and you don't want to that affects the original image, then we need to keep its center point.
    this.pictureBox1.SizeMode = PictureBoxSizeMode.AutoSize;
    We could add resize event handler after we set image for that picturebox.
            Point pOrign;
            Size sOrign;private void Form1_Load(object sender, EventArgs e)
    this.pictureBox1.SizeMode = PictureBoxSizeMode.AutoSize;
    Image img = Image.FromFile(@"D:\Documents\New folder\New folder\TestImage.PNG");
    this.pictureBox1.Image = img;
    this.pictureBox1.InitialImage = img;
    pOrign = new Point(this.pictureBox1.Left , this.pictureBox1.Top );
    sOrign = new Size(this.pictureBox1.Width, this.pictureBox1.Height);
    this.pictureBox1.BorderStyle = BorderStyle.FixedSingle;
    this.pictureBox1.Resize += pictureBox1_Resize;
    private void pictureBox1_Resize(object sender, EventArgs e)
    this.pictureBox1.Left = this.pOrign.X + (this.sOrign.Width - this.pictureBox1.Width) / 2;
    this.pictureBox1.Top = this.pOrign.Y + (this.sOrign.Height - this.pictureBox1.Height) / 2;
    3. The angle between that center point and your mouse postion.
    We could get that value inside the picturebox's container's mouse_move event.
    Double angleNew ; private void pictureBoxContainer_MouseMove(object sender, MouseEventArgs e)
    angleNew = Math.Atan2(this.pOrign.Y + this.sOrign.Height / 2 - e.Y, this.pOrign.X + this.sOrign.Width/2 - e.X) * 180.0 / Math.PI;
    But when to start rotate that image, it should be your chooice, and you could decide when rotate that image with the following line.
    this.pictureBox1.Image = (Image)RotateImage(new Bitmap(this.pictureBox1.InitialImage), (float)angleNew);
    If you just want to save that change to that image, then you could save that bitmap to file directly.
    Happy new year.
    Regards.
    Carl
    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click
    HERE to participate the survey.

  • Custom Pre Process Event Handler in OIM 11g for middle initials

    Hi,
    I am trying to congiure a Custom Pre Process Event Handler for generating middle name in OIM 11g and I am following the steps as given in metalink ID: *1262803.1*
    Even after successfully performing all the steps I am not able to get the middle initials in Admin Console when I create a new user.
    1) Directory structure for the application that I have created through JDeveloper.
    CustomApplication/
    |-- CustomApplication.jws
    `-- CustomProject
    |-- CustomProject.jpr
    |-- classes
    | `-- com
    | `-- example
    | `-- custompph
    | `-- CustomPreProcessEventHandler.class
    `-- src
    `-- com
    `-- example
    `-- custompph
    `-- CustomPreProcessEventHandler.java
    2) Directory structure for Plugins directory
    My Plugin.xml :
    <?xml version="1.0" encoding="UTF-8" ?>
    <oimplugins>
    <plugins pluginpoint="oracle.iam.platform.kernel.spi.EventHandler">
    <plugin pluginclass="com.example.custompph.CustomPreProcessEventHandler"
    version="1.0" name="CustomPreProcessEventHandler" />
    </plugins>
    </oimplugins>
    plugin/
    |-- lib
    | `-- com
    | `-- example
    | `-- custompph
    | `-- CustomPreProcessEventHandler.class
    |-- middlename.zip
    `-- plugin.xml
    Copied the middlename.zip in the plugin folder in OIM_HOME and registered it successfully.
    3) Created a EventHandlers file and imported it successfully using importmetadata.
    My EventHandlers.xml:
    <?xml version='1.0' encoding='utf-8'?>
    <eventhandlers>
    <!-- Custom preprocess event handlers -->
    <action-handler
    class="com.example.custompph.CustomPreProcessEventHandler"
    entity-type="User"
    operation="CREATE"
    name="CustomPreProcessEventHandler"
    stage="preprocess"
    order="10"
    sync="TRUE"/>
    </eventhandlers>
    I checked the logs as well but could not find something which can help me to proceed.
    Also please advise is their any mapping that I need to do in *"Design Console"*
    Please advise !!!!!
    Thanks

    My lib file contains the package as mentioned in the metalink.
    Heirarchy in Plugin folder :
    1) plugin.xml
    2) Lib ( lib contains 3 folders : com/example/custompph; And inside custompph is my CustomPreProcessEventHandler.class file)
    You mean to say i should not copy the entire package in lib but only the jar file of the CustomPreProceessEventHandler.class* file.
    If i put only a .jar file in lib i get the following error.
    "Error occured during the use of plugin registering utility. The plugin zip does not contain the definition of plugin class com.example.custompph.CustomPreProcessEventHandler"
    Thanks
    Edited by: 870050 on Jul 4, 2011 4:30 AM

Maybe you are looking for

  • Firefox 26 on OS X 10.9.1 still has huge memory usuage (leak) which leads to crash

    Hi, The subject is sort of self explanatory but for the last few months (not sure exactly when) i have had regular Firefox crashes, it seems to happen when i'm out of memory and FF has used all the available RAM. I have a MBP with i7 and 8gig of RAM

  • Connecting MB to PC External Hard Drive through network

    I just bought a MacBook and want to use my external Hard Drive (Seagate Free Agent 500gb) that is connected to my WIndows XP Media PC (Dell 510) through a residential gateway network (AT&T Uverse). I actually have 3 external drives connected to my PC

  • Delete in xsql:dml vs xsql:delete-request and returned rows attribute

    There is a difference in the number of rows returned between using a delete in xsql:dml vs xsql:delete-request. If I issue a delete via xsql:dml and the row I wish to delete is not in the table, then I get a result with rows equal to 0 as expected. H

  • Too late to exchange for Intel iMac?

    I've had my iMac G5 for roughly a month, and it's been great! However, I find myself wishing that I had gone ahead and bought the Intel iMac. Does anyone know if Apple will accept a return for no reason other than that? I bought directly from the App

  • Make a Timecard line non editable

    Hi, We have a self service timecard entry system. When a user creates a new timecard his regular hours are autopopulated from his rotation plan (Work Schedule template). He can enter the overtime worked on additional rows. Is there a way we can stop