From Clomosy Docs
No edit summary |
ClomosyAdmin (talk | contribs) No edit summary |
||
| (2 intermediate revisions by one other user not shown) | |||
| Line 5: | Line 5: | ||
: - Access to the phonebook | : - Access to the phonebook | ||
<div class="table-responsive"> | |||
{| class="wikitable" style="border: 2px solid #c3d7e0" | {| class="wikitable" style="border: 2px solid #c3d7e0" | ||
! style="background-color: #c3d7e0"| Feature !!style="background-color: #c3d7e0"| Use of !!style="background-color: #c3d7e0"|Definition | ! style="background-color: #c3d7e0"| Feature !!style="background-color: #c3d7e0"| Use of !!style="background-color: #c3d7e0"| Definition | ||
|- | |- | ||
|TclDeviceManager || | |TclDeviceManager ||DeviceManager1:TclDeviceManager; ||Variable is defined. | ||
|- | |- | ||
|TclDeviceManager.Create || | |TclDeviceManager.Create ||DeviceManager1 = TclDeviceManager.Create; ||TclDeviceManager is created on the project. | ||
|- | |- | ||
|Vibrate || | |Vibrate ||DeviceManager1.Vibrate(500); ||It is used to control the vibration feature of the device. In the example, it was vibrated for 500 milliseconds. | ||
|- | |- | ||
|BatteryStatus || | |BatteryStatus ||DeviceManager1.BatteryStatus || Indicates the battery level of the device. | ||
|- | |- | ||
|GetAddressBookContacts || | |GetAddressBookContacts ||DeviceManager1.GetAddressBookContacts('ConList'); || Provides access to the phone book of the device. In the example 'ConList' is a procedure. | ||
|- | |- | ||
|ContactsList || | |ContactsList ||DeviceManager1.ContactsList.Text || Returns a list representing contacts in the device's address book. | ||
|- | |- | ||
|CallOnAfterListProcName || | |CallOnAfterListProcName ||DeviceManager1.CallOnAfterListProcName ||Specifies the name of the procedure to be called after obtaining the list of phonebook contacts on the device. | ||
|} | |} | ||
</div> | |||
<b>Example</b><br> | |||
In the example, vibration and battery level are displayed, and names retrieved from the phonebook are listed in a Memo.<br> | |||
<pre> | |||
var | |||
MyDevice:TclDeviceManager; | |||
i : Integer; | |||
Memo1 : TclMemo; | |||
MyForm : TclForm; | |||
void ConList; | |||
{ | |||
//ShowMessage(MyDevice.ContactsList.Text); | |||
try | |||
for (i = 0 to MyDevice.ContactsList.Count - 1) | |||
{ | |||
Memo1.Lines.Add('Name: ' + Clomosy.StringListItemString(MyDevice.ContactsList,i)); | Memo1.Lines.Add('Name: ' + Clomosy.StringListItemString(MyDevice.ContactsList,i)); | ||
Memo1.Lines.Add('---'); | Memo1.Lines.Add('---'); | ||
} | |||
finally | |||
MyDevice.ContactsList.Free; | |||
} | |||
} | |||
{ | |||
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; | |||
} | |||
</pre> | |||
<h2> See Also </h2> | |||
* [[Components]] | |||
* [[Object Properties]] | |||
* [[AddNewEvent]] | |||
{{#seo:|description=Explore TclDeviceManager on Clomosy! Learn how to manage and control devices in your applications using the TclDeviceManager.}} | |||
Latest revision as of 07:25, 24 December 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
| Feature | Use of | Definition |
|---|---|---|
| TclDeviceManager | DeviceManager1:TclDeviceManager; | Variable is defined. |
| TclDeviceManager.Create | DeviceManager1 = TclDeviceManager.Create; | TclDeviceManager is created on the project. |
| Vibrate | DeviceManager1.Vibrate(500); | It is used to control the vibration feature of the device. In the example, it was vibrated for 500 milliseconds. |
| BatteryStatus | DeviceManager1.BatteryStatus | Indicates the battery level of the device. |
| GetAddressBookContacts | DeviceManager1.GetAddressBookContacts('ConList'); | Provides access to the phone book of the device. In the example 'ConList' is a procedure. |
| ContactsList | DeviceManager1.ContactsList.Text | Returns a list representing contacts in the device's address book. |
| CallOnAfterListProcName | DeviceManager1.CallOnAfterListProcName | Specifies the name of the procedure to be called after obtaining the list of phonebook contacts on the device. |
Example
In the example, vibration and battery level are displayed, and names retrieved from the phonebook are listed in a Memo.
var
MyDevice:TclDeviceManager;
i : Integer;
Memo1 : TclMemo;
MyForm : TclForm;
void ConList;
{
//ShowMessage(MyDevice.ContactsList.Text);
try
for (i = 0 to MyDevice.ContactsList.Count - 1)
{
Memo1.Lines.Add('Name: ' + Clomosy.StringListItemString(MyDevice.ContactsList,i));
Memo1.Lines.Add('---');
}
finally
MyDevice.ContactsList.Free;
}
}
{
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;
}