Interesting way to detect array index from mouse position

Ever programmed something and then been surprised it works? This was the first time for me. Wrote a bit of code with the intention of identifying the array index clicked from the mouse position for use in a 'mouse down?' event and it worked first time. Then I went back and realised I had been half asleep and it doesn't even use the mouse position- but as if by magic it works!
VI snippet below. For some reason LabVIEW modifies the array reference when I create a snippet, so you'll need to change that array reference for one pointing to array 2. <= Anyone able to raise a CAR against this?

In the past I've used this VI.  I think it is quite similar to yours and I could probably simplify based on what you have done.  One thing my VI does is it tries to take into account the scrollbar size if one is being shown for the array.
Unofficial Forum Rules and Guidelines - Hooovahh - LabVIEW Overlord
If 10 out of 10 experts in any field say something is bad, you should probably take their opinion seriously.
Attachments:
Coordinates to Index.vi ‏20 KB

Similar Messages

  • Is there a way to remove the index from the XML output?

    Hi,
    It is easy to remove the index from the WebHelp output.
    We also want to remove it from the XML output.
    How do I do that?
    Thanks,
    Rakefet

    @Jeff: In the Single Source Layouts recipe box is a layout for XML. Although, I'm really not sure why folks would use it, other than to possibly export the project data to another system of some sort.
    @Rakefet: One thought is to try creating a new blank Index. Then choose the empty Index when you use XML Output.
    Cheers... Rick

  • With Standard Labview 6.1, is there a way to set (x,y) cursor-mouse position?

    I am working on a project in standard Labview 6.1 that receives images from a webcam. This image array will then be analyzed to determine the position of a black dot on a white background. This dot will then correspond to an (x,y) coordinate point. We will then feed these coordinates into a program that will set the cursor mouse position to this point. However, we are uncertain on how to interface Labview with the computer mouse controls and are in need of assistance.

    If you are simply wanting to set the coordinates of an existing cursor on a LabVIEW graph, then you can do that using Property Nodes. I have attached an example of this which you could take a look at.
    J.R. Allen
    Attachments:
    SetCursor.vi ‏32 KB

  • Zooming image from mouse position(like in  windows vista photo gallery)

    hello all;
    here's my situation, hope someone can help..
    i wanna Zoom an image, which zoom from my mouse position
    like in windows photo gallery in windows vista
    so i do this..
    g2.translate(iMoux,iMouy);       
            g2.scale(zoom, zoom);       
            g2.translate(-iMoux,-iMouy);       
            g.drawImage(icon.getImage(), iSposx, iSposx, d.width/2-iValue, d.height-iBawah, null);
            g.drawImage(icon2.getImage(), d.width/2, iSposy, d.width/2-iValue, d.height-iBawah, null);the problem come when i move my mouse to the different location (like from top right to bottom left)
    the zoom image displayed in the screen like jump from latest location to new location
    anybody can help me...a clue how to do that?
    thx appreciate your help guys
    mao
    Edited by: KingMao on 31 Mei 08 14:27

    Hi Frank.
    Thanks for the response.
    Agreed, the pertinent question is why can't my colleague edit the JPG exported by Aperture. It's probably also worth pointing out, the same problem occurs with JPGs exported from iPhoto.
    The Windows software usually plays nicely with JPGs by all acounts, just not the ones I send - which I do via eMail or my public space on Mobile Me incidently.
    So, another key question is: all settings being equal (color profile, quality, etc.) are the JPGs as produced by iPhoto and Aperture indistinguishable from those produced by other apps on other platforms - i.e. does the use of JPG enforce a common standard?
    If that is the case, I suspect ours might be a permissions issue.
    According to the Microsoft support page on editing in Windows Live Photo Gallery, the inability to edit a picture is commonly caused by unsupported file type, or read-only attribute set on the file.
    Unfortunately, he and I are not in the same place, and he's not particularly au-fait with this type of problem solving. Hence, before involving him, I'd like to know:
    1. it's possible (i.e. someone else does it), and,
    2. what's involved (at my end and/or his).
    Thanks again,
    PB

  • Is there any way to change a recording from mouse voice back to "normal"?

    I accidentally recorded something in Mouse Voice but I need to change it back to "normal." Is there any way to do this?
    Thanks!

    assuming you turned on an effect:
    http://www.bulletsandbones.com/GB/GBFAQ.html#nondestructive
    (Let the page FULLY load. The link to your answer is at the top of your screen)

  • How to transfer the indexes from one DB To another DB

    Hi All,
    I have one question.I have to transfer all the database object from one database to another. and I have transfer it.Now I have to create an index on that tables then how can i know on which columns that indexes were created.and How I will create it in new database. Or Is there another way to transfer that indexes from old database to new database.
    Thanx in advance.

    user13310428 wrote:
    How I will create it in new database. Or Is there another way to transfer that indexes from old database to new database.You have to use the DDL (create index/create table with index constraints/etc) commands to create indexes.
    You cannot "+transfer+" the index data like you can table data. The reason is that indexes contains the physical address of the rows indexed. These addresses are different on the new database - and thus make the index data on the old database useless. Instead, you need to re-create the indexes so that the new row addresses can be determined and used by the index.

  • Is there a way to detect all the photos already transferred to double (or triple) in iPhoto, so do not occupy space unnecessarily? Thank you from France.

    Is there a way to detect all the photos already transferred to double (or triple) in iPhoto, so do not occupy space unnecessarily? thanks from France

    Look in you main photo library. Are there doubles or triple photos there? If so delete the extras.
    All photos are stored in the photo library. When you move a photo into an album the photo is not duplicated. The album contains a pointer back to the original photos. These pointers or aliases take up very little space.

  • Why array index starts from 0(zero)?

    Hi,
    I want to know, why array index starts from 0?

    There is also another historical reason for this which often gets overlooked.
    In machine language some instruction sets have a branch-on-zero instruction which would always come in very handy for saving CPU time in most kinds of loop.
    These days you're used to forming your loops just as you like, which you could then, but a construct like
    public class arraycopy {
         public static void main(String[] args)
              final int arraysize = 10;
              int[] i = new int[arraysize];
              int x;
              for (x = 0; x < arraysize; x++)
                   i[x] = 25;
    }effectively, each time the loop check is done, it compares i with arraysize and breaks if the condition fails. This program translates to...
    LDA #$25
    LDX #$00
    LOOP STA $0200,X // <---- Note $0200 = arbitrary array location + X.
    INX
    CPX #$0A
    BNE LOOP
    In machine language (OOPS programmers will notice that the machine-language program is shorter, 12 bytes long in fact and it also executes much much faster).
    Basically, the problem is, that CPX, the compare, takes time, almost 1/5 of the total execuation time, and in a small loop for a long array it eats clock cycles... and a couple of bytes (Tchoh!).
    So, you can save time by re-writing the same loop thus...
    LDA #$25
    LDX #$0A
    LOOP STA $01FF,X
    DEX
    BNE LOOP
    By writing the loop backwards and taking advantage of the machine language underneath (i.e. the Real executable part of the program), you write a program that does exactly the same thing as the first example and is smaller and faster and easier to read. In fact the program takes 10bytes of memory. In machine-code you can place a complete working program in the amount of memory space it now takes you to store two double floats... now that's progress for you! : )
    Python does it, C does it and I have been bemoaning the fact that Java doesn't ever since I began using it. I want to be able to start a loop:
    while (x--)
    For those who know the rule that all non-zero numbers are true, there is a multitide of new choices!
    Join the revolution at
    http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6350717
    : )

  • Mediashield BIOS hangs Detecting Array

    Apologies for the long post...
    My mobo (MSI P7N Diamond 780i SLI / 570i SLI)
    The SATA drives are organised thus..
    SATA 1 - OCZ Vertex - Windows 7 Home (64bit) Retail version
    SATA 2 - Data HD
    SATA 3 - Mirror A
    SATA 4 - Mirror B
    SATA 5 - Mirror A
    SATA 6 - Mirror B
    more system details below...
    I had the system working reasonable well apart from a flip/flop array dead/alive problem that was really weird. See... https://forum-en.msi.com/index.php?topic=132584.0.
    In an attempt to get to the bottom of this problem I decided to install a new dual boot copy of Win 7 on SATA 2. I did this to see if a new install of Windows without my applications showed the same problem.
    On advice from the Win 7 forum, to ensure no corruption during the Win 7 install, I removed the SATA 3/4/5/6 cables from the drives. I then installed the new Win 7 and the latest nVidia raid driver on SATA 2.
    Then I reconnected the SATA 3/4/5/6 cables.
    Booted into the old Win 7 twice - the flip/flop problem still existed there. And then booted into the new Win 7. This showed the erring condition "array dead", but otherwise it worked ok. I restarted the new Win 7 expecting the flip/flop problem to show up, however, I never got into Windows.
    The system hung during the MediaShield BIOS with detecting array.
    The only way I could get it to boot, to get into the BIOS or Windows, was to remove all cables from SATA3/4/5/6.
    If I set the RAID mode to IDE, or disable the drives from RAID mode in the BIOS, I can restart with the cables attached. In windows explorer two of the array drives show up - one from each array. The other two drives show up in the Disk Manager apparently without a file system on them :-( 
    I have had this problem before and I found the only way to fix it was to run Darik's Nuke & Boot on the drives. Repartitioning them and reformatting did not get rid of the hang condition. I never did understand what was left on the drive after repartitioning/formatting that upset MediaShield.
    Does anyone have any advice on what I can do to narrow down to understand what is causing this to happen.
    BTW - This hardware has been running just fine for ages on XP. I have been trying to get a stable Win 7 setup for weeks now.
    Roy
    System Details
    Motherboard (MSI P7N Diamond 780i SLI / 570i SLI)
    No overclocking.
    CPU is Intel Core2 Duo E6850 3.00 Ghz
    Memory - 4Gig - Kingston Hyper KHX8500AD2K2/4G
    GPU - nVidia GeForce 9800 GT
    PSU - ThermalTake Toughpower 850 AP.
    There are no other cards in the system.
    The SATA drives are organised thus..
    SATA 1 - OCZ Vertex - Windows 7 Home (64bit) Retail version
    SATA 2 - Data HD (now new copy of Win 7 - Dual Boot)
    SATA 3 - Mirror A
    SATA 4 - Mirror B
    SATA 5 - Mirror A
    SATA 6 - Mirror B
    nVidia nForce drivers (11.1.0.33)
    Motherboard 1.51 BIOS, and latest
    Motherboard revision is 020.

    You started this topic already in the Win7 section. You stated to start a new one.
    I have a better idea: I will move the other topic in here.
    Next time, please ask to move a topic in stead of starting one with the same question.
    Thanks!!

  • Puzzler - Is there a way to detect when an external headphone or speaker is plugged in?

    I have a puzzler, and my initial question is simply, is there a way to see via Windows if/when an external headphone or microphone is plugged in, or is that all an electrical circuit independent of the OS?
    Background: (not necessarily the question I'm asking, but providing anyway):
    The background is this:  Dozens, Hundreds, I think Thousands of owners of Toshiba Satellite owners with Conexant sound devices (including myself) the world over have this problem where the sound stops working about 1 to 2 minutes into playing non-stop
    sounds/music/videos.  In spite of all the experts telling these poor people to run a system restore and wipe out the past years of files and everything on their computer, the problem prevails no matter what.  Some have even installed Linux, and the
    problem persists. To me, it seems that the problem doesn't occur if the only sounds are the occasional bing or bong from a system warning, it seems to fail after 1 to 2 minutes of continuous play (but this particular observation is mine only, nobody else has
    taken the time to point that out).
    A few have claimed success via blowing the jacks out with compressed air, but that's not repeatable universally.  Most people end up keeping external speakers plugged in permanently. In other words, it seems a lot like a hardware problem; However,
    {edit 3}, my addition of "Edit 2" below makes it seem less like hardware.
    One interesting thing:  Headphones/speakers work permanently, there's no problem.  More curiously, when the sound goes out, plugging any form of headphone/microphone jack into
    EITHER the headphone
    OR the microphone jack turns the sound back on too.  This includes male-to-male extension cable with nothing installed.  If nothing is on the other end, the sound will go out
    again shortly, but jiggling or removing the male to male turns it back on.
    EDIT 2: When the sound goes out, another way to get it back: From system tray, right click the speaker item and choose SOUNDS.  The virtual VU meter shows that audio is playing (in tandem with the song, etc.), and is still showing audio
    playing.  The tabs available are Playback, Recording, Sounds, and Communications.  When the sound does stop (assuming I was watching Playback), I click the Recording tab (just the tab header), and sound starts again.
    P.S. What's the difference between "High Definition Audio Controller" under System Devices, and "Conexant SmartAudio HD" under "Sound, Video, and Game Controllers", in Device Manager?  The "conexant smartaudio hd"
    points to the latest Conexant driver, the "High Definition Audio Controller" points to a default windows driver.  Just curious
    I've Binged this extensively:  Toshiba doesn't acknowledge the problem and nobody has fully solved the issue. I'm just curiously trying a few things myself, and I'm not sure if there's a way for the system to tell me an external mic/speaker has been
    plugged in.
    So to recap:  My main question, can I detect when the computer thinks a headphone or microphone is plugged in? (My theory, if I can prove that the computer THINKS something is plugged in, it's a start). 
    Only secondarily, if anyone's interested, feel free to suggest ideas (here's what dozens of other posts have disproven: System restore; windows reinstall; outdated sound driver; outdated video driver; remove and re-detect sound and device via device manager;
    malware; BIOS upgrade; Flash and/or the Flash/Firefox/Hardware Acceleration issue (problem happens with MP3, Flash, WMA, HTML5, Games, everything).
    Thanks in advance!
    EDIT: One person (theirs was under warranty, mine's not) ended up getting a new motherboard & speaker via Toshiba warranty, diagnosis ""machine intermittent no sound due to PCB faulty".  I'm still interested in troubleshooting,
    though.  Link:
    One lucky person, who got their motherboard replaced (they were under warranty, most of us aren't)

    Hi,
    If there are any headphone or speaker plugged in and detected, it will show in audio device manager console.
    Type mmsys.cpl in Run, it will open Sound console.
    Have you tried Hardware and Sound troubleshooter?
    Andy Altmann
    TechNet Community Support

  • Print specific array index

    How do i print out a specific slot of the array created from the following function? I can print them all by putting the dynamic counter varible in the index parameter but if i put a number instead of the dynamic "counter" variable in the index parmeter then the io exception is thrown. this function gets called every time a node in an XML document is encountered. Just printing the same index multiple time would be acceptable as this is just a learning script.
      private void showData (String s)
        throws SAXException
            try {
                arr0[numCt]=s;
                out.write(arr0[0]);
                //out.write (s);
                out.flush ();
                numCt++;
            } catch (IOException e) {
                throw new SAXException ("I/O error", e);
        }

    SAX parsing has nothing to do with your array problem. It should not be in your example.
    Your example is not small.
    It does not compile.
    It uses deprecated methods, and you know it does.
    You shouldn't even be trying to parse an xml document if you can't iterate over and access data from an array properly. There is a link to the tutorials at the top of the New To Java forums.
    Also, from your previous post you don't even know the syntax of this language. You can't just toss a bunch of code into a text document and hope to get something useful.
    Also, do not berate people trying to help you and do not demand answers. Your lack of understanding is your own fault not ours. You would be wise to reread posts you don't comprehend, or purchase learning materials to fill the gaps in your knowledge.
    Here is a working example with arrays throwing out all the XML garbage that shouldn't even be in your example.
    There are two examples: One example uses your swiss army knife method. And the other "better" example uses discrete methods that perform individual functions denoted by their names.
    If you continue to be an ass to this forums contributors don't expect answers.
    import sun.plugin.dom.exception.InvalidStateException;
    public class BooksLibrary {
        private int numCt = 0;
        private String[] arr0 = new String[100];
        public static void main(String argv[]) {
            System.out.println("Tour way: \n");
            yourWay();
            System.out.println("\n\nReasonable way: \n");
            reasonableWay();
        private static void yourWay() {
            BooksLibrary bl = new BooksLibrary();
            bl.fillArray();
        private void fillArray() {
            for(int i=0; i < arr0.length; i++) {
                showData("" + i);
            System.out.println();
            Is this method showing data? yes
            Should this method also add data to the array? no
            Should this method only show the data in index zero and not the data in the index that was just assigned? no
            What is the purpose of this method?
        private void showData(String s) {
            arr0[numCt] = s;
            System.out.print(arr0[0] + " ");
            numCt++;
        private static void reasonableWay() {
            BooksLibrary bl = new BooksLibrary();
            try {
                bl.showLastAddedData();
            } catch (Exception e) {
                System.out.println("No Data Added");
            try {
                bl.showAllAddedData();
            } catch (Exception e) {
                System.out.println("No Data Added");
            for(int i=0; i<5; i++) {
                bl.addData("" + i);
            try {
                bl.showLastAddedData();
            } catch (Exception e) {
                System.out.println("No Data Added");
            try {
                bl.showAllAddedData();
            } catch (Exception e) {
                System.out.println("No Data Added");
            //try to add too much data
            try {
                for(int i=0; i < 1000; i++) {
                    bl.addData("" + i);
            } catch (Exception e) {
                e.printStackTrace(System.out);
        private void addData(String s) {
            arr0[numCt++] = s;
        private void showLastAddedData() {
            if(numCt <= 0) {
                throw new InvalidStateException("No data has been added to array yet");
            System.out.println(arr0[numCt - 1]);
        private void showAllAddedData() {
            if(numCt <= 0) {
                throw new InvalidStateException("No data has been added to array yet");
            for(int i = 0; i < numCt; i++) {
                System.out.print(arr0[i] + " ");
            System.out.println();
    }

  • Any way to utilize CTXCAT index?

    I’ve been looking into trying to add indexes to columns in a table which have a data type of VARCHAR2(4000). Does anyone know if there is a way to utilize a CTXCAT index from an OBIEE request? It requires a special syntax in the where clause so I'm not sure if there is a way to make OBIEE actual take advantage of the index if I do create it.
    Edited by: PBizme on May 6, 2010 2:31 PM

    Incase anyone else needs it, here are the pinouts:
    - Analog Ground
    2 - Analog Headphone Out Left
    3 - Audio Backpanel Mute -- short to ground to mute the backpanel (when headphones are plugged in)
    4 - Analog Headphone Out Right
    5 - same as #3
    6 - Mic input from front panel
    7 - key pin (shouldn't be there)
    8 - VREF out -- voltage reference for Mic
    9 - MIC IN MUTE -- ground when mic isn't plugged in, +2VDC when mic is plugged in
    0 - Audio cable detect -- will be ground when headphones are plugged in (not normally used)
    Side view of the card:
    [img"]http://www.cs.rpi.edu/&#37;7Ehollec/images/sonata+audigy.jpg">

  • 2-D array indexing

    So, I'm having trouble getting this simple 2-D array vi to work the the way I think it should. The vi is taken from a larger one that I'm writing to provide motion control signals to a 3-axis stepper motor position stage. In the vi, the data being written to the array element in the for loop is to be the sensed positon value from one of the stepper motors.
    How this vi is working is that upon exiting the for loop, only the final element in row 0 has been updated, as opposed to each element in row zero, which is what I'm after.
    What am I doing wrong?
    Solved!
    Go to Solution.
    Attachments:
    array index.jpg ‏55 KB

    Message Edited by Root Canal on 10-16-2008 10:41 AM
    Message Edited by Root Canal on 10-16-2008 10:42 AM
    global variables make robots angry
    Attachments:
    use shift registers.vi ‏7 KB
    use shift registers.PNG ‏4 KB

  • Using Enum as Array Index

    Hi Experts,
    Can you please suggest whether it 's possible to use a Enum as an array index in java? In C++, I can define a enum and use the enum as the array index. But, for some reason, I 've not been able to do so in Java. Can anyone please help me in achieving this.
    Enum Index{indexOne, index2 ....};
    Index ind;
    and I should be able to use this for any array as an index:
    String s = stringArray[ind.indexOne];
    Is this possible in java? Please suggest.
    Thanks,
    Ganapathi

    Hi - the originator of this question has probably found a good answer to this question, but in case anyone else trips on this along the way:
    The oridinal() method can be used. Then spinning through the enumerated types, feels a little more like C.
    http://java.sun.com/j2se/1.5.0/docs/api/java/lang/Enum.html
    If it helps to see an example, here's one that follows from an exercise from the Sun tutorial dealing with representing a deck of playing cards. aCard is defined as a two dimensional array (suit, rank) with the suit and rank values defined as enums and used to represent a full deck of cards. A new Card class instance is generated and assigned to the array of cards (i.e. the deck of cards made up of instances of Cards, each named aCard).
    The part to look at is simply the use of ordinal() to reference array positions.
    private Card[][] aCard = new Card[NUM_SUITS][NUM_RANKS];
    suitLoop:
    for (Suit s: Suit.values()) {
    rankLoop:
    for (Rank r: Rank.values()) {
    aCard[s.ordinal()][r.ordinal()] = new Card(s, r);
    }

  • How I can rename an array index with ActiveX commands

    In the TestStand developer engine I can rename the index from an array from [1] to ["example"], thus I can point to an variable with the syntax Locals.Arrayname["example"].
    Is there an ActiveX command, which allow me to do this programmatically.

    I have quite the same question but for StationGlobals.
    I read data from a database .mdb, i create a typed array, i update the data in the array, everything is OK but i want to name the element of the array.
    I use the SetPropertyObject.Name, but i don't know how to update the name in the stationGlobals. I understand that i cannot create a new subproperty in a array directly with the named index, but i don't see the way to update the StationGlobals with the named property of the array element.
    Thanks for help
    Denis
    Attachments:
    Rename index in Globals.zip ‏43 KB

Maybe you are looking for

  • Ring on/notifications off

    Hi.  With the Xperia Z1, do you know if there is a way to (quickly) have my notifications turned off eg. SMS and email notifications,  but still have my phone able to ring? At night I need to have it on in case of calls due to a work situation, but d

  • Downloading Lightroom with Windows Vista

    Can I download Lightroom 5.5 with Windows Vista?

  • Another problem with XP

    I know a lot of people have had trouble with running java with XP. I run it fine on a laptop but just got a new desktop computer that won't run, I have read various things telling me to set the path to this, the classpath to that. after trying everyt

  • Ios 6.1

    Hi, I'm using an iPad 2, 6.0.1. Since updating my iPad to ios 6 my Apple VGA Adapter doesn't work. Will IOS 6.1 resolve this problem? Greetz

  • Sales of same material with and without batch

    Hello Experts, One of my requirement is To sell single material from same plant 1)with batches and 2)Without batches Will this be possible in R/3 and how? Please suggest. NVS