All tricks in this blog are only for educational purpose. Learn these tricks only for your knowledge. Please donot try these to harm any one. We will not take any responsibility in any case. All softwares and tools on this site are here for private purposes only and If you want to use a software for business purpose, please purchase it. I do not host many of these tools. I Post links that I have found from numerous Search engines. I will not be responsible for any of harm you will do by using these tools.


Friday, September 24, 2010

programming tutorial: Getting started with Phidgets in Delphi

Getting_Started_Delphi created: 04/21/09 Page 1 … examples were written using Borland Delphi 2005 and 7, and this tutorial … Event Driven Programming We recommend the use of event …
Environment and Libraries First, we need to set up the proper environment and get the necessary files off the Phidgets website. Visit the drivers section at www.phidgets. com and get the latest: Phidget Framework • You will need files installed with the Phidget Framework to program and use Phidgets. We also recommend that you download the following reference materials from the programming section: Examples in Delphi • COM API Manual • Programming Manual • The Product Manual for your device • The COM API manual contains calls and events for every type of Phidget and can be used as a reference. You can find a high level discussion about programming with Phidgets in general in the Programming Manual. The Product manual for your device also contains an API section that describes limitations, defaults, and implementation details specific to your Phidget. You may want to have these manuals open while working through theseinstructions. Setting up a Phidgets Project The Phidget examples were written using Borland Delphi 2005 and 7, and this tutorial assumes its use. The ActiveX objects installed with the Phidget libraries are not automatically imported into Delphi, so to begin you will need to manually import them: 1. Go to Component >> Import ActiveX Control… 2. Select the Phidget Library 2.1 and click install 3. In the next popup select the “install into new package” tab 4. Give the package a suitable name and description such as “Phidgets”, and then click OK 5. Compile and Install the newly created package if not done so automatically. In newer versions of Delphi: 1. Go to Component >> Import Component… 2. Choose “Import ActiveX Control” and click Next 3. Pick Phidget Library 2.1 from the list and click Next 4. Set the palette Page to ActiveX and check the Generate Component Wrappers option 5. Choose Install into a new package and click next 6. Give the package a name and description such as “Phidgets”, and then click Finish Coding For Your Phidget Before you can use the Phidget, you must declare and initialize its ActiveX object. The simplest method is to place the control from the ActiveX component tab on to your form. For this tutorial, create a PhidgetInterfaceKit control (PhidgetInterfaceKit1) and then add a text edit field to the form for the purpose of capturing simple output. The object name for any type of Phidget is listed in the API manual. Every type of Phidget also inherits functionality from the Phidget base class. Connecting to the Phidget Next, we need to tell the program to try and connect to the Phidget through a call to open(). The open will tell the program to continuously try to connect to a Phidget, based on the parameters given, even trying to reconnect if it gets disconnected. This means that calling open does not guarantee you can use the Phidget immediately. We can handle it by either using event driven programming and tracking the AttachEvents and DetachEvents, or by calling waitForAttachment. WaitForAttachment will block indefinitely until a connection is made to the Phidget, or an optional timeout is exceeded…

Download programming tutorial: Getting started with Phidgets in Delphi.


Post a Comment