This is a read-only snapshot of the ComputerCraft forums, taken in April 2020.
mistamadd001's profile picture

buttons not aligning correctly

Started by mistamadd001, 03 June 2014 - 09:49 AM
mistamadd001 #1
Posted 03 June 2014 - 11:49 AM
Hi all,

FTB Ultimate pack (just FYI)

I am trying to create a GUI and button control system for a set of computers I have written programs for, as part of this I thought I would create a test program (so I didn't screw up my working programs) to teach myself how to make OOP style buttons.

After following the tutorials on here I have got to a point where I am getting some button looking items on my screen but not all of the ones I have created and not in the right spots.

I obviously changed (trimmed) what I need from the tutorial program and I fear I have omitted or incorrectly interpreted something that is creating my issue.

so without further ado, here is my code

As you can see I have created 5 button objects, balanceButton, depositButton, withdrawButton, transferButton, quitButton, (+1 for first person who correctly guesses my system(don't cheat and check my posts :P/> )), however I am only seeing 2 (transferButton and quitButton) and the transferButton is misaligned, I don't think the quitButton is in the wrong position though.

If someone could point out my failings I would really appreciate it.

Cheers,

MistaMadd001
Edited on 03 June 2014 - 09:54 AM
SquidDev #2
Posted 03 June 2014 - 12:08 PM
The button variable gets overridden every time. Change line 4 to: local button = {}.

You might also want to change line one to have a local declaration.For OOP style programming have you had a look at the Lua docs? Or SEE? They might give you an idea of a starting point.
Edited on 03 June 2014 - 10:11 AM
mistamadd001 #3
Posted 03 June 2014 - 12:31 PM
Thanks, I've used the Lua docs in the past but not for OOP, not used SEE though, I'll have a look over them, thanks.

Oh and btw, it works now so Thanks Again!!, now to write it into my existing programs.