Introduction

Series of know issues articles are showing known issue itself about Small Basic and it's workaround. In this article, local means Small Basic IDE environment and remote means internet browser environment with Silverlight add-in.

Phenomena

Following message comes up when Shapes.GetOpacity() operation is executed in local.  In remote, the program hangs up at Shapes.GetOpacity().

The whole message is as follows.  Cast means that conversion between two data types.

Specified cast is not valid.
   at Microsoft.SmallBasic.Library.Shapes.GetOpacity(Primitive shapeName)
   at _SmallBasicProgram._Main()

And in local, following pop-up window is displayed.  Please choose "Close the program" to shutdown the program.

Reproduction Requirements

This phenomenon can be reproduced with:

  • Small Basic 1.1 or before

Workaround

There is no way to use Shapes.GetOpacity() so far.  So, opacity should be memorized into a variable.

' original code
rect = Shapes.AddRectangle(100, 100)
Shepes.SetOpacity(rect, 50)
opacity = Shapes.GetOpacity(rect)

 

' workaround
rect = Shapes.AddRectangle(100, 100)
opacity = 50
Shepes.SetOpacity(rect, opacity)

Sample

Sample program to reproduce this issue is here.

See Also