gui.setPictureIcon

Assigns an icon to a component.

Prototype

  1. bOk = gui.setPictureIcon ( hComponent, hIcon )

Parameters

hComponent - valid GUI component handle
hIcon - icon handle


Return values

bOk - true on success


Sample

  1. local hComboBox = gui.getComponentFromInstance ( hInstance, "comboBox" )
  2. local hPicture = gui.getComponentFromInstance ( hInstance, "picture" )
  3. if ( hComboBox and hPicture ) then
  4. local hIcon = gui.getComboBoxItemData ( gui.getComboBoxSelectedItem ( hComboBox ), gui.kDataRoleUser + 1 )
  5.  
  6. if ( utils.getVariableType ( hIcon ) == utils.kVariableTypeIcon ) then
  7. gui.setPictureIcon ( hPicture, hIcon )
  8. elseif ( utils.getVariableType ( hIcon ) == utils.kVariableTypeFile ) then
  9. gui.setPictureFile ( hPicture, hIcon )
  10. elseif ( utils.getVariableType ( hIcon ) == utils.kVariableTypePixmap ) then
  11. gui.setPicturePixmap ( hPicture, hIcon )
  12. elseif ( utils.getVariableType ( hIcon ) == utils.kVariableTypeString ) then
  13. gui.setPictureIcon ( hPicture, gui.getIcon ( hIcon ) )
  14. end
  15. end

Available since ShiVa 2.0