Login ProductsSalesSupportDownloadsAbout |
Home » Technical Support » Elevate Web Builder Technical Support » Support Forums » Elevate Web Builder General » View Thread |
Messages 1 to 2 of 2 total |
How to know where you are |
Mon, Aug 25 2014 5:00 PM | Permanent Link |
Sergei Safar | Hi,
which is the best way to know if we are under a PC, Smartphone or Tablet / Ipad ? I need to resize my app depending on the screen size available. Best regards, Sergei Safar |
Tue, Aug 26 2014 3:43 AM | Permanent Link |
Matthew Jones | Sergei Safar wrote:
> which is the best way to know if we are under a PC, Smartphone or > Tablet / Ipad ? I need to resize my app depending on the screen size > available. In your main FormCreate, add: Application.Desktop.OnResize := DesktopResized; procedure TfrmMain.DesktopResized(Sender : TObject); var nWidth : Integer; nHeight : Integer; nMoveLeft : Integer; begin try nWidth := Application.Desktop.Width; nHeight := Application.Desktop.Height; if Width > nWidth then begin ..... Also, add the standard event handler for form resize: procedure TfrmJoin.frmJoinResize(Sender: TObject); begin DesktopResized(nil); end; You can then determine if you are in portrait or landscape, and move things according to the size. For one application I appear to have this on a timer, so the resize starts the timer, and then the timer does the movement. That may have been some quirk of rotation on a particular tablet. A fallback option if you find an issue. Finally, you can check particular aspects of things using the user agent string. Print out the string to find details for a particular device. if Pos('Android', window.navigator.useragent) > 0 then -- Matthew Jones |
This web page was last updated on Friday, November 1, 2024 at 07:01 PM | Privacy PolicySite Map © 2024 Elevate Software, Inc. All Rights Reserved Questions or comments ? E-mail us at info@elevatesoft.com |