04-30-2013 01:51 PM
Last week, I was browsing these forums for a way of making an array of buttons (or indicators) with separate boolean text for each button. I stumbled upon a suggestion from I BELIEVE it was Ben (Sorry if I'm misattributing it) to use an array of 2D images with a "Mouse Down" event to click. I wrapped all this into an XControl so I can pass it as a boolean array (using property nodes to change the boolean text.) So far so good.
The only hiccup I've run into so far is that if I grab an image of an indicator, it adds an extra 3 pixel border on every side. I'd like both indicators and buttons to be the same size, as it makes the transition from control to/from indicator not change the size of the control.
I've attached an image of the problem, and I'm not sure the best way to go about this. I have no idea how to crop 2D images, or if that is even the best way of going about it.
Any help would be appreciated. I've attached the section of the code with the issue.
Solved! Go to Solution.
05-01-2013 02:24 AM
If you will look closely, you will note that the LED has a 3 pixel bezeled border, which corresponds to this. The problem is that LV is not entirely consistent in how it deals with these borders (you can't use them to set the size, as you saw, but they do apply when aligning, etc.). The easiest thing to do in your case would be to crop the image, which is easy enough, even if you don't know how (and looking at the avaiable functions and examples is a good start) - unflatten pixmap, array subset on the output, draw unflattened pixmap. The sizes for the array subset can come from inside the case structure.
05-07-2013 09:02 AM
Thanks for this. I wasn't sure if there was an easier method. It didn't occur to me that I could just subset the pixel map. *facepalm*
Actually, this XControl is turning out quite nice. I could imagine using it a lot, but this problem was messing up my spacing. So thanks for the help on that.