NI Home
Cart Cart | Help
Hello Events Academic NI Developer Zone Support Solutions Products & Services Contact NI MyNI
You are here: 
NI Home > NI Developer Zone > NI Discussion Forums


Reply
Proven Zealot
Jeff·Þ·Bohrer
Posts: 5,339

Re: 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


"All shall be well and all shall be well and all manner of things shall be well" -Julian
Active Participant
TroyK
Posts: 355

Re: Triangle or free shape Boolean control

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
Each snowflake in an avalanche pleads not guilty. - Stanislaw J. Lec
I haven't failed, I've found 10,000 ways that don't work - Thomas Edison
Beware of the man who won't be bothered with details. - William Feather
The greatest of faults is to be conscious of none. - Thomas Carlyle
Active Participant
TroyK
Posts: 355

Re: Triangle or free shape Boolean control

[ Edited ]

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
Each snowflake in an avalanche pleads not guilty. - Stanislaw J. Lec
I haven't failed, I've found 10,000 ways that don't work - Thomas Edison
Beware of the man who won't be bothered with details. - William Feather
The greatest of faults is to be conscious of none. - Thomas Carlyle
Member
keptat
Posts: 31

Re: Triangle or free shape Boolean control

[ Edited ]

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

Active Participant
Thoric
Posts: 1,065
0 Kudos

Re: Triangle or free shape Boolean control

Troy,

 

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

 

Very nice.

Thoric (Certified LabVIEW Architect and LabVIEW Champion)
Knight of NI
Knight of NI
Ben
Posts: 16,091

Re: Triangle or free shape Boolean control

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

Ben Rayner
Who is NOT John Galt... yet... just building Rayner's Ridge

Knight of NI
Posts: 18,064

Re: Triangle or free shape Boolean control

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).

Member
toineroetman
Posts: 26
0 Kudos

Re: Triangle or free shape Boolean control

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

 

 

Active Participant
TroyK
Posts: 355
0 Kudos

Re: Triangle or free shape Boolean control


Troy K wrote:

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


In the Front Panel controls 'Decorations' menu.

Troy
Each snowflake in an avalanche pleads not guilty. - Stanislaw J. Lec
I haven't failed, I've found 10,000 ways that don't work - Thomas Edison
Beware of the man who won't be bothered with details. - William Feather
The greatest of faults is to be conscious of none. - Thomas Carlyle
Member
alok.p
Posts: 49
0 Kudos

Re: Triangle or free shape Boolean control

 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.

By using this web site, you accept the Terms of Use for this web site. Please read these Terms of Use carefully before using any part of this site. Please go here for information on ni.com's copyright infringement policy.
My Profile | Privacy | Legal | Contact NI © 2011 National Instruments Corporation. All rights reserved.    |    E-Mail this Page E-Mail this Page