Phone app issues

Got a LiveCode personal license? Are you a beginner, hobbyist or educator that's new to LiveCode? This forum is the place to go for help getting started. Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller

Post Reply
Opaquer
Posts: 247
Joined: Wed Aug 14, 2013 8:24 am

Phone app issues

Post by Opaquer » Wed Aug 14, 2013 8:48 am

Hey everyone!

A little bit about the thing I'm working on first, then the issues.

I'm trying to make a phone app that has a list of leaders from around the country (since I'm with a youth group, it's handy for everyone to be able to contact everyone else!)

Coming from a VB background, I was able to make it months ago in VB, but most people in the youth group use macs, or have old computers (I'm just about the only one who has any sort of technical interest it seems :P!)

Anyway, I found out about LiveCode a few days ago, and it looks perfect for what I need, so decided to test it out. Unfortunately, I have a few issues

Firstly, I've read the article called "Displaying assets on differing screen resolutions" (can't make a link to it) about how to get things to show up on different sized screens etc, and got it working with their example. I then extended their example to tab menus, which worked perfectly fine.

Then I started using datagrids. I don't know if they just don't like me, or if they defy the laws of science, because that's where it started falling apart! I had this code:

set the width of group "FedLeaders" to the width of this stack
set the height of group "FedLeaders" to 0.8*the height of this stack-42
set the dgColumnWidth[1] of group "FedLeaders" to 0.27*the width of this stack
set the dgColumnWidth[2] of group "FedLeaders" to 0.325the width of this stack
set the dgColumnWidth[3] of group "FedLeaders" to 0.135*the width of this stack
set the dgColumnWidth[4] of group "FedLeaders" to 0.27*the width of this stack
set the loc of group "FedLeaders" to (the width of this stack/2),(the height of button "Tab2"/2+32)

Basically, what I want it to do is be as wide as the stack (which it's doing), but be located in the top 80% of the stack (the -42 I have in the second line is because I've got 2 tab menus that take up the top 21 pixels each, and if I just have 0.8*the height of this stack, the datagrid overlaps the tab menus :(. If you know how to fix this and make it dynamic, I would also appreciate that :D!). So far, so good. The next 4 rows are meant to change the width of the columns in the datagrid to 27%, 32.5%, 13.5% and 27% of the stack. The last row, for the location is meant to center it all and make it work. Sometimes it works, but sometimes it doesn't. For some reason, sometimes it makes 5 columns, with the last one being blank. The 4 columns it's meant to have aren't the right width, and it's not located right - sometimes it'll be a lot to the left, and sometimes a lot to the right. The width of the datagrid is always right though, but that's about it :(

Another question I have

When I'm making it on computer, size 14 font works well. But when I put it on my phone, it's quite small. Is there any way to increase the font size/spacing (like the -42 I have in the code above) etc etc so that it looks nice on phones, tablets, computer etc :D?

Thanks in advanced! Sorry if this is very basic, I just started and trying to get the hang of it :D

Simon
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 3901
Joined: Sat Mar 24, 2007 2:54 am

Re: Phone app issues

Post by Simon » Wed Aug 14, 2013 9:28 am

Hi Opaquer,
Welcome to the forum :)

For that -42 thing look up topLeft in the dictionary, you'll see all the others (topRight etc.) at the same time.
Oh and a tip, use parenthesis:
set the height of group "FedLeaders" to (0.8*the height of this stack)-42

For the columns I think you may be running into partial pixels:
set the dgColumnWidth[1] of group "FedLeaders" to 0.27*the width of this stack
Try:
set the dgColumnWidth[1] of group "FedLeaders" to round(0.27*the width of this stack)
Look up round and trunc in the dictionary.
Possibly for dgColumnWidth[4] you take up the "extra" pixels...
hmmm good homework.

Simon
I used to be a newbie but then I learned how to spell teh correctly and now I'm a noob!

Opaquer
Posts: 247
Joined: Wed Aug 14, 2013 8:24 am

Re: Phone app issues

Post by Opaquer » Wed Aug 14, 2013 10:39 am

Simon wrote:Hi Opaquer,
Welcome to the forum :)

For that -42 thing look up topLeft in the dictionary, you'll see all the others (topRight etc.) at the same time.
Oh and a tip, use parenthesis:
set the height of group "FedLeaders" to (0.8*the height of this stack)-42

For the columns I think you may be running into partial pixels:
set the dgColumnWidth[1] of group "FedLeaders" to 0.27*the width of this stack
Try:
set the dgColumnWidth[1] of group "FedLeaders" to round(0.27*the width of this stack)
Look up round and trunc in the dictionary.
Possibly for dgColumnWidth[4] you take up the "extra" pixels...
hmmm good homework.

Simon
Hi Simon!

Thanks for the welcome! Really enjoying the forums so far :D!

Also thanks for the tip! The rounding did it! Thinking about it now, it makes sense that the rounding would have caused an issue!

Do you have any ideas about the text size and whatnot by any chance :D?

Simon
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 3901
Joined: Sat Mar 24, 2007 2:54 am

Re: Phone app issues

Post by Simon » Wed Aug 14, 2013 10:58 am

For the whatnot I'd use an antiseptic.
For text size I think you may have to manually set it (really not sure):

Code: Select all

put the width of this stack into tWidth
switch
case tWidth <= 360
put 12 into tFontSize
break
case tWidth <= 1200
put 24 into tFontSize
break
default
put 16 into tFontSize
end switch
or something like that

Simon
I used to be a newbie but then I learned how to spell teh correctly and now I'm a noob!

Opaquer
Posts: 247
Joined: Wed Aug 14, 2013 8:24 am

Re: Phone app issues

Post by Opaquer » Wed Aug 14, 2013 11:06 am

Thanks Simon, I'll have to give it a try!

I guess with VB, there weren't really any times when people would need to have a specific font size depending on their machine, so I never really did anything or the sorts :P. Shame there's no easy way in LiveCode so that it scales it to the appropriate sizes :P. Would be handy :P

Post Reply