12-20-2012 03:33 PM
12-20-2012 04:05 PM
@ShotSimon wrote:
With Ctrl-H context help enabled. Hover over the control...what does LabVIEW tell you the control is?
Hello Shot Simon,
It says Picture/NewPicture/Data.
Not sure what it means. I am actually attaching the file here which I am trying to replicate.
12-20-2012 04:15 PM
So I stretched out one of the constants, and what do I see? Like I said, they drew a rectangle in an indicator and then either turned it into a constant, or created a constant off of it.
Mike...
12-20-2012 06:53 PM
I've seen that code before, and it is 100x too complicated and convoluted for what it needs to be. Virtually all mouse event could be combined into one. All pictures could be replaced by colorbox constant. (see for example my quick draft posted here over a year ago)
In any case, I would recommend to learn LabVIEW by first by looking at some good examples, not some random stuff you found on the internet. 😄
12-21-2012 09:54 AM
@altenbach wrote:
I've seen that code before, and it is 100x too complicated and convoluted for what it needs to be. Virtually all mouse event could be combined into one. All pictures could be replaced by colorbox constant. (see for example my quick draft posted here over a year ago)
In any case, I would recommend to learn LabVIEW by first by looking at some good examples, not some random stuff you found on the internet. 😄
Hello Altenbach,
I did check your code but I couldnt understand it completely . I had mailed you even in the earlier message.
If possible ,Can you please elaborate on it as I am trying to understand what the code does.
Some of the questions which came to me are:
a) How did you customize the " 2D Picture/ Color Box to look this way. When I implemented the same code and used Color Box, when ever I run the code and try to click the color box, it shows the menu with different colors ( which is typically shown in color box). How shoud it be disabled?
b) Also even though I followed the code which you have shown , my code does not run the same way. There is a mismatch and it does not consider the first element of the array at all ( The element 00 is not considered, also row 0 is not working at all!!) I am not sure why.
I also tried adding a picture from powerpoint to customize the color box. ( I went to advanced-customize- and took a picture from powerpoint and added onto it..) However it behaves more weirdly when clicked.
This brings up to some of the questions in the code:
For example, why are we able to get "coords" option in events only when we use "Mouse Up" and not anything else and what is its use? What values is it outputting and why are we comparing it with position Left?
What does the number 42 in the block diagram signify? Based on how I change the number it changes the way the color box buttons operate. For example , the number 42 does not make the element A10 work. If number is 50, then the element A17 changes color when I click even around element A18. I am not sure what it signifies. Can you please elaborate.
I tried looking at some Labview books , however even though it explains the basics, there is not much information on efficient porgramming skills and nuances of LabVIEW. I beleive that can be obtained only through a lot of practice and patience..
I beleive my questions are very simple and it will be really wonderful if you can help me out and elaborate on it.
12-21-2012 11:55 AM - edited 12-21-2012 11:56 AM
The problems you are encountering have nothing to do with LabVIEW. They are simple geometry problems.
From the coordinates, we get the pixel position of where the mouse action occurred and we need to translate that into an array index. The reference is the left position of the array on the panel. If you cannot click the leftmost elements, most likely you are showing the index display, which gives you an offset. You either need to account for the size of the array index or hide the array index as in my example (right-click...visible items...). Each color box is 42 pixels wide, so by dividing by 42 we get the array index.
If you don't want to trigger the color dialog at run time, you need to disable the control (or make it an indicator). If you right-click on one of my array elements...advanced...enabled state, you see that they are disabled, meaning they cannot be operated directly at run time.
Please explain the problem, "weirdly" is not a technical term that has a precise meaning.
All this can be easily explored by simple experimenting. Create an indicator on all the coordinates and other interesting wires so you see interactively what comes out as a function of where you operate the mouse. That's the best way to learn!
12-27-2012 01:51 PM
Hello Altenbach,
Thanks a lot for the response. That was really helpful. However can you please explain how you figured out each color box was 42 pixels wide? I am assuming it cant be a constant and can change based on how we size the color box. In that case , I checked your color box dimensions, it is 40 by 40. I checked my dimensions too using the property node and width and height, mine was around 28. However using that doesnt work.
It would be really nice if you can explain how this is found.
12-27-2012 02:12 PM
Hello altenbach,
I think I actually figured it out. Thanks a lot.
🙂
G
12-28-2012 01:42 PM
Hello Altenbach,
I have a similar set up running for myself. However I am a little concerned that even though I have 12 elements per array, the program works only for 9 elements and it stops. I am not sure why this is happening.
Can you please help me in this. I have attached my file ( LabVIEW 7.1) in this.
Thanks
12-28-2012 04:37 PM - edited 12-28-2012 04:38 PM
Make sure the four arrays on top are initialized with the desired number of elements. By default, you currently start out with four empty arrays, and no amount of "replace array subset" will increase that number of elements. You cannot replace something that does not exist!
Click on the right-most elements of each of the four arrays in edit mode to make the array the correct size (elements are no longer greyed). Now make the new values the default and save the VI.