diff --git a/app/src/gambas3/tips/tips.en b/app/src/gambas3/tips/tips.en index 013543e20..b22a8a195 100644 --- a/app/src/gambas3/tips/tips.en +++ b/app/src/gambas3/tips/tips.en @@ -12,7 +12,7 @@ remain on your own responsibility...

Enjoy it !

Benoît Minisini
-g4mba5@gmail.com




+g4mba5@gmail.com


[STARTUP] @@ -94,14 +94,14 @@ The executable name has the same name as your project.

Relative paths

Relative paths have a special meaning in Gambas. -They always refer to files inside your projects. +They always refer to files inside your projects.

There is no concept of current directory, and no keyword like -CHDIR to change it. +CHDIR to change it.

Be careful: you must use relative paths only for accessing project files, because absolute paths won't work anymore when -you make an executable. +you make an executable.

[GLOBAL] @@ -111,14 +111,14 @@ you make an executable. There is no global variables in Gambas!

As a workaround, put them in your main module and declare them -as Public. +as Public.

If you do not have a main module in your project, but a main -form, then declare them as Static Public. +form, then declare them as Static Public.

To access these variables, you must use the name of the main module or form: MyMainModule.MyGlobalVariable or -MyMainForm.MyGlobalVariable. +MyMainForm.MyGlobalVariable.

[EMPTY] @@ -146,7 +146,7 @@ If Not MyString THEN ...

Gambas applications are fully translatable, provided that you tell it which strings must be translated, and which one must not.

-

To mark strings as translatable, just enclose them between braces:

+

To mark strings as translatable, just enclose them between braces:

Print ("Translate me")
 Print "But do not translate me!"
@@ -247,7 +247,7 @@ disorientated :-).

You can embed any form into other forms with Gambas!

To do such a powerful thing, just instanciate the form by passing -a parent container as last argument of the contructor.

+a parent container as last argument of the constructor.

For example:

Dim hForm As MyDialog
@@ -323,7 +323,7 @@ of characters not to extract.

then gives the number of characters from the end of the string not to extract.

-

Mid$("Gambas", 2, -2) returns "amb" +

Mid$("Gambas", 2, -2) returns "amb"

[OBSERVER] @@ -344,21 +344,21 @@ Public Sub MyTextBox_KeyPress() Debug "Got it next" End
-The observer can cancel the event with Stop Event to prevent the object from effectively -raising it. +

The observer can cancel the event with Stop Event to prevent the object from effectively +raising it.

[STRING]

UTF-8 Strings

-

Gambas uses the UTF-8 charset to represent strings in memory. +

Gambas uses the UTF-8 charset to represent strings in memory.

But all standard string functions deal with ASCII only: -Left, Mid, Right, UCase... +Left, Mid, Right, UCase...

If you want to deal with UTF-8 strings, you have to use the methods of the -String static class, which have the same name as their standard counterparts. +String static class, which have the same name as their standard counterparts.

Print Len("bébé");; Left$("bébé", 3)
 → 6 bé
@@ -371,7 +371,7 @@ Print String.Len("bébé");; String.Left("bébé", 3)
 
 

Assignments

-

Gambas implements the assignment shortcuts that the C/C++ programmers are used to. +

Gambas implements the assignment shortcuts that the C/C++ programmers are used to.

MyVariable += 2
 MyVariable *= 4
@@ -381,7 +381,7 @@ is an equivalent of
 MyVariable = MyVariable * 4
 MyVariable = MyVariable & "Great"
-

And so on... +

And so on...

[DEBUG] @@ -390,14 +390,14 @@ MyVariable = MyVariable & "Great"

You can use the Debug instruction to print debugging messages to the console (namely the standard error output). It behaves exactly like the Print -instruction. +instruction.

These messages are prefixed with the class name, method name and line number of the Debug instruction. If you don't want that prefix, you can use the Error -instruction instead of Debug. +instruction instead of Debug.

The debugging messages are automatically removed when creating an executable -without debugging information. +without debugging information.

[TRY] @@ -405,10 +405,10 @@ without debugging information.

Error management (1)

Error management in Gambasis done with the following instructions: -Try, Error, Catch, and Finally. +Try, Error, Catch, and Finally.

Try tries to execute a statement without raising an error. The Error -keyword is used just after to know if the statement was executed correctly. +keyword is used just after to know if the statement was executed correctly.

Try MyFile = Open "/etc/password" For Write
 If Error Then Print "I cannot do what I want!"
@@ -419,15 +419,15 @@ If Error Then Print "I cannot do what I want!"

Error management (2)

Error management in Gambasis done with the following instructions: -Try, Error, Catch, and Finally. +Try, Error, Catch, and Finally.

Catch indicates the beginning of the error management part of a function or procedure. -It is put at the end of the function code. +It is put at the end of the function code.

The catch part is executed when an error is raised between the beginning of the function execution -and its end. +and its end.

-

If an error is raised during the execution of the catch part, it is normally propagated. +

If an error is raised during the execution of the catch part, it is normally propagated.

Sub ProcessFile(FileName As String)
   ...
@@ -447,14 +447,14 @@ End

Error management (3)

Error management in Gambasis done with the following instructions: -Try, Error, Catch, and Finally. +Try, Error, Catch, and Finally.

Finally introduces the code executed at the end of the function, even if an error was -raised during its execution. +raised during its execution.

-

The finally part is not mandatory. If there is a catch part in the function, the finally part must precede it. +

The finally part is not mandatory. If there is a catch part in the function, the finally part must precede it.

-

If an error is raised during the execution of the finally part, it is normally propagated. +

If an error is raised during the execution of the finally part, it is normally propagated.

Sub ProcessFile(FileName As String)
   ...
@@ -521,13 +521,13 @@ Next
in several predefined sizes ("small", "medium", "large",...) or absolute sizes (from 16x16 to 256x256).

-

For example: +

For example:

Image1.Picture = Picture["icon:/32/warning"]
 Image2.Picture = Picture["icon:/small/error"]
 
-

Warning: the gb.form component is required. +

Warning: the gb.form component is required.

[SETTINGS] @@ -535,12 +535,12 @@ Image2.Picture = Picture["icon:/small/error"]

Settings

If you need to store the configuration of your program (like the geometry of your forms), -then you are a lucky guy. It's very easy and elegant in Gambas. :-) +then you are a lucky guy. It's very easy and elegant in Gambas. :-)

-

To save the position of a form: +

To save the position of a form:

Settings.Write(TheForm)
-

To recall it: +

To recall it:

Settings.Read(TheForm)
To save any settings: @@ -552,7 +552,7 @@ And to read the settings back: These settings are stored in the ~/.config/gambas3/<MyApplication>.conf file, where <MyApplication> is the name of your project. -

Warning: The gb.settings component is required. +

Warning: The gb.settings component is required.

[EDITOR] @@ -569,12 +569,12 @@ where <MyApplication> is the name of your project.

How To Use Code Snippets

Let's type main then the TAB key. A static public Main -startup function is automatically inserted in your code. +startup function is automatically inserted in your code.

Let's type ds then the TAB key. A local string variable declaration is -automatically inserted, and you can type the variable name immediately. +automatically inserted, and you can type the variable name immediately.

-

Code snippets are entirely configurable from the Preferences dialog of IDE's Tools menu. +

Code snippets are entirely configurable from the Preferences dialog of IDE's Tools menu.

[END]