none
Multiple Grapgics Windows in Smallbasic RRS feed

  • General discussion

  • I recently found smallbasic and think its a great addition to anyones programming library! I have been a programmer since 1980 and this is what is needed , short and sweet and simple. Having Programmed in  quick basic and now the over bloated VB 2010 (not to mention everything inbetween )and spending a fortune for updates, This basic with just a couple of fixes would do  nicely,  Like multiple graphics windows or text windows. This goes to show you that that a language can be small and extremely powerful. And not just for kids

    This thread is to discuss multiple graphics and text windows, it should be very easy to add.

    Keep up the great work.

    Basicforever

     

     

    Wednesday, December 29, 2010 3:57 PM

All replies

  • Multiple windows is possible with the Fremy extension.  Example below:

    id = -1
    gw = 400
    gh = 400
    FCInstances.MainSub("start")

    Sub start
      id1 = FCInstances.Add("createWin","")
      id2 = FCInstances.Add("createWin","")
      FCInstances.SetVariable(id1,"id",1)
      FCInstances.SetVariable(id2,"id",2)
      FCInstances.CallSub(id1,"initWin")
      FCInstances.CallSub(id2,"initWin")
      While ("True")
        FCInstances.CallSub(id1,"draw")
        FCInstances.CallSub(id2,"draw")
        Program.Delay(100)
      EndWhile
    EndSub

    Sub createWin
      GraphicsWindow.Show()
    EndSub

    Sub initWin
      idMain = FCInstances.MainInstance
      gw = FCInstances.GetVariable(idMain,"gw")
      gh = FCInstances.GetVariable(idMain,"gh")
      GraphicsWindow.Width = gw
      GraphicsWindow.Height = gh
      GraphicsWindow.Top = 0
      If (id = 1) Then
        GraphicsWindow.BackgroundColor = "Red"
        GraphicsWindow.Left = 0
      ElseIf (id = 2) Then
        GraphicsWindow.BackgroundColor = "Blue"
        GraphicsWindow.Left = gw+20
      EndIf
    EndSub

    Sub draw
      x = GraphicsWindow.MouseX
      y = GraphicsWindow.MouseY
      GraphicsWindow.FillEllipse(x-25,y-25,50,50)
    EndSub




    Wednesday, December 29, 2010 6:54 PM
    Moderator
  • Thank you Litedev, That was a big help. BasicForever
    Wednesday, December 29, 2010 8:49 PM
  • The Fremy link you gave didn't work for me, so I'm not sure how that extension works.
    Wednesday, January 12, 2011 9:13 PM
  • Download the Fremy extension zip and put the contents in the SmallBasic lib folder.  This folder should be a subdirectory of the SmallBasic installation directory - you may have to create the lib if it doesn't exist (e.g. C:\Program Files (x86)\Microsoft\Small Basic\lib or C:\Program Files\Microsoft\Small Basic\lib).  You only need the FC.dll and FC.xml (for intellisense help) files.  Restart SmallBasic and type FC and you should see the extension commands pop up in the intellisense wheel.  Note this extension is only for SmallBasic v0.9 - the extension has to be recompiled for each SmallBasic release since it uses the SmallBasicLibrary.dll that changes with each release.
    Wednesday, January 12, 2011 9:21 PM
    Moderator
  • Where do I download this Fremy extension from?  I did find this: http://social.msdn.microsoft.com/Forums/en-US/smallbasic/thread/18d7be0b-b130-4d5f-ad12-d1f233e4b1f5 which if it's the same Fremy extension, will no longer be updated -- he says to just change your project into VB code then go from there.
    Wednesday, January 12, 2011 10:31 PM
  • In the link you mention, Fremy is talking about an extension compiler (something different that could be used to create extensions written in SmallBasic - he now suggests you write the extension in a .Net langage e.g. VB) that will not be maintained, I think his extension itself may be, it certainly is currently availble for v0.9.

    The link in the second post of this thread works for me - here it is again

    http://cid-201f3835d49587fe.office.live.com/self.aspx/Public/Small%20Basic/lib.zip

    Wednesday, January 12, 2011 10:39 PM
    Moderator