corona


adding objects to screen in corona sdk without defining x y coordinates? corona sdk


A very simple beginners question... I assume this must be possible....
How do you add objects to a screen in Corona (take simple standard widget items like buttons) in a way that they just appear below each other and so avoid having to give each item a "top" value that is relative to the top of the screen? Surely there is a way of doing this either automatically or referencing the previous object to place the next objects position?
I thought grouping items may assist with this but hasn't with my experiments so far.
You can use variables and information about other objects to define positions of buttons. Let's say you have an object, button1. You want another object, button2, to be 20 pixels above it.
button1.y = 45
print(button1.y)--You'll get 45.
button2.y = button1.y - 20--Remember that the origin (0,0) is at the top left. Subtracting 20 makes the object closer to the top.
print(button2.y)--You'll get 25.
X, Y coordinates can be defined by a combination of variables with mathematical operations. You can greatly speed up your code by defining many objects relative to one central object.
button2.x=button1.x
button2.y=button1.y+20
....
button3.x=button2.x+20
button3.y=button2.y+20
You can design this way, in this way you can set the relative position of the buttons.
I hope it will help you.

Related Links

How to set Corona notification big view
Set object or button above the video in corona sdk
selectively upgrade existing sqlite database in corona by comparing database versions
Corona Near Field Comunication (NFR)
How can i make random generated quotes
Using perspective library with Corona SDK
What is the right way to zoom the camera out from a scene view?
Corona SDK Runtime Error on version 3.0.0
corona loadRemoteImage loading in another scene
What is a simple splash screen code for corona?
How to resize pickerwheel on corona sdk
How to allow external music/audio to continue in Corona SDK apps when they launch?
Can I put apps made on Corona SDK for windows on IOS?
Define coordinates with rotation (corona sdk)
Open 3rd party application in corona sdk
Corona SDK variable throughout different scenes

Categories

HOME
google-chrome
android-espresso
windows-8.1
yii
schema.org
long-integer
kivy
semantic-web
nsis
gallery
tibco
apache-kafka-connect
jint
share
fedora
save
roku
swarm
twitter-oauth
game-maker
buffer
jquery-file-upload
jpa-2.0
cloudsim
libgit2
weex
fluent-migrator
raima
plyr
fusion
amazon-iam
objectmapper
fotorama
rspec-rails
knights-tour
appcode
polyml
bean-validation
amazon-kms
landscape
testlink
identify
tidal-scheduler
linq.js
newtons-method
vungle-ads
dredd
webalizer
django-static-precompiler
head.js
hibernate-ogm
sequence-diagram
exc-bad-access
popen
hmmlearn
email-injection
mifos
ipywidgets
bigdecimal
mathjs
clp
nvda
fragmentstatepageradapter
static-methods
frame-grab
fdt
gwt-syncproxy
cortana
diawi
json-spirit
in-app-billing
cfwheels
dnx50
tree-structure
camus
mod-auth-openidc
mojo
thoughtworks-go
boolean-algebra
lync-2010
discovery
coalesce
google-code-prettify
proc-open
contextswitchdeadlock
ckeditor.net
pcspim
dropshadow
sigar
groovy-console
radscheduler
qt-mobility
hungarian-notation
bass
multiple-users
tessellation
principles
eventaggregator
activex-exe
levels
html-generation
rootkit

Resources

Database Users
RDBMS discuss
Database Dev&Adm
javascript
java
csharp
php
android
javascript
java
csharp
php
python
android
jquery
ruby
ios
html
Mobile App
Mobile App
Mobile App