07-21-2009 12:15 PM
Hi,
I am trying to customize a button control. I have created a graphic to replace one of the standard 'Picture Items' (accessed through the customize control, double click on the graphic).
The control i am customizing is circular. The graphic i have created is also circular, i have saved it as a .PNG or .EMF, with the square white background set to transparent.
When i 'Import from File' in LV the import works ok.
The issue is the image still has it's square box shape (though the background is transparent), this then makes the control active area square, which means the control can be activated by clicking on the part of it which is transparent (i.e. one of the corners of the bounding box).
Is it possible to create a graphic that is round, or get the customized control ignore the transparent areas?
-or are all customized controls with imported graphics rectangluar?
Thanks,
Blue
Solved! Go to Solution.
07-22-2009 04:20 AM
Hi,
Please look at the forum post below:
http://forums.ni.com/ni/board/message?board.id=170&thread.id=390376
07-22-2009 06:13 AM
Thanks for the reply Mark. I have read that post and the associated ones.
They do not directly answer my original post. Though the answer appears to be 'No, you can't customize control graphics and have the control work as a circular control'?
The linked thread by tst suggests something may be possible using masking, though that example does not allow you to click through the 'cut out', and the circular shape is achieved by using a standard dial and mapping images on to it. -and a pretty complex way to achieve it... just for a basic control.
Is it possible to click through the transparent part of an image to activate a control underneath? -the default is no, but can this be changed?
Blue
07-22-2009 07:15 AM
07-22-2009 08:14 AM
Hello Jeff,
Thanks for the post, but i don't understand how the colour control relates to my question.
If i create a customized control (attached to initial post) is it possible to avoid the issue described in the VI (also attached to original post) of invisible/transparent areas being active.
Thanks,
Blue
07-22-2009 10:16 AM
BlueTwo wrote:Hello Jeff,
Thanks for the post, but i don't understand how the colour control relates to my question.
If i create a customized control (attached to initial post) is it possible to avoid the issue described in the VI (also attached to original post) of invisible/transparent areas being active.
Thanks,
Blue
In a limited case yes but not for what you are trying, for two reasons, circlular region and close spacing in the final use.
For objects with straight edges I could use transparent decorations in the cusomized control to mask mouse clicks out side the desired region. Since out choice of decorations is very limited, no circle availabel as decoration. So i can create a collection of booleans that look like the cursor control. But if I try to squeeze them close to look like the cursor control the masked regions of adjacent control over-lap... bummer.
If you really need this functionality then use a Picture Control with an image of your controls and watch for mouse down and then decide which quadrant the click was in and act accordingly.
Just trying to help,
Ben
07-22-2009 10:29 AM
Forget my comments about cursor control. I mixed up two threads with similar themes.
Ben
07-22-2009 10:37 AM
Hi Ben,
Ok.... thanks for the info.
I'll do some rudimentary masking using decorations if it becomes problematic. -don't fancy learning about picture controls right now, i'll put it on my list.
Cheers,
Blue
07-22-2009 10:40 AM
I opened your VI in the LV 2009 beta and I can only change the value of the control when clicking on the imported image. Clicking where the arrow points or anywhere else within the rectangle but outside the black outline does nothing (so it works as you want). I don't know whether this is because of a change in 2009 or something to do with my PC (XP on a virtual machine), but you should be able to find out soon enough when 2009 comes out.
Another workaround you can try for now is opening the custom control in the editing mode and moving the shadow to the top of the Z order. Because the shadow isn't clickable and has a "hole" in the middle it might work. It does work here, but again, that might be due to the new version.
07-22-2009 11:21 AM - edited 07-22-2009 11:25 AM
Hey! Great.
I'm running XP sp3 on a virtual machine only LV 8.6 though. Just checked it again and it does not work, so may be it is a change for LV 2009.
However, changing the Z axis so the border/shadow is on the top does work, though the border needs to be expanded slightly (otherwise the border/shadow is visible on the edge of the control graphic).
Thanks for the tip, a solution i think.
Blue