Difference between revisions of "Gambas"

from HTYP, the free directory anyone can edit if they can prove to me that they're not a spambot
Jump to navigation Jump to search
m (→‎Flaws: ok, sometimes it *does* show up... make a liar out of me...)
(→‎Flaws: more flaws; tried minor reformat on table)
Line 36: Line 36:
  
 
==Flaws==
 
==Flaws==
 +
* (Major but livable) Hovering over variables at runtime does not display their current value, as in VB
 +
* (Major but livable) Help is not context-sensitive
 +
* (Major but livable) There is no equivalent to the VB right-click "Go to definition" menu command
 +
* (Minor) SHIFT-TAB does not unindent
 
* (Minor) Although the syntax for accessing field data is nominally similar to VB's syntax, a variant which works under VB does not work in Gambas:
 
* (Minor) Although the syntax for accessing field data is nominally similar to VB's syntax, a variant which works under VB does not work in Gambas:
 
{|
 
{|
|-
 
! works in VB || required form in Gambas
 
 
|-
 
|-
 
| valign=top |
 
| valign=top |
 +
<center>'''works in VB'''</center>
 
  '''with''' objData
 
  '''with''' objData
 
     intID = !ID
 
     intID = !ID
Line 47: Line 50:
 
  '''end with'''
 
  '''end with'''
 
| valign=top |
 
| valign=top |
 +
<center>'''required form in Gambas'''</center>
 
  intID = objData!ID
 
  intID = objData!ID
 
  strName = objData!Name
 
  strName = objData!Name
 
|}
 
|}
 
* (Minor) Identifiers are not automatically capitalized to match their declaration, as in VB; fortunately, identifiers are not case-sensitive for compilation, so this doesn't make things ugly the way it does in C/C++. (The pop-up list of methods/properties/events ''sometimes'' won't show up, however, unless the object's name is properly capitalized.)
 
* (Minor) Identifiers are not automatically capitalized to match their declaration, as in VB; fortunately, identifiers are not case-sensitive for compilation, so this doesn't make things ugly the way it does in C/C++. (The pop-up list of methods/properties/events ''sometimes'' won't show up, however, unless the object's name is properly capitalized.)
* (Semi-minor) The field-list doesn't pop up under certain circumstances; checking into this.
 
* (significant) Help system is not context-sensitive; you have to type the term in manually and search for it. Similarly, there doesn't seem to be a way to go to an identifier's definition.
 
 
* The field-list popup isn't smart in certain circumstances:
 
* The field-list popup isn't smart in certain circumstances:
 
*# Type me.controlname.field (use a real control name and a real field name)
 
*# Type me.controlname.field (use a real control name and a real field name)

Revision as of 15:52, 16 November 2006

Computing: Software: Gambas

This is a growing seedling article. You can help HTYP by watering it.

Gambas is a programming language and IDE.

Overview

  • intended to fill the same niche as VB, though not intended to be code-compatible
  • currently only available for Linux and other Unix-derivatives (there is a partially-functioning Windows version)
  • open-source

Articles

Reference

resources

Stumbling Blocks

Unanswered

  • Q: How do you access kioslaves in code?
  • Q: Is it possible to do continuous forms as in MS Access? It seems likely that it can be done with some coding...
  • Q: Is there any equivalent to the line-continuation syntax (space + underscore) in VB?
  • Q: Is there a general language syntax tutorial or reference anywhere?

Solved

  • One of the more confusing aspects of Gambas (for a Visual Basic user, anyway) is that Gambas's events do not pass parameters; instead, you have to know where to fetch them from:
    • Form resize: the size is easily available as a form property ("ME.")
    • Mouse clicks: use the Mouse object
    • Key presses: use the Key object
    • Controls in a group: use the LAST keyword
      • The most obvious solution would have been for the event to pass the control as a parameter; Gambas events don't seem to use parameters. Another intuitive solution would have been for the group itself to appear on the form's list of controls/methods, as an alias for the currently active/effective control. Finally, if the form had an ActiveControl property, I could pull the .Tag value from there, although I would expect to run into problems using this technique under some circumstances. Answer: The LAST keyword refers to the control which generated the current event.
  • Another minor thing to remember is that calls to Gambas subroutines always put parentheses around the parameter list (VB subroutines do not, unless the subroutine is a function or property and the return value is being retrieved).
  • Q: How do you open a file-browsing dialog that uses KDE's kioslave feature? (DirChooser in gb.form lets you choose a local folder only.)
  • An "invalid assignment" error can be caused by an undeclared variable, e.g. "A = B" if A has not been declared.

Flaws

  • (Major but livable) Hovering over variables at runtime does not display their current value, as in VB
  • (Major but livable) Help is not context-sensitive
  • (Major but livable) There is no equivalent to the VB right-click "Go to definition" menu command
  • (Minor) SHIFT-TAB does not unindent
  • (Minor) Although the syntax for accessing field data is nominally similar to VB's syntax, a variant which works under VB does not work in Gambas:
works in VB
with objData
   intID = !ID
   strName = !Name
end with
required form in Gambas
intID = objData!ID
strName = objData!Name
  • (Minor) Identifiers are not automatically capitalized to match their declaration, as in VB; fortunately, identifiers are not case-sensitive for compilation, so this doesn't make things ugly the way it does in C/C++. (The pop-up list of methods/properties/events sometimes won't show up, however, unless the object's name is properly capitalized.)
  • The field-list popup isn't smart in certain circumstances:
    1. Type me.controlname.field (use a real control name and a real field name)
    2. Move cursor somewhere else
    3. go back to same line, and highlight the "." between "controlname" and "field"
    4. type "."
      • (minor) The list doesn't automatically select the field which was there already
      • (annoying) When you select the field you want, it is inserted between "." and the fieldname that was there before. This follows logically from the editing rules, but is not what we want to happen; the selected fieldname should replace the old fieldname.

Notes

  • The Help system appears to be wiki-based, possibly feeding directly off the Gambas wiki -- so any errors found can be corrected by anyone, in theory. Not sure how easy this is in practice. (Edit buttons do not appear in the Help app, so you would have to find the correct page on the wiki.)