Determine if device is a tablet

Richard Gaskin ambassador at fourthworld.com
Wed Aug 15 14:58:37 EDT 2018


J. Landman Gay wrote:

 > Metrics. I want to allow landcape orientation on tablets but only
 > portrait for phones.
 >
 > Phil suggested getting device info, but mobileBuildInfo doesn't return
 > anything better than "the machine." The server idea doesn't return
 > specific enough info either if it isn't an i-thing.
 >
 > Monte mentioned the screenrect, which is what I started with, but it's
 > a wild guess. Right now I'm using an arbitrary screen pixel width but
 > I don't think it will work everywhere.

Why not? The LC team has done a great job with resolution independence, 
using the OS routines to normalize coordinates for pixel density, so 
what we work with are logical pixels.

So Monte may be onto something: figure out how many pixels your layout 
needs, and check the screenRect. When you don't have the number of 
pixels your layout needs, limit rotation options.


 > I thought about using a ratio but I'm not sure what would be most
 > accurate. And I'm not clear on how different resolutions affect it.

Ratio tells us the relationship between width and height, independent of 
size.  I've seen 3x4, 9x16, 10x16 and others in both very small and very 
large devices.

-- 
  Richard Gaskin
  Fourth World Systems
  Software Design and Development for the Desktop, Mobile, and the Web
  ____________________________________________________________________
  Ambassador at FourthWorld.com                http://www.FourthWorld.com




More information about the use-livecode mailing list