MPage

From RadPHP XE2 Documentation
Jump to: navigation, search

MPage is a container for a screen in a mobile application. Mobile general and hardware components can only be used in MPage containers.

Basic Page

This is the basic most basic structure of an MPage. If you run this code, you will get an empty screen:

<?php
  // Include RadPHP Component Library.
  require_once("rpcl/rpcl.inc.php");
 
  // Request basic units for mobile development.
  use_unit("jquerymobile/forms.inc.php");
  use_unit("extctrls.inc.php");
  use_unit("stdctrls.inc.php");
 
  // Define screen class, which extends MPage.
  class MainScreen extends MPage
  {
    // …
  }
 
  global $application; // Variable for the application, owner of all screens (MPage objects).
  global $mainScreen;  // Variable for this Mobile Page (MainScreen).
 
  $mainScreen = new MainScreen();  // Create the MainScreen object.
 
  $mainScreen->show();  // Render the screen.
?>

Run in a web browser

You can run current page at any moment in a web browser from Run > Run. You can also click Run button from default toolbar (it is part of the debug tools):

Top-toolbar-run.png

Remember hardware features such as camera or geolocation will only work in a real device or some emulators.
Tip: There is a video tutorial on how to create iPhone applications which includes an example of running a mobile application in a web browser (around minute 4:15).

Properties

ViewportScale
Set it to 100 for your application to take the whole device screen (100%).
Personal tools