LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Custom control: text gets in the way of click

I want to have a pair of buttons that are mutually exclusive; only one can be selected at a time. I looked at the examples provided with LabView, and some of the samples from this forum, but I really want to stay away from adding a lot of code to do this.

I decided the best way to do this would be to create a custom control. Basically, I took the slider control and replaced the tick marks with images of unselected buttons, and replaced the slider with an image of the selected button.

My problem is this: I want to have captions on both of the buttons, but when I add text labels, the text gets in the way of selecting the button. Is there any way to have text similar to the 'caption' on the button control, such t
hat it won't be in the way (so that the text is 'transparent' to clicks)?

I have attached my control to this post.

Thanks,

Lance F.
0 Kudos
Message 1 of 10
(3,379 Views)
This is called radio buttons...radio buttons is quite simple to do (lot's of examples here on the zone).

If you don't want any code at all and there is only two buttons one thing you could do is go for a three-state switch (same number of options that you have with two exclusive buttons (one or the other true, or none of them true...). An example of such a switch is here:

http://sine.ni.com/apps/we/niepd_web_display.DISPLAY_EPD4?p_guid=B123AE0CB97A111EE034080020E74861&p_node=DZ52036&p_submitted=N&p_rank=&p_answer=&p_source=External

Using a slider you are really not using the "none are true" option though, are you...? In that case you don't need two buttons, only one (logic-wise that is).
0 Kudos
Message 2 of 10
(3,379 Views)
Hi,
Mads is right, what you need is Radio button control. I don't know why NI doesn't include it in controls palette for so many years.
So what I want to say is that a set of radio button controls is included in Labview package. They are located in
"..YourLabviewDir\examples\general\controls\boolean.llb"
You will find there from 2 to 5 radio buttons controls. And I think this will not be very hard to expand them to more buttons manually.

Good luck.

Oleg Chutko.
0 Kudos
Message 3 of 10
(3,379 Views)
I know radio buttons would work, but the problem is that I'm trying to reproduce the interface of a piece of hardware. It consists of a panel of rectangular buttons, and I want the LabVIEW version to stay true to this. Therefore, using a control which appears visually different won't do.

Thanks, though.

Lance F.
0 Kudos
Message 4 of 10
(3,379 Views)
Those buttons are replacable!
Ian F
Since LabVIEW 5.1... 7.1.1... 2009, 2010, 2014
依恩与LabVIEW
LVVILIB.blogspot.com
0 Kudos
Message 5 of 10
(3,379 Views)
As Ian says, the graphical apperance of the buttons have nothing to do with the radio-button functionality (i.e. the exclusive selection), right-click on them and replace them with whatever button fits the best (or, if the available buttons are a bit off - create custom buttons...)
0 Kudos
Message 6 of 10
(3,379 Views)
Try selecting the caption (text box) and going to the tool bar and try
selecting move to back or move backward from the reorder tool.
You may also need to make the text background transparent using the color
tool.
Try sending the VI without the security implemented. If you don't want to
send the entire code then just send the two controls.
Good luck,
-Tom

"Lance F." wrote in message
news:506500000008000000BF800000-1042324653000@exchange.ni.com...
> I want to have a pair of buttons that are mutually exclusive; only one
> can be selected at a time. I looked at the examples provided with
> LabView, and some of the samples from this forum, but I really want to
> stay away from adding a lot of code to do this.
>
> I decided the best way to do this would b
e to create a custom control.
> Basically, I took the slider control and replaced the tick marks with
> images of unselected buttons, and replaced the slider with an image of
> the selected button.
>
> My problem is this: I want to have captions on both of the buttons,
> but when I add text labels, the text gets in the way of selecting the
> button. Is there any way to have text similar to the 'caption' on the
> button control, such that it won't be in the way (so that the text is
> 'transparent' to clicks)?
>
> I have attached my control to this post.
>
> Thanks,
>
> Lance F.
0 Kudos
Message 7 of 10
(3,379 Views)
Hey Lance,

I am having the same problem with the text on the buttons getting in the way of being able to click on them. Have you figured out a way to get around this?

Thanks,
Chris
0 Kudos
Message 8 of 10
(3,378 Views)
I would use real buttons in an event structure - the code is not that difficult:

Event 0: Button A Changes value:
If New Value = true
Button B.Value = false (property node)
Event 1: Button B changes value:
If New Value = true
Button A.Value = false (property node)

Use the BOOLEAN TEXT of the button to display whatever is appropriate - it won't shield the mouse.
Steve Bird
Culverson Software - Elegant software that is a pleasure to use.
Culverson.com


LinkedIn

Blog for (mostly LabVIEW) programmers: Tips And Tricks

0 Kudos
Message 9 of 10
(3,378 Views)
> I am having the same problem with the text on the buttons getting in
> the way of being able to click on them. Have you figured out a way to
> get around this?
>

I'm not seeing the original postings, but I suspect that you have either
moved the label, caption, or added a free label to the Boolean and are
having problems because the label doesn't respond to mouse clicks.
There is a Label built into pretty much all Booleans called Boolean
Text. Make it visible and use that instead. Inside or outside the
Boolean, it responds to clicks the same as the button does.

Greg McKaskle
0 Kudos
Message 10 of 10
(3,378 Views)