1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.
  2. Donation with Paypal!!!

    Go to your paypal account and send directly donation to [email protected]

    1 month - 10 $ - Standart VIP

    6 months - 20 $- Standart VIP

    1 year - 30 $- Standart VIP

    2 years - 50 $- Standart VIP

    Gold member for life - 150 $- Standart VIP

    High Vip (Standart VIP include) group please send PM or email to [email protected] for info

    After Donation please send email to [email protected]

  3. Donation Ways 2020


    Paysend
  4. Telegram
Dismiss Notice

Donation with Paypal!!!

Go to your paypal account and send directly donation to [email protected]

1 month - 10 $ - Standart VIP

6 months - 20 $- Standart VIP

1 year - 30 $- Standart VIP

2 years - 50 $- Standart VIP

Gold member for life - 150 $- Standart VIP

High Vip (Standart VIP include) group please send PM or email to [email protected] for info

After Donation please send email to [email protected]

Dismiss Notice
For open hidden message no need write thanks, thank etc. Enough is click to like button on right side of thread.

LocationSensor Examples Code

Discussion in 'Delphi Android And IOS' started by AdminDF, Mar 2, 2014.

  1. AdminDF
    Online

    AdminDFAdminDF is a Verified Member Delphifan Staff Member DF Staff

    Code:
    unit HeaderFooterFormwithNavigation;
    
    interface
    
    uses
      System.SysUtils, System.Types, System.UITypes, System.Classes, System.Variants,
      FMX.Types, FMX.Controls, FMX.Graphics, FMX.Forms, FMX.Dialogs, FMX.TabControl,
      System.Actions, FMX.ActnList, FMX.StdCtrls, FMX.Objects, FMX.Edit,
      FMX.WebBrowser, System.Sensors, FMX.Sensors;
    
    type
      THeaderFooterwithNavigation = class(TForm)
        TabControl1: TTabControl;
        TabItem1: TTabItem;
        TabItem2: TTabItem;
        TopToolBar: TToolBar;
        ToolBarLabel: TLabel;
        TopToolBar1: TToolBar;
        ToolBarLabel1: TLabel;
        btnBack: TButton;
        ActionList1: TActionList;
        ChangeTabAction1: TChangeTabAction;
        ChangeTabAction2: TChangeTabAction;
        BottomToolBar: TToolBar;
        btnNext: TSpeedButton;
        btn1: TButton;
        img1: TImage;
        btn2: TButton;
        lts: TLocationSensor;
        lbl1: TLabel;
        lbl2: TLabel;
        swtch1: TSwitch;
        procedure FormCreate(Sender: TObject);
        procedure FormKeyUp(Sender: TObject; var Key: Word; var KeyChar: Char;
          Shift: TShiftState);
        procedure btn1Click(Sender: TObject);
        procedure btn2Click(Sender: TObject);
        procedure ltsLocationChanged(Sender: TObject; const OldLocation,
          NewLocation: TLocationCoord2D);
        procedure swtch1Switch(Sender: TObject);
      private
        { Private declarations }
      public
        { Public declarations }
      end;
    
    var
      HeaderFooterwithNavigation: THeaderFooterwithNavigation;
    
    implementation
    
    
    {$R *.fmx}
    procedure THeaderFooterwithNavigation.btn1Click(Sender: TObject);
    begin
    {$IFDEF IOS}
    ShowMessage('IOS!');
    {$ENDIF}
    
    {$IFDEF ANDROID}
    ShowMessage('ANDRIOD!');
    {$ENDIF}
    end;
    
    procedure THeaderFooterwithNavigation.btn2Click(Sender: TObject);
    begin
      lts.Active:=False;
      lts.Active:=True;
      lts.Accuracy:= 0.000000;
    
    end;
    
    procedure THeaderFooterwithNavigation.FormCreate(Sender: TObject);
    begin
      { This defines the default active tab at runtime }
      TabControl1.ActiveTab := TabItem1;
    {$IFDEF ANDROID}
      { This HIDE-THANKSs the toolbar back button on Android }
      btnBack.Visible := False;
    {$ENDIF}
    end;
    
    procedure THeaderFooterwithNavigation.FormKeyUp(Sender: TObject; var Key: Word;
      var KeyChar: Char; Shift: TShiftState);
    begin
      if Key = vkHardwareBack then
      begin
        if TabControl1.ActiveTab = TabItem2 then
        begin
          ChangeTabAction1.Tab := TabItem1;
          ChangeTabAction1.ExecuteTarget(Self);
          ChangeTabAction1.Tab := TabItem2;
          Key := 0;
        end;
      end;
    end;
    
    procedure THeaderFooterwithNavigation.ltsLocationChanged(Sender: TObject;
      const OldLocation, NewLocation: TLocationCoord2D);
    begin
          lbl1.Text:=Newlocation.Latitude.ToString;
           lbl2.Text:=Newlocation.Longitude.ToString;
    end;
    
    procedure THeaderFooterwithNavigation.swtch1Switch(Sender: TObject);
    begin
      lts.Active:=swtch1.IsChecked;
    end;
    
    end.
     
  2. rynak
    Online

    rynak Guest

    RE:

    Thanks
     

Share This Page