< GambasJump to navigation Jump to search
- How do you set the text of header cells in a GridView (or TableView)?
- How do you get a list of selected cells in a GridView (or TableView)?
- The documentation for _GridView_Rows seems to be wrong -- it says there is a "Selection" property, but the compiler says there is no such thing.
- 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?)
- Is it possible to do continuous forms as in MS Access? It seems likely that it can be done with some coding...
- Is there any Gambas equivalent to the VB line-continuation syntax (space + underscore)?
- Is there a general language syntax tutorial or reference anywhere?
- 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.)
- Q: How do you call an overridden parent method (function/sub)?
- A: (tentative) Invoke it as Me.MethodName()
- 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
- 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.
- 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.
- 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", 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").