Shiny Language Reference

Language Reference > User Interface


setcontrolblendconst

setcontrolblendconst(int ID, int iConstant);

 

Synonyms:

setcontrolblendconstant(int ID, int iConstant);

setcontrolbc(int ID, int iConstant);

 

 

Sets the constant blending factor used for a control

The SETCONTROLBLENDCONST statement sets the blending factor used when drawing the specified control to the plugin display panel. This setting has no effect on the actual control, it simply controls the method by which the control is drawn. For example, this statement allows controls to be drawn partially transparent on a panel regardless of the panel settings. This setting can be used for drawing graphics under a control and allowing them to show through. The transparency effect is cumulative.

Custom draw controls can use this statement as normal. If a custom draw control uses images with per-pixel alpha data (PNG images), the transparency effect is still cumulative. In other words, the transparency specified per pixel in the image will be obeyed first, and the blending factor will be applied last when drawing the control.

Please experiment with this statement to understand its effects. They are easy to understand once visualized.

 

Parameters

ID

The ID of the control to change blending.

iConstant

A value between 0 and 255 specifying the amount of blending to apply when drawing the control. A value of 0 indicates the control is completely transparent, a value of 255 indicates the control is completely opaque. Setting this parameter to 255 is the correct way to remove any previously set blending factor.

 

Return Value

None

 

Example Code

function Init()
{
    // Create a button
    int ExplorerButtonID = createbutton(1, 10, 10, 50, 20);
    
    // Make the button 50% transparent
    setcontrolblendconst(ExplorerButtonID, 128);
}