From Clomosy Docs
(Created page with "The TclDeviceManager component is used to interact with devices. This component allows you to control the properties and functions of devices.<br> Properties include: : - Vibration : - Battery level : - Access to the phonebook Usage of the TclDeviceManager component: {| class="wikitable" style="border: 2px solid #c3d7e0" ! style="background-color: #c3d7e0"| Feature !!style="background-color: #c3d7e0"| Use of !!style="background-color: #c3d7e0"|Definition |- |TclDevic...") |
No edit summary |
||
| Line 49: | Line 49: | ||
MyForm := TclForm.Create(Self); | MyForm := TclForm.Create(Self); | ||
Memo1 := MyForm.AddNewMemo(MyForm,'Memo1',''); | Memo1 := MyForm.AddNewMemo(MyForm,'Memo1',<nowiki>''</nowiki>); | ||
Memo1.Align := alClient; | Memo1.Align := alClient; | ||
Memo1.Margins.Left:= 10; | Memo1.Margins.Left:= 10; | ||
Revision as of 14:39, 15 January 2024
The TclDeviceManager component is used to interact with devices. This component allows you to control the properties and functions of devices.
Properties include:
- - Vibration
- - Battery level
- - Access to the phonebook
Usage of the TclDeviceManager component:
| Feature | Use of | Definition |
|---|---|---|
| TclDeviceManager | MyDevice:TclDeviceManager; | Variable is defined. |
| TclDeviceManager.Create | MyDevice:=TclDeviceManager.Create; | TclDeviceManager is created on the project. |
| Vibrate | MyDevice.Vibrate(500); | It is used to control the vibration feature of the device. In the example, it was vibrated for 500 milliseconds. |
| BatteryStatus | MyDevice.BatteryStatus | Indicates the battery level of the device. |
| GetAddressBookContacts | MyDevice.GetAddressBookContacts('ConList'); | Provides access to the phone book of the device. In the example 'ConList' is a procedure. |
| ContactsList | MyDevice.ContactsList.Text | Returns a list representing contacts in the device's address book. |
| CallOnAfterListProcName | MyDevice.CallOnAfterListProcName | Specifies the name of the procedure to be called after obtaining the list of phonebook contacts on the device. |
You can examine how these properties are used with an example. In the example, names retrieved from the phonebook are listed in a Memo.
Example:
var
MyDevice:TclDeviceManager;
i : Integer;
Memo1 : TclMemo;
MyForm : TclForm;
procedure ConList;
begin
//ShowMessage(MyDevice.ContactsList.Text);
try
for i := 0 to MyDevice.ContactsList.Count - 1 do
begin
Memo1.Lines.Add('Name: ' + Clomosy.StringListItemString(MyDevice.ContactsList,i));
Memo1.Lines.Add('---');
end;
finally
MyDevice.ContactsList.Free;
end;
End;
begin
MyForm := TclForm.Create(Self);
Memo1 := MyForm.AddNewMemo(MyForm,'Memo1','');
Memo1.Align := alClient;
Memo1.Margins.Left:= 10;
Memo1.Margins.Right:= 10;
Memo1.Margins.Top:= 10;
Memo1.Margins.Bottom:= 10;
Memo1.ReadOnly := True;
Memo1.TextSettings.WordWrap := True;
MyDevice:=TclDeviceManager.Create;
ShowMessage(MyDevice.BatteryStatus);
MyDevice.Vibrate(500);
MyDevice.GetAddressBookContacts('ConList');
ShowMessage('List Name: '+MyDevice.CallOnAfterListProcName);
MyForm.Run;
End;