LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

transparent button control

I'm looking for a way to make a button transparent but still allow the application events to occur when selected. I'm try to put an image on a panel then just select parts of the image to make different things happen.

 

Yes, reading the mouse coordinates and then performing the appropriate action would be one way accomplish this but having a button with a callback would be cleaner. Any ideas?

0 Kudos
Message 1 of 8
(4,618 Views)

Hi Craige,

 

If you modify the z-coordinate of the button to place it behind some other control on the panel, its hotkey would still be active, but it would not be selectable with the mouse. Alternatively, to make the button transparent, you can change its colour to transparent by selecting 'T' in the colour pallette, when editing its properties (click the paint button and right-click to bring up the pallette). You may also need to change the colour of its border. Delete any text that would normally be on the button. I guess that you might then be able to place it on top of your image.

 

John.

Message 2 of 8
(4,608 Views)
Use classic-style rounded command button: it can be painted in transparent even with "Windows visual style for controls" and "Conform to system colors" attributes set. Unfortunately, you cannot avoid a dotted box arount the label when the button is the active control (even if the button has no label a small dotted box is still visible) so you will need to set another control as the active one inside the button callback.


Proud to use LW/CVI from 3.1 on.

My contributions to the Developer Community
________________________________________
If I have helped you, why not giving me a kudos?
0 Kudos
Message 3 of 8
(4,605 Views)

I avoid the "dotted box around label" issue by moving the label so it is off the visible screen. (Either in the GUI editor or programmatically). Panels are so much nicer without the dotted boxes everywhere. Smiley Tongue

 

JR

0 Kudos
Message 4 of 8
(4,590 Views)

@JR: command button label cannot be moved outside the control...

 

 

Actually I have to correct myself and add a trick: if the panel hase the "Conform to system colors" enabled, nonebutton can be painted in a different color, but if you disable that attribute, paint the button in transparent and then re-enable it, the transparent color is maintained (and this is true also for round and oblong classic-style command button).



Proud to use LW/CVI from 3.1 on.

My contributions to the Developer Community
________________________________________
If I have helped you, why not giving me a kudos?
0 Kudos
Message 5 of 8
(4,587 Views)

If you use a Picture button, you can move the label off screen. In fact you can make the button transparant easily and achieve the OP's objective.

 

JR

0 Kudos
Message 6 of 8
(4,583 Views)

Aha! I hadn't considered the picture command button....

Even with this you must uncheck windows visual style for controls and conform to system colors before painting it in transparent and recheck them again after painting. And this trick works with standard "lab-style" controls too!

 

I wonder if such a trick can introduce some unwanted behaviour in the application...



Proud to use LW/CVI from 3.1 on.

My contributions to the Developer Community
________________________________________
If I have helped you, why not giving me a kudos?
0 Kudos
Message 7 of 8
(4,577 Views)

Great! Looks like there are plenty of ways to accomplish this.Thanks for the help.

 

Craig

0 Kudos
Message 8 of 8
(4,560 Views)