Page 4 of 10

Re: Did you know?

Posted: Friday 15th March 2019 3:23am
by Got2BeFree
Did you know...
While in form view, you can right-click-drag (just like selecting text to copy) and select the objects?

Re: Did you know?

Posted: Friday 15th March 2019 11:01pm
by Cedron
That there is a destructor function for Gambas objects called _free?
'========================================================'
Public Sub _new()

        Randomize

End
'========================================================'
Public Sub _free()

        Print "I'm Free"

End
'========================================================'
There are others as well.

From gambas.h, line 1193:

Code: Select all

  Special methods that can be declared in a class
  -----------------------------------------------

  _get        array reading operator
  _put        array writing operator
  _new        constructor
  _free       destructor
  _next       next iteration of an enumeration
  _call       called when the object or the class is used as a function
  _unknown    called when the name of the property or method is unknown
Just found the documentation link:

http://gambaswiki.org/wiki/cat/special

Re: Did you know?

Posted: Saturday 16th March 2019 2:05pm
by Cedron
DYK that Gambas allows top and bottom testing in the same loop?
        Dim i, j As Integer
        
        i = 10
        
        Do While i > 8
           j = i * i 
           Print i, j
           Dec i
        Loop Until j < 50
Awesome!

Change the 8 to 4, run it again.

Re: Did you know?

Posted: Saturday 30th March 2019 5:38pm
by cogier
Did you know that while in the Gambas IDE and editing your code, holding the shift key down and pressing 'Del' will delete the whole line?

Re: Did you know?

Posted: Monday 22nd April 2019 8:44pm
by Cedron
DYK that you can comment an entire block of lines by

1) Highlighting them

2) Either press the [Ctrl-k] keys or click on the tiny button with an apostrophe on it above the text editing area.

To uncomment the lines, highlight, then press either [Ctrl-u] or click on the tiny button with an apostrophe and a tiny red x.

That's darn handy.

Re: Did you know?

Posted: Monday 22nd April 2019 8:46pm
by Cedron
DYK that Gambas also provides for initialization and termination routines at the class level, similar to the _new() and _free() calls for instances.
'=============================================================================
Static Public Sub _init()
 
' Print "GamePad._init"

' Print Application.Path
' Print Application.Dir
' Print Application.Title
' Print Application.Name
        
End
'=============================================================================
Static Public Sub _exit()

'        Message.Info("GamePad._exit")
    
End
'=============================================================================

Re: Did you know?

Posted: Sunday 25th August 2019 12:30pm
by cogier
If you want only the data loaded from a file and Split into an array then try this: -
Dim sData As String[] = Split(File.Load(Application.path &/ "data"), gb.NewLine, "", True)
Image

Click here for a larger picture
The dialogue box on the left is the file and on the right is the array.

Check out the IgnoreVoid command here

Re: Did you know?

Posted: Sunday 25th August 2019 5:48pm
by Technopeasant
This should be really helpful for a project of mine. Thanks.

Re: Did you know?

Posted: Tuesday 1st October 2019 9:52am
by stevedee
Just to say that the excellent Gambas Buch programming book listed on the Gambas One resource page is also available in English:-
https://gambas-buch.de/dwen/doku.php?id=start

Re: Did you know?

Posted: Sunday 27th October 2019 3:27pm
by sjsepan
(moved here from General)
Haven't seen this mentioned here, although the Help wiki confirms it. It may initially surprise folks coming from VB that Sub / Function / Procedure 'are synonymous'.
Its not a problem; it just means that when you use Sub or Function your are merely following a naming convention. :o

That means this works:
' Gambas module file

Public Sub Main()

    Print Procedure1("Hello world")
    Print Procedure2("Hello world")
    Procedure3("Hello world")
    Print Procedure4("Hello world")
    Procedure5("Hello world")

End

Private Function Procedure1(val As String) As String

    Return String.Upper(val)

End

Private Sub Procedure2(val As String) As String

    Return String.Upper(val)

End

Private Function Procedure3(val As String)

    Print String.Upper(val)

End

Private Procedure Procedure4(val As String) As String

    Return String.Upper(val)

End

Private Procedure Procedure5(val As String)

    Print String.Upper(val)

End