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
(→‎Solved: alternate meaning for "not an object")
 
(20 intermediate revisions by 4 users not shown)
Line 1: Line 1:
==Navigation==
+
<hide>
<section begin=navbar />{{#lst:programming languages|navbar}}: [[Gambas]]<section end=navbar />
+
[[page type::article]]
==Overview==
+
[[thing type::programming language]]
 +
[[thing type::integrated development environment]]
 +
[[category:software]]
 +
</hide>
 +
==About==
 
[[Gambas]] is a [[programming language]] and [[IDE (programming)|IDE]].
 
[[Gambas]] is a [[programming language]] and [[IDE (programming)|IDE]].
==Overview==
+
 
 +
It is:
 
* intended to fill the same niche as [[Visual Basic|VB]], though not intended to be code-compatible
 
* intended to fill the same niche as [[Visual Basic|VB]], though not intended to be code-compatible
 
* currently only available for [[Linux]] and other Unix-derivatives (there is a partially-functioning Windows version)
 
* currently only available for [[Linux]] and other Unix-derivatives (there is a partially-functioning Windows version)
 
* [[open-source]]
 
* [[open-source]]
==Articles==
+
==Pages==
* [[Gambas reference]]
+
* [[/authoring]] -- developing Gambas itself
==Reference==
+
* [[/flaws]]
 +
* [[/help browser]]
 +
* [[/questions]] answered and unanswered
 +
* [[/reference]]
 +
* error messages:
 +
** [[Not enough arguments]]
 +
 
 +
==How To==
 +
* '''Installation''':
 +
** [https://www.htlinux.com/install-gambas-3-5-via-ppa-in-ubuntu-linux/ Install Gambas 3.5 via PPA in Ubuntu & Linux]: how to install the latest version (which may not be available in your default repositories)
 +
* '''Develop with''':
 +
** '''Responding to right-clicks''': the standard Click event also responds to right-clicks
 +
** '''Showing a pop-up menu''': ''still looking into this...''
 +
** [[/nesting forms]]
 +
 
 +
==Links==
 +
===Official===
 
* [http://gambas.sourceforge.net/ Gambas homepage]
 
* [http://gambas.sourceforge.net/ Gambas homepage]
** [http://gambasdoc.org/help Gambas wiki] is apparently written ''in'' Gambas, but requires an account in order to edit, which in turn requires an email to the author.
+
** official documentation (on the [[/wiki|Gambas wiki]]): [http://gambasdoc.org/help/?v2 version 2]; [http://gambasdoc.org/help/?v3 version 3]
*** Gambas wiki now has a page history; not sure how it stacks up as a general-purpose [[wiki]]
+
===Reference===
*** Gambas wiki's search function uses [[Google]], rather than being an internal search feature
+
* {{wikipedia}}
* [[Wikipedia:Gambas|Wikipedia]]
+
* {{wikibooks}}
* [[wikibooks:Gambas|Wikibooks]]
+
===Projects===
* [http://www.laclavedefa.org/codigo_abierto/gambas_tutorial/ tutorials] (English, Spanish)
 
* [http://www.linuxbasic.net/ Linux Basic] forum: ostensibly for "the new breed of Basics coming out for the Linux operating system", but the focus seems to be mostly (or entirely) on Gambas
 
 
===resources===
 
===resources===
 
* [irc://irc.freenode.net/#gambas Gambas] IRC channel
 
* [irc://irc.freenode.net/#gambas Gambas] IRC channel
 
+
===Defunct===
==How To==
+
* <b>[http://howtogambas.org/index.php?page=cedi&type=misc&id=3 HowTo Gambas: Building GUI Applications]</s>
* '''Responding to right-clicks''': the standard Click event also responds to right-clicks
+
** defunct as of 2024
* '''Showing a pop-up menu''': ''still looking into this...''
+
* <s>[http://www.laclavedefa.org/codigo_abierto/gambas_tutorial/ tutorials]</s> (English, Spanish)
==Stumbling Blocks==
+
** defunct as of 2007; [https://web.archive.org/web/20061012095644/http://www.laclavedefa.org/codigo_abierto/gambas_tutorial/gambas_tutorial_en.html archive]
===Unanswered===
+
* <s>[http://www.linuxbasic.net/ Linux Basic]</s>
* '''Q''': How do you access files shared via [[Samba]]? (One way would be to make use of the smb [[kioslave]]; how is that done in Gambas?)
+
** seems to have gone defunct in late 2013; [http://web.archive.org/web/20130509005418/http://www.linuxbasic.net/ archive]
* '''Q''': Is it possible to do [[continuous forms]] as in [[MS Access]]? It seems likely that it can be done with some coding...
+
** was a forum: ostensibly for "the new breed of Basics coming out for the Linux operating system", but the focus seems to have been mostly (or entirely) on Gambas
* '''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?
 
* '''Q''': What do you do when an attempt to get Mouse information (e.g. Mouse.Right, to find out if the right button is being clicked) inside a Click event causes the error message "No mouse event data"? (The message box does not display an error number.)
 
 
 
===Solved===
 
* The "'''Not an object'''" error can mean that you tried to refer to a property as if it were a function, i.e. followed it with empty parentheses.
 
* Syntax for calling parameterless functions is deceptive. You can sometimes get away without using the parentheses, but other times you will get ''the function itself'' (presumably a pointer of some kind) as the return value instead of executing the funtion. When in doubt, always use parentheses.
 
** Where the function returns an object, '''function.method''' seems to be ok (as long as "method" is not also a function)
 
* 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 (Gambas)|Mouse object]]
 
** '''Key presses''': use the [[Key object (Gambas)|Key object]]
 
** '''Controls in a group''': use the [[LAST (Gambas)|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? ([http://gambasdoc.org/help/comp/gb.form/dirchooser DirChooser] in gb.form lets you choose a local folder only.)
 
** '''A''': [http://gambasdoc.org/help/comp/gb.qt.kde/dialog/selectdirectory Dialog.SelectDirectory] in [http://gambasdoc.org/help/comp/gb.qt.kde gb.qt.kde] provides this.
 
* An "invalid assignment" error can be caused by an undeclared variable, e.g. "A = B" if A has not been declared.
 
* Properties cannot accept additional arguments (other than the value being processed or retrieved). Workaround: instead of '''property Value''', have '''function GetValue''' and '''sub PutValue(iVal)'''. Not elegant, but functionally equivalent. Another option may be to have the passed data be a hash, but that is probably only efficient in certain rare circumstances; otherwise it involves extra coding to put the data in the hash and get it back out again.
 
* This may be a '''compiler bug''' or at least an undocumented feature: a class with no member variables seems to be automatically classified as "[[static class (Gambas)|static]]", and therefore cannot be used with the NEW operator. To get around the problem, declare a dummy member variable (e.g. "private strDummy as string").
 
 
 
==Flaws==
 
* (Major) Apparently there is no way to instantiate [[virtual classes within Gambas]]; a descendant class must be written using C++. This means that you cannot effectively use any component (or other class), such as ListView, which returns data using virtual classes, without writing C++ code. '''Update''': there is an INHERITS keyword which makes it sound like you actually can write a child class in Gambas; see [[inheritance (Gambas)|inheritance]] for ongoing documentation.
 
* (Major, may be a problem for debugging) No "view stack" window
 
* (Major but livable) Hovering over variables at runtime does not display their current value, as in [[Visual Basic|VB]], nor does there seem to be any other way of inspecting values at runtime other than inserting debug code to display values.
 
* (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
 
* (Annoying; bad for writing good code) Constants cannot be defined using other constants (e.g. A = "something" & B, where A and B are both constants)
 
* (Puzzling) The error "[http://gambasdoc.org/help/error/neparam Not enough arguments (#4)]":
 
** can appear at the point where a call to a subroutine has a problem ''inside the called subroutine'', rather than at the point highlighted. (Use "RETURN" within the called subroutine to isolate the problem line, as Gambas will not let you step inside a subroutine when this problem happens.)
 
** can be a sign of a property being called as a function
 
* (Minor) SHIFT-TAB does not reliably unindent (seems to work better when multiple rows are highlighted)
 
* (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:
 
{|
 
|-
 
| valign=top |
 
<center>'''works in VB'''</center>
 
'''with''' objData
 
    intID = !ID
 
    strName = !Name
 
'''end with'''
 
| valign=top |
 
<center>'''required form in Gambas'''</center>
 
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:
 
*# Type me.controlname.field (use a real control name and a real field name)
 
*# Move cursor somewhere else
 
*# go back to same line, and highlight the "." between "controlname" and "field"
 
*# 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==
 
==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, and get editing permission from the webmaster.)
 
* 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, and get editing permission from the webmaster.)

Latest revision as of 21:02, 15 June 2024

About

Gambas is a programming language and IDE.

It is:

  • 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

Pages

How To

  • Installation:
  • Develop with:
    • Responding to right-clicks: the standard Click event also responds to right-clicks
    • Showing a pop-up menu: still looking into this...
    • /nesting forms

Links

Official

Reference

Projects

resources

Defunct

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, and get editing permission from the webmaster.)