LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Triangle or free shape Boolean control

See this Community nugget.

 

The shape of a control depends on the shape of the graphics in the controls parts.  you'll need something just a bit petter than MS Paint yo be able to save shapes that are not rectangulat.  Tim mentions a few in his nugget


"Should be" isn't "Is" -Jay
Message 11 of 30
(3,048 Views)

I can't do free shape, but here is triangle.

It's quite possibly the ugliest control I've ever made but it demonstrates the concept.

You can change the images for prettier ones later.

 

Triangle Buttons.png

 

 

Troy - CLD "If a hammer is the only tool you have, everything starts to look like a nail." ~ Maslow/Kaplan - Law of the instrument
Message 12 of 30
(3,025 Views)

It turns out changing the images is harder than it seems!

The images I used in the example were the LabVIEW triangular shaped decorations.

Using them you CAN make triangular buttons. But if you replace the images, they go rectangular again.

 

In this version of the triangle buttons example I've have to make the original control invisible and line it up over picture rings.

Hovering over and clicking on the original control (even though you can't see it) triggers changes to the picture rings underneath.

So it looks like it works the way you expect it to.

 

Triangle Buttons 2.png 

 

Lots of event handling though. Quite inconvenient to implement.

Troy - CLD "If a hammer is the only tool you have, everything starts to look like a nail." ~ Maslow/Kaplan - Law of the instrument
Message 13 of 30
(3,016 Views)

Does it have to be perfect?

 

Why don't you use some round controls and a little customization?

Here some ideas.

 

 

 cccc2.png   cccc.png

Message 14 of 30
(3,006 Views)

Troy,

 

Your VI is an excellent candidate for an XControl to abstract out the event handling code.

 

Very nice.

Thoric (CLA, CLED, CTD and LabVIEW Champion)


0 Kudos
Message 15 of 30
(2,989 Views)

adding fule to the fire and tossing about thoughts.

 

I have done similar and yes it requires a lot of code to support it.

 

1) You can use transparent decorations to cover areas where you don't wna the click to be active. So use them to cover the trnasparent parts.

 

2) A rectangular sweet spot requires ony tow "In range" checks to see if the click was over a sweet spot. Non-rectangular shapres require knowlege of the function that defines the boundry so we need four sets of "m"s and "b"s and to evaluate if the click was a sweet spot.

 

In my rescent version I implemented the control as an object that was capable of evaluating if it was clicked. I think that app required about 1200-1500 VIs to realize the GUI.

 

So yes the Picture control can do it but if you can get away with native controls and hacks go for it.

 

Ben

Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
Message 16 of 30
(2,983 Views)

Toine,

 

I think you should post an idea in the LabVIEW Idea Exchange on this. I think it's long overdue that LabVIEW have the capability of creating such controls. I can have a button be of an arbitrary shape in a Visual Studio app, and as LabVIEW is a GUI-intensive environment, it should be easy to do it, rather than having to jump through so many hoops.

 

While anyone can post this idea, since you brough up the issue, you should get the post (and the Kudos).

Message 17 of 30
(2,974 Views)

Thanks every body,

 

I can use the triangle shape.

 

Troy, I looked everywhere to make/find this shape.

How did you make/find it. Because it looks like a rectangle but the selection is only in the triangle.

 

 

triangle-control.JPG

 

 

With kind regards,

Toine

 

 

0 Kudos
Message 18 of 30
(2,929 Views)

@Troy K wrote:

"The images I used in the example were the LabVIEW triangular shaped decorations."


In the Front Panel controls 'Decorations' menu.

Troy - CLD "If a hammer is the only tool you have, everything starts to look like a nail." ~ Maslow/Kaplan - Law of the instrument
0 Kudos
Message 19 of 30
(2,905 Views)

 it looks like a rectangle but the selection is only in the triangle.

 


this works only with the shapes provided in decoration palatte.

but the problem remains in place if you customized through any other picture or shape.

0 Kudos
Message 20 of 30
(2,882 Views)