LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Custom button control with picture doesn't toggle when clicking on the custom image

I want to make a button with a custom icon. I've made one succesfully (see attached) but when I click on the part of the button where the image is, the button doesn't toggle. 

Basjong53_0-1674032822473.png

 

I know it can work, since the built-in "silver" button pallette has buttons with icons that toggle when you click anywhere. I want to have it like that, but with the NXG or System button pallette. 

 

How can I do this?

 

Download All
0 Kudos
Message 1 of 10
(1,512 Views)

Hi Basjong,

 

you need to add that image as "Decal" to your button in the control editor!

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 2 of 10
(1,490 Views)

I've tried this but the image shows as a black square on the button:

Basjong53_1-1674036034567.png

 

I've tried other icons that do seem to work however, maybe my image has some problems. Thank you for the reply!

 

0 Kudos
Message 3 of 10
(1,476 Views)

You have to load the image into clipboard using LabVIEW menu function:

menubar => Edit => Import Picture to Clipboard

 

George Zou
Message 4 of 10
(1,439 Views)

So first off, in order to be able to add pictures for each button state (there are 6 total button states on a System Boolean), you need to click the little wrench icon to change to Customize Mode. One by one, you will have to select the active Picture Item and assign a picture to it. Going from left to right, top to bottom, IIRC the states are as follows: off, on, on-off transition, off-on transition, mouse un-hover, mouse hover. Using these, you can make the control more visually interactive by doing something such as "lighting up the lightbulb" when the user clicks it, or adding a hover effect by making the "hover image" background color a few shades darker/lighter.

 

There are a couple caveats with this: the main one is that the image scales with the button when you make it larger, which can lead to very skewed/pixelated images if you change the size a bunch. The other somewhat related one, is that the image does in fact scale with the button as opposed to not scaling, as is the case on the default Silver Booleans that have images on them.

 

One other tidbit, if you start your custom control with one of those default Silver Booleans with an image in them, you can make a custom button of that "type", that has both a non-scaling image and associated text. But in that case you lose the "hover" picture items. If there's a way to add a non-scaling image to a custom System Boolean, I'd love to know how.

 

 

Spoiler
FireFistRedhawk_1-1674065796771.png

 

FireFistRedhawk_0-1674065783620.png

 

Redhawk
Test Engineer at Moog Inc.

Saying "Thanks that fixed it" or "Thanks that answers my question" and not giving a Kudo or Marked Solution, is like telling your waiter they did a great job and not leaving a tip. Please, tip your waiters.

0 Kudos
Message 5 of 10
(1,396 Views)

If there's a way to add a non-scaling image to a custom System Boolean, I'd love to know how.

If you import the image as a decal, the decal can be set to non-scaling.

 

George Zou
Message 6 of 10
(1,382 Views)

@zou wrote:

If there's a way to add a non-scaling image to a custom System Boolean, I'd love to know how.

If you import the image as a decal, the decal can be set to non-scaling.

 


Good to know. That almost works the way I wish it did. The only thing is, the decal image doesn't stay vertically centered the way the Silver Booleans' decal images do. Or at least, in LV17 I can't figure out how to make the decal image behave that way.

Redhawk
Test Engineer at Moog Inc.

Saying "Thanks that fixed it" or "Thanks that answers my question" and not giving a Kudo or Marked Solution, is like telling your waiter they did a great job and not leaving a tip. Please, tip your waiters.

0 Kudos
Message 7 of 10
(1,375 Views)

Add enableSecretPopups to labview.ini

Then you will get a lot of new settings.

 

George Zou
Message 8 of 10
(1,368 Views)

@zou wrote:

Add enableSecretPopups to labview.ini

Then you will get a lot of new settings.

 


Wow you weren't lying about there being a lot of extra options. 10x Kudos for this token that I had never come across until now.

Redhawk
Test Engineer at Moog Inc.

Saying "Thanks that fixed it" or "Thanks that answers my question" and not giving a Kudo or Marked Solution, is like telling your waiter they did a great job and not leaving a tip. Please, tip your waiters.

0 Kudos
Message 10 of 10
(1,357 Views)