Delphi APP 開發入門(五)GPS 定位功能
Delphi APP 開發入門(五)GPS 定位功能
發表時間:2014/06/03|
在行動裝置的應用上,大多會離不開GPS定位以及地圖功能。今天就來教大家製作一個簡易的定位結合地圖的APP-「我現在在那裡」,讀者們可以利用這個超級簡單的APP延伸進階成其他的應用。 一、開啟一個新的Mobile專案
二、在畫面上放置一個ListBox元件,屬性設定如下 Align : Top GroupingKind : Grouped StyleLookup: ListboxStyle
三、接著我們要在上面增加一個程式的抬頭,在ListBox按右鍵,Add Item -> TListBoxHeader。接著在ListBoxHeader上新增一個Label,把屬性設定如下 Align : Client StyleLookup: toollabel Text: 我現在在那裡 TextSettings->HorzAlign: Center
四、接著在畫面上設定定位功能的開關跟顯示經緯度,一樣在Listbox上右鍵Add Item -> TListBoxItem建立三次。修改每個ListBoxItem的Text屬性為開啟定位功能、經度、緯度。 五、在上面放上TSwitch跟Label元件如下。
六、接著要顯示Google 地圖,在畫面上放置TWebBrowser元件,把Align設為Client。
七、最後在畫面上放上LocationSensor元件即完成畫面佈置。
八、正式開始寫程式囉!需要寫程式的地方只有二個,一個是打開LocationSensor定位,另一個是顯示在地圖上。在Switch的OnSwitch事件中,輸入以下程式
procedure TForm1.Switch1Switch(Sender: TObject); 九、接著在LocationSensor的OnLocationChanged事件輸入以下程式
procedure TForm1.LocationSensor1LocationChanged(Sender: TObject; 十、接著可以執行了!這邊是透過iOS模擬器執行的,如果要看到動態變動經緯度的效果,可以在模擬器的Debug -> Location ->設定成 City Run就會自動變動位置了。
這幾個禮拜下來,是不是覺得Delphi的開發時間大部份都是在拖拖拉拉畫面中渡過呢?培養了興趣之後,下週我們要開始回歸到比較嚴肅的基本語法課程囉 |
Delphi APP 開發入門(五)GPS 定位功能的更多相关文章
- Delphi APP 開發入門(六)Object Pascal 語法初探
Delphi APP 開發入門(六)Object Pascal 語法初探 分享: Share on facebookShare on twitterShare on google_plusone_sh ...
- Delphi APP 開發入門(八)SQLite資料庫
Delphi APP 開發入門(八)SQLite資料庫 分享: Share on facebookShare on twitterShare on google_plusone_share 閲讀次 ...
- Delphi APP 開發入門(七)通知與雲端推播
Delphi APP 開發入門(七)通知與雲端推播 分享: Share on facebookShare on twitterShare on google_plusone_share 閲讀次數: ...
- Delphi APP 開發入門(四)簡易手電筒
Delphi APP 開發入門(四)簡易手電筒 分享: Share on facebookShare on twitterShare on google_plusone_share 閲讀次數:32 ...
- Delphi APP 開發入門(十)REST Client 開發
Delphi APP 開發入門(十)REST Client 開發 分享: Share on facebookShare on twitterShare on google_plusone_share ...
- Delphi APP 開發入門(九)拍照與分享
Delphi APP 開發入門(九)拍照與分享 分享: Share on facebookShare on twitterShare on google_plusone_share 閲讀次數:30 ...
- Delphi APP 開發入門(三)簡易計算機
Delphi APP 開發入門(三)簡易計算機 分享: Share on facebookShare on twitterShare on google_plusone_share 閲讀次數:68 ...
- Delphi APP 開發入門(二)Android/iOS設定,Hello World
Delphi APP 開發入門(二)Android/iOS設定,Hello World 分享: Share on facebookShare on twitterShare on google_plu ...
- Delphi APP 開發入門(一)重生的 Delphi
Delphi APP 開發入門(一)重生的 Delphi 分享: Share on facebookShare on twitterShare on google_plusone_share 閲讀 ...
随机推荐
- 关于 Apache 的 25 个初中级面试题
关于 Apache 的 25 个初中级面试题 出自:http://blog.jobbole.com/60471/
- 关于Android Animation的setFillBefore、setFillAfter和setFillEnable
1. 如果是独立的Animation,只有setFillAfter有效,设置为true动画结束后保持最后的状态 2. 如果是AnimationSet中的Animation,因为Animation的作用 ...
- thinkPHP中phpexcel的导出功能
public function wExcel() { vendor("PHPExcel.PHPExcel"); // Create new PHPExcel object $obj ...
- PHP字符串截取操作大全
1. 截取GB2312中文字符串 <?php header("content-type:text/html;charset=gb2312"); // echo "a ...
- gradlew assembleRelease打包之前的配置
http://blog.csdn.net/qq_15527709/article/details/70146061
- HDU2586.How far away ?——近期公共祖先(离线Tarjan)
http://acm.hdu.edu.cn/showproblem.php?pid=2586 给定一棵带权有根树,对于m个查询(u,v),求得u到v之间的最短距离 那么仅仅要求得LCA(u,v),di ...
- springboot tomcat的使用
使用自带的tomcat 以java 项目启动: 默认端口号为8080 1.必须导入此包 2.有启动类
- Erstudio8.0怎么用?Erstudio8.0汉化版详细使用教程
Erstudio8.0使用教程 打开ERstudio,点击新建出现如图对话框: 选择第一个,表示创建一个新的关系型 数据库模型 这里提一点数据库模型分为relational(关系)和dimension ...
- jquery对象转dom对象
jq取兄弟级的上移个元素 jquery对象: var a = $(this).prev("a"); console.log(a); 输出: 转dom对象: var a = $(th ...
- [NOIP2017]列队 离线+SBT
[NOIP2017]列队 题目描述 Sylvia 是一个热爱学习的女♂孩子. 前段时间,Sylvia 参加了学校的军训.众所周知,军训的时候需要站方阵. Sylvia 所在的方阵中有n×m名学生,方阵 ...

















