Did you know?

Post your Gambas programming questions here.
User avatar
stevedee
Posts: 518
Joined: Monday 20th March 2017 6:06pm

Re: Did you know?

Post by stevedee »

In Form view:-
- If you select the width property of a control, the up/down arrows increase/reduce the width.
- If you select the height property of a control, the up/down arrows increase/reduce the height.
- If you select the X property of a control, the up/down arrows move the control right/left.
- If you select the Y property of a control, the up/down arrows move the control down/up.
User avatar
cogier
Site Admin
Posts: 1117
Joined: Wednesday 21st September 2016 2:22pm
Location: Guernsey, Channel Islands

Re: Did you know?

Post by cogier »

So it does. Interestng. I knew that using the mouse wheel had that effect.
User avatar
cogier
Site Admin
Posts: 1117
Joined: Wednesday 21st September 2016 2:22pm
Location: Guernsey, Channel Islands

Re: Did you know?

Post by cogier »

This does not work with the Cinnamon Desktop as the key stroke is reserved for showing all Virtual Desktops. In the Gambas IDE put the cursor on a line and press [Ctrl]+[Alt]+[Up Arrow]. This will move the whole line up and will jump over other lines. [Ctrl]+[Alt]+[Down Arrow] will move it down. This also works in Writer (for the whole paragraph).
User avatar
stevedee
Posts: 518
Joined: Monday 20th March 2017 6:06pm

Re: Did you know?

Post by stevedee »

Something I don't do very often is set the "tab" order for controls on a Gambas form. Consequently I struggle to remember how its done.

In Visual Basic it was straightforward, you just gave the "TabIndex" property a suitable integer value. If "TabStop" for a control was set to false, then that control would not respond to Tab.

In Gambas it is a little obscure; go to the Properties view, select Hierarchy and move items in the list via up/down arrows so they tab in the required order. The property "NoTabFocus" determines whether or not a control responds to Tab.
didier18
Posts: 38
Joined: Monday 19th December 2016 10:08pm

Re: Did you know?

Post by didier18 »

Hello

Very good idea this "Did you know?" section. initiated by cogier. Thank you.

So, did you know? It is possible to compare values, see which routine is called by which routine and optimize its code. To see the execution time of a command, a routine and even a complete program. This tool can be found in the menu /Debug/Activate profiling.
Once this menu is selected, launch the program to be tested as you would normally do... Then close your program. A window will open (as in the example) and you can view the profiling.
Even louder... It is possible to save the profiles, which allows you to compare the evolution with the different versions of your program.
But of course you already knew...

Have a nice day.
Attachments
capture26342.png
capture26342.png (149.91 KiB) Viewed 53536 times
User avatar
cogier
Site Admin
Posts: 1117
Joined: Wednesday 21st September 2016 2:22pm
Location: Guernsey, Channel Islands

Re: Did you know?

Post by cogier »

Did you know you can easily move a line, or multiple lines, of code up or down in the editor. Just place the cursor on the line, or highlight the lines, you want to move and press [Alt]+[Up Arrow] (or [Down Arrow]). 8-)
User avatar
jornmo
Site Admin
Posts: 224
Joined: Wednesday 21st September 2016 1:19pm
Location: Norway

Re: Did you know?

Post by jornmo »

I doo :lol:
User avatar
cogier
Site Admin
Posts: 1117
Joined: Wednesday 21st September 2016 2:22pm
Location: Guernsey, Channel Islands

Re: Did you know?

Post by cogier »

Here's one I didn't know:-
Dim siRand1, siRand2, siRand3, siRand4 As Short = Rand(0, 9)
This generates random numbers for each variable.

Try this: -
Public Sub Form_Open()
Dim siCount As Short

For siCount = 1 To 10
  Print Generate()
Next

End

Public Sub Generate() As String
Dim siRand1, siRand2, siRand3, siRand4 As Short = Rand(0, 9)

Return Str(siRand1) & Str(siRand2) & Str(siRand3) & Str(siRand4)

End
Result: -
8752
9344
1387
3623
2006
9061
9834
3499
8392
4388
User avatar
jornmo
Site Admin
Posts: 224
Joined: Wednesday 21st September 2016 1:19pm
Location: Norway

Re: Did you know?

Post by jornmo »

Remember to use this first:

http://gambaswiki.org/wiki/lang/randomize
User avatar
Quincunxian
Posts: 171
Joined: Sunday 25th June 2017 12:14am
Location: Western Australia

Re: Did you know?

Post by Quincunxian »

While in form design view, if you right click on any control in the bottom right hand corner...
ie a button control, it will open the help about that control.
Cheers - Quin.
I code therefore I am
Post Reply