github VBAndCs/sVB-Small-Visual-Basic v1.6
Small Visual Basic v1.6.5

latest releases: v2.8, v2.7, v2.6...
2 years ago

What's new?

  1. Some bug fixes in compiler and other tools.

  2. Make it easy to crate a new form and show it from code:

form2 = Forms.AddForm("form2")
form2.Text = "Form2"
newButton = Form2.AddButton(
      "Button 1"
      100,  ' left
      100,  ' Top
      400,  ' Width
      250   ' Height
)
newButton.Text = "Hello"
newButton.OnClick = Button1_OnClick
form2.Show()

This code can't run before sVB 1.6.5, because all controls were assumed to belong to Form1!. Now they belong to the forms that creates them using AddXXX methods (like AddButton, AddListBox... etc).
You can see an interesting example of this in the Random Buttons app in the Samples folder.

  1. Add OnShown event to the Form. It is fired after the content of the form is rendered. If you use it, you should add all initialization into it, as you can't know for sure if it will occur before or after the code in the global section is executed! But you can be sure that all the controls are rendered and ready for use.
    OnShown is the default event for the Form, and you can add a handler to it by just double-clicking the form surface in the form designer.

  2. I got rid of the side help panel to save space, and showed the help info in a tip window that pops up after 2 seconds from moving the caret to any word in the code editor, and stays open for 10 seconds unless you move to another position, move the scroll, or press Esc key. I prevent showing the help for the same word unless toy move to another one, but you can force to show the help by pressing F1.
    You can magnify the font of the popup help by pressing Ctrl and moving the mouse wheel. This is one of many functionalites built-in the WPF FlowDocument control that is used to show the help.
    You can say I brought the VS intellisense to sVB. The pop up help offers valuable info about the current code token, including:

  • The scope (local or global var).
  • The definition signature (Type, Property, Dynamic Property, Event, Method Parameters).
  • If the token is a variable, a sub or a function, it will be shown as a link, so, you can click it to go to its definition line. If the token it the name of the form or a control on it, clicking the link will select the form or the control on the form designer.
  • The documentation includes a summery, and info about parameters and return value. You can add a summery for user defined types by adding one or more comment lines above the var, sub, or function definitions. You can also add one more comment line at the end of the definition line. For subs and functions, you can add the additional summery line after the opining parans if you split the params over multi lines which also allows you to add a comment for each parameter to be used as a documentation. For Functions, the comment placed after the closing parans will be used as the documentation info for the return value. For subs, it will be considered an additional line of the summery. Ex:
XPos = 1   ' the horizontal position 

' adds x to the pos
Sub Move(
    x ' The increment value to add to the pos
)
   XPos = XPos + x
EndSub

Function InRange( ' Checks if the pos is withing the givin range
    start, ' the start position
    end  ' the end position
) ' True if the pos is in range, False otherwise.
   Return XPos >= start And XPos <= end
EndFunction

image

While typing the arguments of the method call, the popup help will highlight the current param with a red color, and show only the info about this param, so you can focus only on the task in hand.

image

  1. The editor formats the current sub after leaving a line that has changes. Formatting doesn't only include indentation, but also pretty listing of space between tokens, and fixing the casing of keywords, labels, type and method names. It also enforces using lower-case initial letters for local variables, and upper-case initial letters for global variables, labels, subs and functions.

  2. The editor highlights every occurrence of the current identifier (variable, sub, function, label, type, method) name. Similar to highlighted block keywords, you can navigate between highlighted identifiers by pressing F4 or Ctrl+Shift+Up or Ctrl+Shift+down

  3. Many enhancements to the completion list to make it smarter, such as :

  • Filtering completion names by partial words (for ex: typing name can select MyName)
  • Filtered out names don't appear in the list anymore.
  • The list remembers last selected object for each first letter.
  • The list remembers last selected method for each object.

The aim of this release is to make coding with sVB easier, educational and fun!

Don't miss a new sVB-Small-Visual-Basic release

NewReleases is sending notifications on new releases.