none
Please help! RRS feed

  • Question

  • How do you make a operation without any arguments?

    Like

    GraphicsWindow.Show()

    Over

    GraphicsWindow.SetPixel(10,10,"Blue")

    (This is a extention problem BTW)

    They are both operation?

    Thanks for the help!


    One thing that is impossible is impossible no matter if it is proven so first.

    Wednesday, August 29, 2012 9:01 PM
    Answerer

Answers

  • The are both operations.  An operation can have as many or no arguments (all of type Primitive) and can return a value (again Primitive) or nothing.

    Try downloading ILSpy and opening any extension dll or SmallBasicLibrary.dll - it will decompile it and show you the VB or C# source!

    A Couple examples below - remember to add the intellisense info too.

    Public Function Add(value1 As Primitive, value2 As Primitive) As Primitive - arguments and return value

    Public Function Add() As Primitive - no arguments and return value

    Public Function Add(value1 As Primitive) - one argument and no return value

    • Marked as answer by Zock77Editor Wednesday, August 29, 2012 10:47 PM
    Wednesday, August 29, 2012 9:08 PM
    Moderator

All replies

  • The are both operations.  An operation can have as many or no arguments (all of type Primitive) and can return a value (again Primitive) or nothing.

    Try downloading ILSpy and opening any extension dll or SmallBasicLibrary.dll - it will decompile it and show you the VB or C# source!

    A Couple examples below - remember to add the intellisense info too.

    Public Function Add(value1 As Primitive, value2 As Primitive) As Primitive - arguments and return value

    Public Function Add() As Primitive - no arguments and return value

    Public Function Add(value1 As Primitive) - one argument and no return value

    • Marked as answer by Zock77Editor Wednesday, August 29, 2012 10:47 PM
    Wednesday, August 29, 2012 9:08 PM
    Moderator
  • Sweet! What about a Property?

    One thing that is impossible is impossible no matter if it is proven so first.

    Wednesday, August 29, 2012 9:33 PM
    Answerer
  • This if from ILSpy for GraphicsWindow.BrushColor - check the syntax out yourself easily using ILSpy.  Frankly I prefer the C# syntax, but either way?

    ' Microsoft.SmallBasic.Library.GraphicsWindow
    ''' <summary>
    ''' Gets or sets the brush color to be used to fill shapes drawn on the Graphics Window.
    ''' </summary>
    Public Shared Property BrushColor() As Primitive
    	Get
    		GraphicsWindow.VerifyAccess()
    		Return CStr(GraphicsWindow.InvokeWithReturn(Function() GraphicsWindow.GetStringFromColor(GraphicsWindow._fillBrush.Color)))
    	End Get
    	Set(value As Primitive)
    		GraphicsWindow.VerifyAccess()
    		GraphicsWindow.BeginInvoke(Sub()
    			GraphicsWindow._fillBrush = New SolidColorBrush(GraphicsWindow.GetColorFromString(value))
    			GraphicsWindow._fillBrush.Freeze()
    		End Sub)
    	End Set
    End Property
    

    Wednesday, August 29, 2012 9:38 PM
    Moderator
  • Thanks!

    One thing that is impossible is impossible no matter if it is proven so first.

    Wednesday, August 29, 2012 10:48 PM
    Answerer