I must have typed 'Open_Form' quite a few times to complete the 'Public Sub Form_Open()', then I discovered that this can be automatically created by double clicking the Form.
I suspect you all knew this but I thought I would share this anyway.
Did you know?
Re: Did you know?
There is more of that:
For example, just try double clicking a button on a form.
You'll be in the code editor of that forms class at the Public Sub Button_Click() event with the cursor positioned ready to code.
I use it all the time...
OR
On a form or any control right-click and go to menu item 'events', and click the event you want to code.
Code editor will open the forms class and your event is declared and cursor positioned ready to code.
The Gambas IDE really is one of the best IDE's I have ever used and I'm sure I haven't discovered all of its features![Wink ;)](./images/smilies/icon_e_wink.gif)
For example, just try double clicking a button on a form.
You'll be in the code editor of that forms class at the Public Sub Button_Click() event with the cursor positioned ready to code.
I use it all the time...
OR
On a form or any control right-click and go to menu item 'events', and click the event you want to code.
Code editor will open the forms class and your event is declared and cursor positioned ready to code.
The Gambas IDE really is one of the best IDE's I have ever used and I'm sure I haven't discovered all of its features
![Wink ;)](./images/smilies/icon_e_wink.gif)
gbWilly
- Dutch translation for Gambas3
- Gambas wiki content contributer
... there is always a Catch if things go wrong!
- Dutch translation for Gambas3
- Gambas wiki content contributer
... there is always a Catch if things go wrong!
Re: Did you know?
I did ![Smile :)](./images/smilies/icon_e_smile.gif)
Have you tried typing ps+ tab? Or v + tab? Or _n +tab?
![Smile :)](./images/smilies/icon_e_smile.gif)
Have you tried typing ps+ tab? Or v + tab? Or _n +tab?
- cogier
- Site Admin
- Posts: 1118
- Joined: Wednesday 21st September 2016 2:22pm
- Location: Guernsey, Channel Islands
Re: Did you know?
I knew most of these but for variables I use: -
ds [Tab]
df [Tab]
di [Tab]
[Ctrl] + [Alt] + [Enter] from here http://gambas.8142.n7.nabble.com/Questi ... 58228.html is also interesting.
When do you use '_n'?
ds [Tab]
df [Tab]
di [Tab]
[Ctrl] + [Alt] + [Enter] from here http://gambas.8142.n7.nabble.com/Questi ... 58228.html is also interesting.
When do you use '_n'?
Re: Did you know?
_n is the equivalent of a constructor in other languages. It sort of initialises an object when it is created, i.e. it is called each time you use the NEW keyword.
- cogier
- Site Admin
- Posts: 1118
- Joined: Wednesday 21st September 2016 2:22pm
- Location: Guernsey, Channel Islands
Re: Did you know?
Can you give me an example of a 'Constructor' as the information out there is way beyond me!
Re: Did you know?
How is your understanding of object oriented programming?
A class file in Gambas represents the blue print of an object, while a module file represents a static class.
When you've made a class in Gambas, you can create objects from it with
Inside the class file, you can use special methods, amongst:
The code inside this block is executed each time a new object is created. If the class is a graphical control, it would make sense to set the default size, colors and the like in this block.
A class file in Gambas represents the blue print of an object, while a module file represents a static class.
When you've made a class in Gambas, you can create objects from it with
Code: Select all
Private $myObject = New MyClass As "EventName"
Code: Select all
Public Sub _new()
...
End
- cogier
- Site Admin
- Posts: 1118
- Joined: Wednesday 21st September 2016 2:22pm
- Location: Guernsey, Channel Islands
Re: Did you know?
I have discovered another short cut I didn't know about.
If you hold down the [Ctrl] key and click on a Gambas reserved word (e.g. Public, New, For, etc) the relevant help page is displayed.
But you all knew that didn't you?
If you hold down the [Ctrl] key and click on a Gambas reserved word (e.g. Public, New, For, etc) the relevant help page is displayed.
But you all knew that didn't you?
Re: Did you know?
I might have tried it a long time ago since it is the same in Lazarus, but I prefer F2. F2 does the same thing - shows help on Gambas stuff, and takes you to the declaration on other stuff ![Smile :)](./images/smilies/icon_e_smile.gif)
![Smile :)](./images/smilies/icon_e_smile.gif)
- cogier
- Site Admin
- Posts: 1118
- Joined: Wednesday 21st September 2016 2:22pm
- Location: Guernsey, Channel Islands
Re: Did you know?
I have found another little gem I thought I would pass on (even though you know it already!)
Open preferences [Ctrl]+[Alt]+P and switch on Local variable automatic declaration then in your empty 'Sub' type iCount = 6 and hey presto a Dim iCount as Integer automatically appears!
Open preferences [Ctrl]+[Alt]+P and switch on Local variable automatic declaration then in your empty 'Sub' type iCount = 6 and hey presto a Dim iCount as Integer automatically appears!