Buttons access like an array

Post your Gambas programming questions here.
User avatar
cogier
Site Admin
Posts: 1118
Joined: Wednesday 21st September 2016 2:22pm
Location: Guernsey, Channel Islands

Re: Buttons access like an array

Post by cogier »

To upload a file to this forum: -

In your File Manager locate your program folder, right click on it and select 'compress'. Save the file using 'tar.gz'.

Click on the 'Attachments' tab and click on 'Add files' button. Locate your compressed file and upload. Select 'display in line' and that's it.

I'll have a look at your program but it would be better if you could upload the whole program.

Image

When adding code to the forum use the 'gb' button rather than the '</>' button as it will make your code look much better: -

Using code: -

Code: Select all

Public Sub TextBoxEntry_KeyPress(Optional bTrigger As Boolean)


Using 'gb': -
Public Sub TextBoxEntry_KeyPress(Optional bTrigger As Boolean)
waspentalive
Posts: 10
Joined: Saturday 16th February 2019 5:55pm

Re: Buttons access like an array

Post by waspentalive »

Here is what I have so far.

This is licensed under GNU v3 - find the latest copy of the GNU Public License at https://www.gnu.org/licenses/gpl.html
Attachments
Tiles.tar.gz
Partially complete Tiles game
(21.34 KiB) Downloaded 388 times
User avatar
cogier
Site Admin
Posts: 1118
Joined: Wednesday 21st September 2016 2:22pm
Location: Guernsey, Channel Islands

Re: Buttons access like an array

Post by cogier »

I am not sure I fully understand the program but I have had a nice afternoon messing with the code. I apologise for my code layout, it's just that's how I like it. ;)

I have got the code down from 1170 lines to 275. I have added a logo. You can now resize the form and the font size will automatically resize. There is now a 'Edge Bonus' banner. When a matching pair is found you can now see the pair before they disappear. Note the use of 'Group' 'AllFieldButtons' for all the 'BtnField' buttons.

Things to watch for in your code: -
Only use 'Quit' in command line programs. In GUI programs use 'Me.Close' to close the form.
You can use 'Inc' (Increase) or 'Dec' (Decrease) to add or subtract 1 from a value.
So 'x = x + 1' can be just 'Inc x'
There is no need to 'Dim x as Integer' and then set it value to 0, it's 0 already. You can do this if you want: -
'Dim x as Integer = 15'

If I have missed the point with some part of the program please let me know or if you want an explanation of any of the code let me know.
Tiles2.tar.gz
(46 KiB) Downloaded 386 times
waspentalive
Posts: 10
Joined: Saturday 16th February 2019 5:55pm

Re: Buttons access like an array

Post by waspentalive »

I wanted to run it, but I seem to be missing a 'spring' - something special in your environment?
User avatar
cogier
Site Admin
Posts: 1118
Joined: Wednesday 21st September 2016 2:22pm
Location: Guernsey, Channel Islands

Re: Buttons access like an array

Post by cogier »

What version of Gambas are you using?

If it is earlier than 3.11.0 then you need to update. The 'Spring' feature was add in this version.

Close Gambas.
Copy the code below.

Code: Select all

sudo add-apt-repository -y ppa:gambas-team/gambas3 && sudo apt-get update && sudo apt-get -y install gambas3 
Open a Terminal on you computer.
Paste in the code by right clicking in Terminal and selecting Paste.
Press [Enter]
Enter your password and press [Enter] (You may not see anything happening when you type your password but if you input it correctly all will be fine).
Lots of text will be created.......
When the above is finished restart Gambas.

This will give you access to the Gambas repository and update your version of Gambas to 3.12.2. It will also keep you updated when there are further updates.
waspentalive
Posts: 10
Joined: Saturday 16th February 2019 5:55pm

Re: Buttons access like an array

Post by waspentalive »

I may have to distro hop away from Devuan, apearantly the current version (codename ascii) can't make use of that PPA.. Back to KDE Neon I suppose.

but not till my weekend (tues/wednesday)
User avatar
cogier
Site Admin
Posts: 1118
Joined: Wednesday 21st September 2016 2:22pm
Location: Guernsey, Channel Islands

Re: Buttons access like an array

Post by cogier »

OK I suggest Linux Mint 64bit with the Cinnamon desktop or Ubuntu 18.04 LTS or if you want KDE get Kubuntu 18.04.

However, here is the same code with no 'Springs'.
Tiles2.tar.gz
(46.02 KiB) Downloaded 381 times
Post Reply