locked
Bugs to Fix for Version 1.1 RRS feed

  • General discussion

  • Add any bugs, requests, problems with Version 1.0 here.

    Shapes.GetOpacity crashes.

    ball = Shapes.AddEllipse(50,50)
    Shapes.SetOpacity(ball,50)
    TextWindow.WriteLine(Shapes.GetOpacity(ball))

    Impossible math operations crash, perhaps an error message:

    a = Math.Log(-1)
    b = Math.ArcSin(2)
    c = Math.SquareRoot(-1) etc..

    Request:

    Find and Replace

     


    Friday, July 15, 2011 5:03 PM
    Moderator

All replies

  • The Return key doesn't register for the TextBox event.

    Controls.TextTyped = TT
    GraphicsWindow.DrawText(0,0,"Type a number from 1 ro 20")
    tbChoix = Controls.AddTextBox(0,20)
    Sub TT
     If Controls.LastTypedTextBox = tbChoix and Text.EndsWith(Controls.GetTextBoxText(tbChoix),Text.GetCharacter(13)) Then
      Sound.PlayClick()
     EndIf
    EndSub


    I would like an option to permit an automatic wordwrap in the multiline textbox

    I would like an editor which permits me to follow the program's evolution line by line

    I would like a printing function

    I would like an EOF function when reading a file line by line

    I would like a fast sorting function

    • Edited by Dick033 Sunday, August 7, 2011 6:26 PM
    Friday, July 15, 2011 7:38 PM
  • When I open Small Basic and leave it open for a bit, it crashes and says "Microsoft Small Basic has stopped working"
    ~~AirWaves!!~~
    Saturday, July 16, 2011 4:14 AM
  • All old highlighting bugs are still waiting for fix.

    For example

    Text = "Hello"
    TextWindow.WriteLine(Text)


    Sorry My Bad English
    Monday, July 18, 2011 2:12 PM
  • It is not a bug, it is a new request.

    Is it possible to add a new feature for the IDE?

    Add a color picker or color panel! Pick a color then the corresponding color name will be added to the editor area automatically.

    For example:

    GraphicsWindow.BackgroundColor = "BurlyWood"

    To type the correct color name is not easy for user and time consuming.


    =dtchang=
    Friday, July 22, 2011 1:56 PM
  • If you make a variable with an underscore as the first character like so:

    _variable1="value1"

    Then it does not appear in the intellisense. If you are making a big program with many variables I think this would be a good way to not over-clutter your intellisense wheel. I think that it does not appear in intellisense because of the alphabetical sorting. It recognizes letters A-Z, but not an underscore, though you can use it in variables.


    ~~AirWaves!!~~
    Friday, July 29, 2011 7:33 AM
  • Button captions are not updated as expected. Repeatable.

    In code below remove comment to get expected result. Debug via TextWindow shows that button caption is set correctly.

    LISTING:
    -------------------------------------------------------------------
    GraphicsWindow.Show()
    B=Controls.AddButton("BUTTON",100,100)
    Controls.ButtonClicked=OnButtonClick
    Sub OnButtonClick
        str=Controls.GetButtonCaption(B)
        Controls.SetButtonCaption(B,"*")
        'GraphicsWindow.ShowMessage("msg","msg")
        Program.Delay(1000)
        Controls.SetButtonCaption(B,str)
    EndSub
    -------------------------------------------------------------------

    Friday, August 19, 2011 11:53 PM
  • Could it be a bug with program.delay? Because I removed the last line of the subroutine "OnButtonClick", and it set the button caption to "*" after the 1000 millisecond delay. So the button did change the caption, but it just changed back. Because the program is paused and waits for the Message in the GraphicsWindow to show, it probably stopped the delay, causing the program to work properly?
    ~~AirWaves!!~~
    Saturday, August 20, 2011 8:11 AM
  • minuter,

    I think this is a consequence of the way events and Program.Delay are handled using threads in SmallBasic.  A thread is a synchronous part of the program effectively running at the same time as the main program.  They occur when an event is called because events happen at undefined times and while the the main program is running and can interact badly.  It is a bit complicated and an issue for all multi-threaded programming.  Consider what happens if the button is clicked multiple times while it is still processing the last event or uses the same variables that are being used in the main program etc.  The problems associated with thread conflicts can be unpredictable and very hard to debug.  There are some posts on this in the SmallBasic forum and you can google elsewhere for more information.

    The bottom line and best practice is to do as little as possible actual 'work' inside an event subroutine - specifically don't do anything that takes any real time like Program.Delay or complex movement.  You should just set simple variables (flags) that are then processed in the main program thread, perhaps using something called a message loop which just keeps waiting for the event flag status and does all the 'work' on the main program thread and is therefore thread stable. 

    It can be helpful also to clearly separate regions of the code that are for example INITIALISATION, MAIN PROGRAM, EVENT SUBROUTINES, OTHER SUBROUTINES etc.

    For example, here is your code as I would recommend using event subroutines.

    '============================================
    ' INITIALISATION
    '============================================
    
    GraphicsWindow.Show()
    B=Controls.AddButton("BUTTON",100,100)
    Controls.ButtonClicked=OnButtonClick
    clicked = 0 'Flag set when button is pressed
    
    '============================================
    ' MAIN PROGRAM
    '============================================
    
    While ("True") ' A message loop - infinite loop just running and processing the results of the flags set by events
     If (clicked = 1) Then 'Handle the button click
      str=Controls.GetButtonCaption(B)
      Controls.SetButtonCaption(B,"*")
      'GraphicsWindow.ShowMessage("msg","msg")
      Program.Delay(1000)
      Controls.SetButtonCaption(B,str)
      clicked = 0 'Revert the button status to unclicked
     EndIf
     Program.Delay(20) 'Short delay to prevent mashing cpu during repeating infinite loop
    EndWhile
    
    '============================================
    ' EVENT SUBROUTINES
    '============================================
    
    Sub OnButtonClick
     clicked = 1 'Just set a flag when the button is clicked
    EndSub


    Saturday, August 20, 2011 8:42 AM
    Moderator
  • Thanks, AirWaves, for the suggestion. I think it has to do with timing, but no fault of the Program.Delay. I simply assumed that the SetButonCaption will do two things synchronously: 1) to set the buton value and at the same time 2) update display with new button value. The sequence I understand is:

    1. Button is clicked.
    2. System makes button graphic go down and calls event handling routine.
    3. Event handler code calls Control.SetButonCaption to set button value.
    4. System updates internal button value (but not the displayed value on button graphic).
    5. Event handler ends.
    6. System makes button graphic go up.
    7. System updates displayed button value to the current internal value.

    Conclusion: it is not possible to _see_ button value updated while the button is in down state (i.e. when the event handler for the button clicked is still running), even though SetButonCaption was executed.

    I persist in my opinion , that systems like SB should update both (as I call them) the internal and the diplayed button values at the same time, simply because SetButonCaption was executed.



    Sunday, August 21, 2011 7:51 PM
  • litdev,

    I appreciate your suggestions. But for me the solution to simulate event handler within the code for the system which is by definition event driven is rather strange solution. Indeed your suggetions provides workaround for my particular problem, but introduces too much of a code complication. I would rather not have such feature in my code. I would not worry about local variables, as I can handle them myself. The same goes for argument passing to subroutines. The description says "In Small Basic all variables are global" and that is clear, I can then inmplement what I want as I want it done. Same with Event handlers or arguments. How long or how complicated event handler is should make no difference, and only burden me (until I discover that I need to implement critical sections or semaphores somehow or be aware that it is impossible).

    I take the liberty of including here my version of your suggestion. Nonetheless, I am grateful for your post to direct me onto the right path. The SB system, I read elswhere, is re-entrant, and the routine works but it is not the clean solution I would envisage proper even for such small system.

    '-------------------------------------------------------------------------------------
    GraphicsWindow.Show()
    B=Controls.AddButton("BUTTON",10,10)
    Controls.SetSize(B,200,100) 'easeier click
    Controls.ButtonClicked=OnButtonClick
    ClickNumber=0

     

    While ("True")
      If Stack.GetCount("dispatcher")>0 Then 'handle the button click
      Stack.PushValue("arg",Stack.PopValue("dispatcher")) 'pop as event , push as arg
     
    ClickExecute()
     
    Program.Delay(500) 'enough to see button value
      EndIf
    GraphicsWindow.Title="dispatcher stack size: "+Stack.GetCount("dispatcher")
    Program.Delay(20) 'Short delay to prevent mashing cpu during repeating infinite loop
    EndWhile
     

    Sub OnButtonClick
      ClickNumber=ClickNumber+1 'global click counter
      Stack.PushValue("dispatcher",ClickNumber)
    EndSub

    Sub

    ClickExecute 'argument on arg stack
     
    Stack.PushValue("stack",str) 'preserve global variable
     
    'begin true event handling routine
     
    str=Controls.GetButtonCaption(B) 'preserve found button value
     
    Controls.SetButtonCaption(B,"Handlign click "+Stack.PopValue("arg"))
     
    Program.Delay(2000) 'pretend it takes some time 
     
    Controls.SetButtonCaption(B,str) 'restore found button value
     
    'end true event handling routine
     
    str=Stack.PopValue("stack") 'restore global variable
    EndSub
    '-------------------------------------------------------------------------------------

     

    Sunday, August 21, 2011 8:11 PM
  • I agree that the current situation with events is not ideal, especially since SmallBasic is designed for beginners. 

    The approach I suggested is what I feel is the best practical approach/guidelines for beginners using SmallBasic as it is with events, who may struggle with the issues that you and others have raised, especially when they may not be sure of what implications global scope and multi-threading etc may have, let alone considering critical sections or other ideas.

    Having said that, the behavior inside these event subroutines is still not really as we would hope/expect as you show and my workaround is just a practical solution (if somewhat ugly and hard to explain/justify) - Perhaps the developers will put some brainpower into this at some point - there is something wrong here and rightly raised as a bug.

    Sunday, August 21, 2011 9:17 PM
    Moderator
  • Small Basic idle stops responding when publishing program and it can't connect to internet.

    Can be fixed with removing network functions from UI thread and adding them to new thread.

    [edit]

    Silverlight version of small basic has bug in right clicks. Here is demonstration.

    And the Program Details button doesn't work.


    Sorry My Bad English
    • Edited by Oskariok Monday, August 22, 2011 12:58 PM Silverlight bugs
    Monday, August 22, 2011 12:53 PM
  •  

    I would like: Shapes.MoveLine("NameOfLine", x1,y1,x2,y2). Removing and re-adding the line hurts performance and causes flickering.

    ---

    For some reason this program works on the desktop but not in the browser. Both the performance & rendering in the browser is broken.

    http://smallbasic.com/program/?DNX794

     

    Thursday, September 1, 2011 8:43 PM
  • Could use SLI compatiblity. Large amounts screen corruption and flicker on startup screen and text entry window. Seems to have no effect on program code or execution as all programs run perfectly. Also the overlay screen gets corrupted as well and the end process button doesnt completely remove the overlay. But I said you still can enter text in the text window fighting with the screen corruption and flicker yet run programs and output is fine.
    Monday, October 17, 2011 12:15 PM
  • The GetPixel command still doesn't work correctly in the following ways:

    1. It crashes Small Basic (and often Windows altogether) when getting a pixel outside of the graphics window.
    2. It does not work at all for shapes added with Shapes.AddXXX
    3. It does not see the white background of the graphics window... instead it returns #000000 when used against an untouched background.

     

    Wednesday, October 26, 2011 1:58 PM
  • @ wfredro

    1. This is a bug

    2. No, this is not a bug. There are two layers of the GraphicsWindow, the shapes and stuff that will go on the GraphicsWindow if you use GraphicsWindow.DrawXXX(). And the other layer is for the Shapes.AddXXX().

    3. This is a bug. Maybe Small Basic thinks White is #000000 not #FFFFFF


    ~~AirWaves!!~~
    Thursday, October 27, 2011 6:46 AM
  • @ wfredro

    1. This is a bug

    2. No, this is not a bug. There are two layers of the GraphicsWindow, the shapes and stuff that will go on the GraphicsWindow if you use GraphicsWindow.DrawXXX(). And the other layer is for the Shapes.AddXXX().

    3. This is a bug. Maybe Small Basic thinks White is #000000 not #FFFFFF


    ~~AirWaves!!~~

    Thanks for the feedback AirWaves

    Re #2: The GetPixel documentation says "Gets the color of the pixel at the specified x and y co-ordinates". It shouldn't matter what caused the pixel to become a certain colour, Small Basic should tell you its visible value. In other words, what your eye sees, GetPixel should return.

    It may be working as designed but in that case I think it is designed wrong and

    • The documentation should be fixed to describe how it really works
    • It should be renamed, since "GetPixel" implies that whatever the pixel is (as in the colour of my monitor at that coordinate), the function returns its value


    Edit: Re #3...

    If you get a pixel of a white shape, it returns FFFFFF as it should.

    • Edited by wfredro Wednesday, November 2, 2011 1:24 PM
    Thursday, October 27, 2011 1:37 PM
  • I have used literally dozens of high level languages professionally over the last 44 years. Additionally, I have implemented a couple of high level languages of my own in the past and while the numbers of users of my languages only reached a few hundreds, I still think my experience might count for something.

    Small Basic is the first language that I have seen that implements its arrays in this way. As soon as I saw people complaining about how slow arrays were, I decided to do some performance testing to see what I might determine. Here are some of the issues that I find with arrays as implemented in Small Basic:

    1. The use of square brackets instead of parens is odd but not a terrible problem. However, using a second set of square brackets to access a second index instead of a comma is a new one on me. I doubt there is a good reason why the usual syntax could not be used.

    2. When I started testing array access performance, I determined that the speed with which an array element is accessed during reading and during writing are dramatically different, especially when the number of values stored in an array gets large. On my Toshiba Satellite laptop with Windows 7 Home Premium (32-bit) any array element can be read in about 3.8 microseconds regardless of the number of elements currently stored in the array. However, for every thousand elements currently stored in an array the time required to write another element to the array or to simply write a new value into an existing element takes a staggering 1250 microseconds. Therefore, for example, if an array has 4000 values already stored in it, I find that it takes 5000 microseconds to write one value to it. Thankfully, each array exhibits these limitations independently. That is, having one array stored with thousands of values does not slow down the writing of elements in a different array which has only a few elements stored in it. The timing values mentioned about are approximate but are close to the real values.

    3. Since most of the time programs index into an array using numbers and not character strings, I have spent only a limited time studying the issues of using strings. However, I did determine that the index values into arrays are not reduced to integers before they are used to locate an element stored in the array. The entire value of the number is used and must match exactly in order for the array element to be addressed. For example, each of these refers to a different element of the X array:

      X[0.9999999999999999999999999]

      X[1]

      X[1.0000000000000000000000001]

     

    Bearing in mind that Small Basic is supposed to help kids learn about programming, it surely seems to me that this approach to implementing arrays will be sending them some mighty peculiar ideas of what to expect when writing computer programs.

    My suggestion is to move a bit closer to what has been done in the past as follows:

    a. Implement some form of a Dimension statement for arrays over a certain size. In the past, it has been common for the size to be 10 elements or 11 elements in a zero-based system. Since memory is so much more plentiful now, I would not be uncomfortable with the size being something like a 1000 elements. Then, only if one needs to use an array with index values exceeding 1000 would they need to use the Dimension statement. To help guide them on their way to learning that, the error message that complains about the program trying to access elements outside the array's size could tell them of the need for the Dimension statement.

    b. Take the Floor value of the numeric value of an array's index and use it to compute the location within a memory space allocated for the array. An alternate plan would be to Round the numeric value to the nearest integer instead of using the Floor value.

    c. Forget about using string values such as "Bob" as an array index value or provide a hashing algorithm with a hash-clash table to convert them to integers.

     

    If you want kids to embrace Small Basic you need to be sure it can perform fairly well in a real time sense. Kids want programs and games that react to them, not just with graphic elements but with data elements as well. They will want to compute values, store them, and move them around and sometimes they will want to do that with many thousands of values.

    I for one appreciate that Microsoft is addressing the need for an easy learn-to-program language. Throughout my career I have written countless programs in many languages. Many of them were for real time machine monitoring and control applications. Along the way, I have relied on the simple BASICs of Microsoft while developing algorithms. I look forward to Small Basic becoming one more tool in my tool box for doing so.


    • Edited by ebjoew Wednesday, November 9, 2011 6:18 AM
    Wednesday, November 9, 2011 6:16 AM
  •  The Network class does not work, even when connected to dialup Internet.

    Most File commands (except CreateDirectory, DeleteDirectory, DeleteFile) do not work.

    Flickr services do not work on dialup internet.

    GraphicsWindow.DrawImage and GraphicsWindow.DrawResizedImage do not work.

    Wednesday, November 16, 2011 1:28 PM
  • I'm with you, ebjoew!

    I implemented an interpreted language that used binary coded decimal simulating real numbers way back in the late 1960's.  Arrays were implemented as chained links with the element's index as the access key.  It was not bad for small or sparse arrays, but it was a dog for large arrays.  This was on an IBM 360 model 50.

    My experience is as you indicate.  DON'T DO IT!

    I believe the only access keys for arrays should be integers.

    I also believe that arrays should be declared before their use, with sequential memory to hold them set aside.

    And for heaven's sake, say NO! to the [..][..] syntax!  It is unnecesary and adds nothing to a beginner's understanding!

    The word "Basic" means KISS: Keep It Simple, Stupid!

     


    RussPC

    • Edited by RussPC Thursday, November 17, 2011 2:44 PM
    Wednesday, November 16, 2011 10:30 PM
  • This code should work:

    variable = "True"
    
    variable2 = "False" : "0" : "1"
    
    TextWindow.WriteLine(variable2)
    TextWindow.WriteLine(variable = "True" ? 1 : 0)
    

    Saturday, November 26, 2011 9:55 AM
  • Would it be possible to move Small Basic up to .NET 4.0?
    It would provide a little more flexibility when writing an extension (even if it is just for personal use).

    I was also wondering, why do all methods, primitives and classes have to be static in Small Basic? 

    Sunday, November 27, 2011 12:18 PM
  • .Net 4 would be a nice improvement - the only issue I can see is it requires at least XP SP3.

    I think the methods and data are static since since there is only one copy and cannot have multiple instances.  If they weren't static, then we would have to instantiate a class object and select which instance the method was to be run on.  You can use non-static classes referenced within the static method class as long as they are instantiated correctly (usually static).  Why would you want a non-static method?

    Sunday, November 27, 2011 8:45 PM
    Moderator
  • I was playing around writing an extension (nothing that was going to be released) and noticed that, when using a static class

     

    Process.Start("shutdown", "-r");
    


    Just doesn't work (It's a command used in batch, if you didn't know. It also seems to work in C#).
    I can't seem to remember why I was using it... 

    EDIT

    Please repost as a question to prevent cluttering the bugs thread - also post your C# test code if you want.  Many thanks (litdev).

    • Edited by litdevModerator Monday, November 28, 2011 6:53 PM Please repost
    Monday, November 28, 2011 5:43 PM
  • LMcSherry,

    I created a shutdown extension that worked fine for me - perhaps the problem is that either you named your test file shutdown or the same name as your extension command.  Either of these will fail.  Save your test SB file with a different name e.g. test-shutown.sb and delete any previous files called shutown or the extension command name in your saved folder.

    If you have further question or comments on this then post a new thread.

    EDIT

    System.Diagnostics.Process.Start("shutdown","-r"); worked fine in my test extension
    Monday, November 28, 2011 8:48 PM
    Moderator
  • If your C# code is

    System.Diagnostics.Process.Start("shutdown","-r");
    


    You should replace it with

    System.Diagnostics.Process.Start("shutdown.exe","-r");
    

    Tuesday, November 29, 2011 3:42 PM
  • My guess is the a Mouse Click Event Subroutine is called by the interrupt handler in the Run Time Ssystem.  As such, it is running as part of the RTS.

    This implies, as stated above, that an Event be treated as if it were a hardware interrupt.  In other words, do as little as necessary within the event handler.

    This happens all the time in certain types of programs.  The concept of fielding the event and posting a local signal, perhaps with data from the event, is easy to explain.

    For example, if there are several clickable areas on the graphics window, which are located based on their positions or other information, then an event handler such as:

    Sub OnMouseDown

      If MouseClicked = 0 then

        MouseX = GraphicsWindow.MouseX

        MouseY = GraphicsWIndow.MouseY

        MouseClicked = 1

      EndIf

    EndSub

    spends as little time within the over all event handler as possible, and avoids accidently getting ambiguous MouseX and MouseY pairs.  It will ignore mouse down events until MouseClicked is set to 0 in the program's own time stream.

    Confusing to beginners?  Could be, but IMO necessary in order to start inculcating good programming practice.  Also, I believe that a suggestion such as this be included in the SB documentation.

    The bottom line is that since SB is in reality an event driven environment, then beginners have to be made aware of it and shown how to cope.

     


    RussPC
    Tuesday, December 13, 2011 10:59 PM
  • Hi, litdev!

    I have found out thru experimentation that the background color for Buttons and Text Boxes is the user's current Window Background Color, and has nothing to do with what the programmer has control over.  I believe this is not reasonable, and talk about having to explain things to beginners, yikes!

    As I have said in other threads, I believe the color handling needs a lot of help.  It would be much better, IMO, if each object that worries about colors be provided with its own BackGround, Pen and Brush colors.  If not specified, then default to the current way of doing things (but please fix the use of ANY Windows Theme settings, AND provide an option to use them for everything, even in the development environment).  The latter part of the above is for visually challenged folks (and kids) like myself.

     

     


    RussPC
    Tuesday, December 13, 2011 11:08 PM
  • Hi RussPC,

    I have nothing to do with the SmallBasic development, I don't work for MS and am not affiliated with it in any way and have no more influence than anyone else on this forum.  I am just someone that thinks the project is worthwhile by encouraging new programmers.  I hope your request will be noted along with the others in this thread.

    Tuesday, December 13, 2011 11:42 PM
    Moderator
  • Funny.  I thought this was the place to post bugs and problems related to Small Basic.  At least that is what the top message states, and it is the one to which I replied.

    So, if this is NOT the place to post such items, then, pray tell, WHERE IS the proper venue?

     


    RussPC
    Wednesday, December 14, 2011 1:29 PM
  • This is the place to post bugs for MicroSoft SmallBasic, I was just commenting that directing them at me in particular has no effect.  Sorry for confusion.
    Wednesday, December 14, 2011 2:38 PM
    Moderator
  • Hi, litdev!

    I´m not an MS´s partner, be sure. I´m just a secondary Teacher, using MS tools cause my students will found this enviroment in his future careers and jobs.

    After tried "essay and error" with other languajes ( HTML, JavaScript, Action Script) I found Small basic that young people can understand and enjoy.

    If some of them, in the future will select other languaje, this programming concepts will be useful, I think.

    Otherwise, this forum is too useful for me, and people is very friendly ( and pacient)

    Thanks and best regards,


    Carlos Fernández Muriano
    Wednesday, December 14, 2011 6:01 PM
  • I´m working with S Basic 1.0

    I can´t find the site to download version 1.1

    Would you write the link ?

     

    Thanks


    Carlos Fernández Muriano
    Wednesday, December 14, 2011 8:34 PM
  • As far as I know version 1.0 is the most recent version - this thread was started to list bugs in version 1.0 to fix for the next release (v1.1).
    Wednesday, December 14, 2011 9:21 PM
    Moderator
  • The graphicswindow.clear() "deletes" the turtle
    “Computers are like Old Testament gods: lots of rules and no mercy.” – Joseph Campbell
    Thursday, December 15, 2011 10:47 AM
  • keg504, this is known problem that the Turtle is permanently deleted with all other shapes on GraphicsWindow.Clear().

    I added a method to an extension "ShapesExtension" to restore the turtle after it is lost as a stop-gap before SB is updated.

    The extension is here if you want it.

    Sample test code:

    Turtle.Show()
    Program.Delay(1000)
    GraphicsWindow.Clear()
    Program.Delay(1000)
    ShapesExtension.ResetTurtle()


    Thursday, December 15, 2011 1:31 PM
    Moderator
  • When you graduate a program that has an array with multiple dimensions the wizard ends up with (1)(1).  Then you have to go through and change to this:  (1,1).  So, why not either fix the wizard or better yet have small basic use the dimensons like visual basic does?


    Jricestk
    Friday, December 16, 2011 1:54 AM
    Answerer
  • The intellisense wheel doesn't show the TextWindow.ReadKey function.  It is shown in the textwindow dropdown list.  After typing the word textwindow and the . it doesn't show it in the wheel or the explanation on the right side. 
    Jricestk
    Monday, December 19, 2011 1:34 AM
    Answerer
  •  You´re right jricestk 
    The intellisense wheel doesn't show the TextWindow.ReadKey function.
    Only show (as can I see) Read and ReadNumber. I´ve typed textwindow.ReadKey complete and doesn´t show any function.
    And so ?

    Jricestk

    carlosfmur
    Monday, December 19, 2011 3:13 AM
  • 1)Array.GetValue and Array.SetValue  commands are not shown in intellisense wheel

      although tey are shown in right side sub command list.

      This problem occurs only on Japanese version? (I don't know English version)

    added )    Array.Removevalue

     

     

     

     

     



    Monday, December 19, 2011 3:18 AM
    Answerer
  • Keg504 & Litdev,

    Is GraphicsWindow.Clear() really considered as a bug for removing Shapes and Turtle from the graphics window as it does what it states?

    Wednesday, December 28, 2011 7:08 PM
  • Its only a bug in that the Turtle cannot be brought back at all after a GraphicsWindow.Clear() - there is a bug in the SB source that fails to inform the code that that the turtle has been removed when the clear is performed.
    Saturday, December 31, 2011 4:08 PM
    Moderator
  • This isn't a bug, but a suggestion.

    I noticed that SB copies all .dll files from the lib directory into a compiled program's directory, regardless if the program needs them all or not.

    I also think that the library .dll files ought to be in a standard location, such as one of the WIndows directories.  It seems like a waste to make a new copy of the .dll files for every program the user compiles.

    I'd also like to have some built-in print support.  I know the Data Extensions library has some printer support, but of a very limited nature.  I'd like to be able to print the GraphicsWindow, in particular, and to write it to a .JPG file as well.

     


    RussPC
    Wednesday, January 11, 2012 4:23 PM
  • Fn+Alt+PrtSc copies a bitmap of the current active window such as GraphicsWindow that you can paste in into Paint or Paint.Net to save, print etc - I guess some-one could write an extension for this fairly easily, but its quite easy to do manually and go can choose exactly when you want it without it being coded.
    Wednesday, January 11, 2012 6:35 PM
    Moderator
  • In contrast to your suggestion I am quite happy with things as they are now -  that the SB throws everythign it needs into one directory. I have just tried a "Hello World" type program, copied it to freshly installed  virtual PC sytem, and the program created with Small Basic just runs. Im my mind this approach makes the resulting program kind of "portable" (not trying to abuse the word "portable" here).

    So my suggestion would be: if SB development goes towards what you are suggesting, make it at least an option of being able to create programs that would run without any installation (except framework itself, of course), and "installable", by just copying even for non admin users.

    minuter

    Wednesday, January 11, 2012 9:05 PM
  • litdev,

    I really hate "magic" key combinations, particularly if they are not documentd in anything I've seen so far.  What in blazes is the "Fn" key?

    This is the second "magic trick" I've encountred in three days.  The first was for Google Chrome, where shift-alt-del opens a window that really deletes history junk, something which really ought to be part of the options settings. <SHRUG>

     


    RussPC
    Wednesday, January 11, 2012 10:14 PM
  • I find the code editor's font to be a bit funky.  Being visually impaired, the "J" and "I" sometimes are confusing to me in SB.  In comments (not sure about in code), the 0 and 1 are much smaller than the rest of the numbers.  Weird.

    What's wrong with plain ol' Sans Serif?  

     


    RussPC
    Wednesday, January 11, 2012 10:19 PM
  • The Fn key is a functions key (often blue typeface near bottom left of keyboard) - depending on keyboard (different international keyboards may vary) it is like a shift or control key to access built in windows functions such as change volume, toggle wireless, brightness etc on your keyboard - often the blue icons on some function keys at the top of the keyboard.  By all means don't use them, but they are there and sometimes very useful and much harder to do a screen dump without them.

    https://secure.wikimedia.org/wikipedia/en/wiki/Print_screen

    http://www.wikihow.com/Take-a-Screenshot-in-Microsoft-Windows

    http://www.noveltyhill.net/Handouts/Screen-Capture-in-Windows.html

    Wednesday, January 11, 2012 10:27 PM
    Moderator
  • Saturday, January 14, 2012 7:52 PM
  • Using this code I've noticed that the mouse.mousex and mouse.mousey give x & y coordinates relative to the top left of the screen, whereas using the coordinates for graphicswindow.drawline draws relative to the window.  Perhaps this is a bug with my computer?  You can confirm by moving the window to a different position and seeing the position of the box, relative to the mouse, change.

     

    gsw389


    Allen
    Sunday, January 15, 2012 8:56 AM
  • This is correct, try using GraphicsWindow.MouseX (relative to GW) rather than Mouse.MouseX (relative to screen).
    Sunday, January 15, 2012 11:51 AM
    Moderator
  • Ohhh, okay.  Thanks :)
    Allen
    Sunday, January 15, 2012 5:45 PM
  • I would like a function where you can customize what happens if you pass a command-line argument to the program, like -p, -s, etc.

    Also, there should be the ability to change the font of the GraphicsWindow.DrawText() text.

    Monday, March 26, 2012 1:01 PM
  • This is not a bug fix its a request. I would love to be able to have a Sub inside a sub if that's possible.!?.!?.!?

    Tuesday, March 27, 2012 1:27 AM
  • This is not a bug fix its a request. I would love to be able to have a Sub inside a sub if that's possible.!?.!?.!?

    i think its possible but i never tried

    one()

    Sub one

    two()

    i = j

    EndSub

    Sub two

    j = 1

    EndSub

    Experts please tell if i am doing something wrong?


    They say working hard is good but i say working smart is best...

    Wednesday, March 28, 2012 7:59 PM
  • Feature Request

    1- A built-in Drag-And-Drop Gui Builder

    2- More Built-in Controls (Slider, Progress Bar, Numerical UpDown, Radio & Check box etc)

    3- Multiple Source code file support


    They say working hard is good but i say working smart is best...

    Wednesday, March 28, 2012 8:14 PM
  • No problem calling subs from subs - in fact it is good practice to modularize code using subs for well defined specific tasks.  In general a program may have many layers of subs, SmallBasic also even allows recursion (a sub calling itself) - be careful with this since variables are global scope (the variables persist in each call) and the call stack is limited (a sub can only be called recursively a maximum number of times).

    Some examples (potential problems)

    'Stack overflow (too many subs called from subs - 1617 is still a lot though!)
    count = 0
    test()
    Sub test
      count = count + 1
      TextWindow.WriteLine("Call count = "+count)
      test()
    EndSub


    'Why only 10 numbers output? (Global Scope - use j instead of i in test2 to fix)
    test1()
    
    Sub test1
      For i = 1 To 10
        test2()
      EndFor
    EndSub
    
    Sub test2
      For i = 1 To 10
        TextWindow.WriteLine(i)
      EndFor
    EndSub


    Wednesday, March 28, 2012 10:38 PM
    Moderator
  • Found something with for loops, the variable will have an extra step added when the loop is finished.

    http://smallbasic.com/program/?PQJ983

    'A bug in the for loop??????
    TextWindow.Show()
    For i = 1 To 7 Step 2
      TextWindow.WriteLine(i)
    EndFor                                  'i = 7 here
    TextWindow.WriteLine("Why does it add another???")
    TextWindow.WriteLine(i)         'i = 9 here

    Monday, April 23, 2012 12:46 PM
  • I think this is entirely normal and what you would get with any other language, C++, VB etc.

    What happens is:

    On the first For, i is set to 1 and tested if it is <= 7, which it is:

    The loop contents is done.

    Then i is incremented, in this case by adding 2, i = 3

    We go back and test if i <= 7; it is so we loop

    Then again with i = 5 and i= 7 (i is still <= 7)

    After this loop i is again updated, this time to 9, and the test i <= 7 fails, so the loop ends and i is still 9.

    This is totally normal: after a for loop the iterator is equal to the first failed value for the loop.  Also true for a While loop.

    Monday, April 23, 2012 1:03 PM
    Moderator
  • Bug fix: Do you mind making the graduation between small basic and vb.net a little bit better. In the sence that the code in vb.net is correct.
    Monday, April 23, 2012 2:30 PM
  • Are there any good tutorials, all ready loaded visual basic express but it was a bit overwhelming when I looked at it before. I'll go check it out again, maybe I'll start to get it.
    Monday, April 23, 2012 11:42 PM
  • My mind trick for a For...EndFor loop block is: the Step increment occurs when it reaches EndFor, and the To verification when it goes up to the beginning again.

    The For...EndFor stops when the counter var (iterator) is greater than (>) what is comes after the To keyword. The opposite happens when Step is negative; that is, the loop breaks if counter var is less than (<) its To argument!

    That is the reason why the iterator > a To argument (or < To in the case of a negative Step) after a For...EndFor loop ends!

    Hope I was able to clear it out a little for ya!

    Tuesday, April 24, 2012 7:18 AM
    Answerer
  • I have used literally dozens of high level languages professionally over the last 44 years. Additionally, I have implemented a couple of high level languages of my own in the past and while the numbers of users of my languages only reached a few hundreds, I still think my experience might count for something.

    Small Basic is the first language that I have seen that implements its arrays in this way. As soon as I saw people complaining about how slow arrays were, I decided to do some performance testing to see what I might determine. Here are some of the issues that I find with arrays as implemented in Small Basic:

    1. The use of square brackets instead of parens is odd but not a terrible problem. However, using a second set of square brackets to access a second index instead of a comma is a new one on me. I doubt there is a good reason why the usual syntax could not be used.


    Just for the record, the languages I routinely code in use square bracket syntax for arrays: C, C++, C#, PHP, Java, Perl, Python, Javascript, Actionscript, JScript, etc. IMO a beginner has a high probability of transitioning to one, or more, of these languages if they take up development professionally.

    In fact, from the coding point of view, PHP implements arrays in pretty much the same fashion as Small Basic, although performance is a lot more optimised. Even that ghastly practice of using strings as keys turns out to be quite handy when manipulating database key/value pairs, etc... ;)

    But, I agree with your general point that it would be beneficial to give a significant performance tweak to arrays in Small Basic.

    Hmm, I've been having play with building extensions for Small Basic, maybe I'll code a performance array extension for a little "fun" project.

    Thursday, May 3, 2012 3:34 AM
  • Hmm, I've been having play with building extensions for Small Basic, maybe I'll code a performance array extension for a little "fun" project.

    As a quick experiment I just built an extension with a simple class that lets you create, and access, as many single-dimension arrays, of any size, as resources will allow.

    On a lowly Pentium 4 test box it adds a million unique strings to an array, in a For loop, at a rate of 7 microseconds (0.000007 seconds) per string.

    There may be some potential in this project... :)

    Thursday, May 3, 2012 5:41 AM
  • FontSize returns 12 before and after the addition but the text is actually larger:

    GraphicsWindow.DrawText(10,10,GraphicsWindow.FontSize)
    GraphicsWindow.FontSize = GraphicsWindow.FontSize + 20
    GraphicsWindow.DrawText(10,50,GraphicsWindow.FontSize)

    Monday, May 14, 2012 1:26 PM
  •    Hello Karl
    I tried this and it works great
    thank you very much

    carlosfmur - Buenos Aires

    Monday, May 14, 2012 8:12 PM
  • I would like for the Network class to be able to use network sockets,

    and if possible , Multi=Threading. So in your code you can run multiple subs at once. 

    And it would be nice if you could plave Subs Anywhere in the code.

    Kind Regards, 
    Sander Kastelein

    Monday, May 14, 2012 8:22 PM
  • Sammie,

    Multi-threading can be complex and hard to debug.  Actually there is a feature/bug in SmallBasic that does allow multi-threading by using the timer (which is called on new threads).  It does however require understanding of threading and will cause crashes and errors if used wrongly.

    Subs can be placed anywhere, but for clarity I would always put them AFTER you main program.

    Sunday, May 27, 2012 10:46 AM
    Moderator
  • Well maybe im just bad at explaining.

    maybe this code will explain it: JQT764

    Regards.

    Sunday, May 27, 2012 1:17 PM
  • Sammie,

    You are right in this case - the reason is not exactly that subroutines cannot be placed anywhere, but that the code that checks if variables are initialized before being used is being a bit too aggressive.  For example if I add sub1 = "" at the start it works.

    So you are right that this is a bug - however the problem is not mainly about subroutine location, but the way the uninitialized variable check is run during compilation.

    sub1 = ""
    sub sub1
      TextWindow.WriteLine("Hello Litdev")
    EndSub

    GraphicsWindow.Show()
    GraphicsWindow.MouseDown = sub1
    Sunday, May 27, 2012 1:50 PM
    Moderator
  • The context-sensitive help menu changes to the first item of the submenu when I type the "." I'd like to see what options are available after I type the "."
    Sunday, June 3, 2012 11:10 AM
  • Small Basic not starting -

    • Installation looks OK (same problem using local installation directory or a copy of installation directory from working PC)
    • SB compiled exe runs OK (assume therfore .Net is OK)
    • SB interface fails to start (even when run as administrator).

    See thread here:

    http://social.msdn.microsoft.com/Forums/en-US/smallbasic/thread/69607e15-a3de-48b7-9970-f98e2ca33837

    Tuesday, June 19, 2012 9:52 AM
    Moderator
  •   Hello litdev
    I have installed Small Basic version 1.0 and available
    extensions
    What is the
    Version 1.1 ?
     Thanks

    carlosfmur - Buenos Aires

    Tuesday, June 19, 2012 11:27 AM
  • Perhaps it is misnamed - it means bugs in version 1.0 (current) to be fixed in the next version (presumably 1.1).
    Tuesday, June 19, 2012 12:42 PM
    Moderator
  •   ah ah, Ok

    Many thanks litdev


    carlosfmur - Buenos Aires

    Tuesday, June 19, 2012 3:43 PM
  • Kind of a bug and a request at the same time :

    You know when you are using extensions in the lib folder.

    I would like Small Basic to compile only the used extensions with the .exe please, because it justs compiles every extension on the lib folder, even the ones who aren't used in the code.

    Monday, June 25, 2012 10:50 AM
  • Following program occurs error "5,28: The variable 'OnMouseDown' is used, but its value is not assigned.  Are you sure you have spelled it correctly?".

    Event defined above is not searched.

    Sub OnMouseDown
      Sound.PlayClick()
    EndSub
    
    GraphicsWindow.MouseDown = OnMouseDown
    This issue is already talked by summie and litdev.



    Nonki Takahashi


    Tuesday, June 26, 2012 12:32 AM
    Moderator
  • 1)Array.GetValue and Array.SetValue  commands are not shown in intellisense wheel

      although tey are shown in right side sub command list.

      This problem occurs only on Japanese version? (I don't know English version)

    added )    Array.Removevalue

      



    I confirmed that there are no helps for following methods even in English version.

    Array.SetValue(arry, index, value)
    value = Array.GetValue(arry, index)
    Array.RemoveValue(arry, index)

    P.S.  There are alternative way to do that as below:

    arry[index] = value
    value = arry[index]
    arry[index] = ""


    Nonki Takahashi



    Thursday, June 28, 2012 2:31 AM
    Moderator
  • These Array commands (GetValue and SetValue) were present before the [] syntax was introduced.  Due to the [] notation removing the requirement for the GetValue and SetValue methods they were removed from the intellisense to dissuade new users from using them instead of [].  However for backwards compatibility with older programns using these commands, they still remain usable.

    I think this is the reasoning and history of it.

    To remove a value completely from an array, do myArryay[index] = ""  This will completely remove it, e.g. it wont appear in Array.GetItemCount etc.

    Thursday, June 28, 2012 11:01 AM
    Moderator
  • litdev,

    Thank you for your information.  I understood why these methods exist.


    Nonki Takahashi

    Friday, June 29, 2012 12:43 AM
    Moderator
  • This program makes a star.

     But if you remove  '  before graphicswindow.hide , different result is obtained.

    3 triangles are rotated around X=100 Y=100 .    

    If graphicswindow.hide is executed first, shape's centering won't be done correctly?   Is it bug?

     'GraphicsWindow.Hide()
      GraphicsWindow.BrushColor="red"
      GraphicsWindow.PenColor="Red"
      For j=1 To 3
          a[J]= Shapes.AddTriangle(0,0,44,29,87,0)
          Shapes.animate(a[j],100,100,2000)
      EndFor
      Shapes.Rotate(a[2],-360/5)
      Shapes.Rotate(a[3],360/5)
      GraphicsWindow.Show()


    Note: I noticed this problem when I am making a  National flag display program.

    Saturday, July 7, 2012 5:01 AM
    Answerer
  • Got the "bug" fixed by just placing GraphicsWindow.Hide() 1 line below!

    Perhaps we gotta do some operation/method on the GraphicsWindow class/object before using GraphicsWindow.Hide()!

    Anything will do, even a simple GraphicsWindow.BrushColor="Red"!

    GraphicsWindow.BrushColor="Red"
    
    GraphicsWindow.Hide()
    
    GraphicsWindow.PenColor="Red"
    
    For j = 1 To 3
      a[j] = Shapes.AddTriangle(0,0  44,29  87,0)
      Shapes.Animate(a[j]  300,200  4000)
    EndFor
    
    Shapes.Rotate(a[2], -360/5)
    Shapes.Rotate(a[3],  360/5)
    
    GraphicsWindow.Show()


    Click on "Propose As Answer" if some post solves your problem or "Vote As Helpful" if some post has been useful to you! (^_^)

    Saturday, July 7, 2012 12:56 PM
    Answerer
  • Interesting result.

    But some graphicswindow commands(below) make same problem.   

     graphicswindow.fontsize   .fontbold    .fontitalic    .mousey     .mousex     .lasttext

     .lastkey    .GetRandomColor()     .GetColorFromRGB(,,)   

    Other commands  OK.  

    Sunday, July 8, 2012 2:28 AM
    Answerer