Home › Forums › Software Development › Tobii Analytics SDK with PCEye GO Problems › Reply To: Tobii Analytics SDK with PCEye GO Problems
Thank You very much for your reply. I have now begun developing a program which will be a specialized keyboard and i am using Eyex to make the buttons click-able using the EyeX tracker, to enable the user to type with his/her eyes using the EyeX Engine. The end game is to mimic the keyboards that come included with a MyTobii and the SonoKey. However I have run into a problem with my project.
I am writing the program in VB.net because the specialized keyboard has already been built in VB.net and I am just adding the EyeX eye tracking interface and usability to the program to enable the user to type with their eyes. I have successfully created an EyeXhost and a FormsEyeXHost and have been able to connect to the device and pull in data form it. I have tested this by successfully obtaining the users eye location using the CreateEyePositionDataStream() method amongst other methods I successfully tested.
My problems begin when I try to create and add a BehaviorMap() to my project and link the BehaviorMap to the EyeXHost and then add a button to the BehaviorMap and make the button clickable using the EyeX SDK.
I found the example in the developers manual how to do this in C# and have tried converting it to VB.NET but encounter an error in the Behaviormap.cs file of the EyeXFramework.dll. First when I run the program it gives me a warning saying that the behaviormap.cs source file is different from when the module was built. Then for some reason It throws a “NullReferenceException was unhandled by user” when trying to add behaviormap object I created to the “Components” container. The IContainer called “Components” is equal to null.
A little background about what I have done to get this far. The EyeXFramework only came in binary so in order to get a usable Dll file a could import as a reference in my program I built and ran one of the included example which created the EyeXFramework.dll file which I use in my program. Also the behaviorMap object was not added to the toolbox when I added the EyeXFramework.dll file to my project so I added one manually in the form code and designer.
I am including my code at the end of this post. Any help would be greatly appreciated.
Here is the Program Class:
Option Strict On Option Explicit On Imports EyeXFramework Imports Tobii.EyeX.Client Imports Tobii.EyeX.Framework Imports EyeXFramework.Forms Public Class Program Private Shared _eyeXHost As New FormsEyeXHost() Public Shared ReadOnly Property EyeXHost() As FormsEyeXHost Get Return _eyeXHost End Get End Property <STAThread> Private Shared Sub Main() _eyeXHost.Start() Application.EnableVisualStyles() Application.SetCompatibleTextRenderingDefault(False) Application.Run(New Form1()) _eyeXHost.Dispose() End Sub End Class
Here is the Form Code:
Imports EyeXFramework Imports Tobii.EyeX.Framework Imports EyeXFramework.Forms Public Class Form1 Public Sub New() ' This call is required by the designer. InitializeComponent() ' Add any initialization after the InitializeComponent() call. Program.EyeXHost.Connect(_behaviorMap1) _behaviorMap1.Add(Button1, New ActivatableBehavior(AddressOf OnButton1Activated)) End Sub Private Sub OnButton1Activated(sender As Object, e As EventArgs) Button1.PerformClick() End Sub End Class
And here is the form designer
<Global.Microsoft.VisualBasic.CompilerServices.DesignerGenerated()> _ Partial Class Form1 Inherits System.Windows.Forms.Form 'Form overrides dispose to clean up the component list. <System.Diagnostics.DebuggerNonUserCode()> _ Protected Overrides Sub Dispose(ByVal disposing As Boolean) Try If disposing AndAlso components IsNot Nothing Then components.Dispose() End If Finally MyBase.Dispose(disposing) End Try End Sub 'Required by the Windows Form Designer Private components As System.ComponentModel.IContainer Private _behaviormap1 As EyeXFramework.Forms.BehaviorMap 'NOTE: The following procedure is required by the Windows Form Designer 'It can be modified using the Windows Form Designer. 'Do not modify it using the code editor. <System.Diagnostics.DebuggerStepThrough()> _ Private Sub InitializeComponent() Me.Button1 = New System.Windows.Forms.Button() Me.SuspendLayout() ' 'Button1 ' Me.Button1.Location = New System.Drawing.Point(96, 93) Me.Button1.Name = "Button1" Me.Button1.Size = New System.Drawing.Size(75, 23) Me.Button1.TabIndex = 0 Me.Button1.Text = "Button1" Me.Button1.UseVisualStyleBackColor = True ' 'Form1 ' Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!) Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font Me.ClientSize = New System.Drawing.Size(284, 262) Me.Controls.Add(Me.Button1) Me.Name = "Form1" Me.Text = "Form1" Me.ResumeLayout(False) Me._behaviormap1 = New EyeXFramework.Forms.BehaviorMap(Me.components) End Sub Friend WithEvents Button1 As System.Windows.Forms.Button End Class