473,385 Members | 1,782 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Touch Screen Buttons and Completion ComboBoxes

Hi,

I am trying to develop an application for a touch screen using buttons
for the numeric pad with Completion ComboBoxes.

At the moment I am having a problem sending the button presses to my
Completion ComboBox using sendkey.wait. From the keyboard (that will
not exist for my final application) I can enter text into my
Completion and the selection completes as expected.

In the attached demo program I can type using the keyboard

Type Selection Box shows
4 " 440 - Line 0"
44 " 440 - Line 0"
444 " 444 - Line 4"

However when I press the four button on my form I get.

Type Selection Box shows
4 " 440 - Line 0"
4 line clears

I assume that this is related to the fact that the focus is changing
from the ComboBox to the button during the press. Then I am forcing
the focus back to the Completion ComboBox. Not the same as typing
with a keyboard where the focus does not change.

What can I do so I can have both keyboard and button pressing to work
correctly in my Completion ComboBox? Is Sendkeys the way to go?

I have attached the shortest demo program I could develop. I hope
that this is suitable to demostrate my question.

Thanks for your time in reviewing my question. I have not been clear
please ask.

Tanaka

using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Data;

namespace keypad
{
public class mdtclientForm : System.Windows.Forms.Form
{
private System.ComponentModel.Container components = null;
private System.Windows.Forms.Button FourButton;
private CompletionComboBox CompletionComboBox;

private string strLostFocus;

public mdtclientForm()
{

InitializeComponent();
}
protected override void Dispose( bool disposing )
{
if( disposing )
{
if (components != null)
{
components.Dispose();
}
}
base.Dispose( disposing );
}

#region Windows Form Designer generated code

private void InitializeComponent()
{
this.FourButton = new System.Windows.Forms.Button();
this.CompletionComboBox = new keypad.CompletionComboBox();
this.SuspendLayout();

this.FourButton.Location = new System.Drawing.Point(100, 150);
this.FourButton.Name = "FourButton";
this.FourButton.Size = new System.Drawing.Size(50, 45);
this.FourButton.TabIndex = 29;
this.FourButton.Text = "4";
this.FourButton.Click += new
System.EventHandler(this.NumericPad_Click);

this.CompletionComboBox.Location = new System.Drawing.Point(32,
88);
this.CompletionComboBox.Name = "CompletionComboBox";
this.CompletionComboBox.Size = new System.Drawing.Size(200, 21);
this.CompletionComboBox.TabIndex = 3;
this.CompletionComboBox.LostFocus += new
System.EventHandler(this.COMBOBOX_LostFocus);
this.CompletionComboBox.Text = "<Press Keys or Buttons>";
this.CompletionComboBox.Items.AddRange(new object[] {
"440 - Line 0",
"441 - Line 1",
"442 - Line 2",
"443 - Line 3",
"444 - Line 4 ",
"445 - Line 5",
"446 - Line 5"});
this.ClientSize = new System.Drawing.Size(292, 266);
this.Controls.Add(this.FourButton);
this.Controls.Add(this.CompletionComboBox);
this.Name = "Form1";
this.Text = "Form1";
this.ResumeLayout(false);
}
#endregion

[STAThread]
static void Main()
{
Application.Run(new mdtclientForm());
}

private void NumericPad_Click(object sender, System.EventArgs e)
{
foreach (Control controls in this.Controls)
{
if (controls.Name == strLostFocus)
{
if (Object.ReferenceEquals(controls.GetType(),
typeof(CompletionComboBox)))
{
CompletionComboBox mycontrol = new CompletionComboBox();
Button button = (Button) sender;
if(controls.CanFocus)
{
controls.Focus();
SendKeys.SendWait(button.Text);
}
}
}
}
}

private void COMBOBOX_LostFocus (object sender, System.EventArgs e)
{
CompletionComboBox comboBox = (CompletionComboBox) sender;
strLostFocus = comboBox.Name;
}
}

public class CompletionComboBox : ComboBox
{
public event System.ComponentModel.CancelEventHandler NotInList;

[Category("Behavior")]
public bool LimitToList
{
get { return _limitToList_; }
set { _limitToList_ = value; }
}

protected virtual void
OnNotInList(System.ComponentModel.CancelEventArgs e)
{
if (NotInList != null)
NotInList.Invoke(this, e);
}

protected override void
OnValidating(System.ComponentModel.CancelEventArgs e)
{
if (_limitToList_)
{
int pos = FindStringExact(Text);
if (pos == -1)
OnNotInList(e);
else
this.SelectedIndex = pos;
}
base.OnValidating(e);
}

protected override void OnKeyDown(KeyEventArgs args)
{
_autoComplete_ = args.KeyCode != Keys.Delete && args.KeyCode !=
Keys.Back;
base.OnKeyDown(args);
}

protected override void OnTextChanged(EventArgs args)
{
if( _autoComplete_ )
{
string textEntered = Text;
int index = FindString(textEntered);
if( index >= 0 )
{
_autoComplete_ = false;
SelectedIndex = index;
_autoComplete_ = true;
Select(textEntered.Length, Text.Length);
}
}
base.OnTextChanged(args);
}
private bool _autoComplete_ = true;
private bool _limitToList_ = true;
}
}
Nov 16 '05 #1
0 7926

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: The Bear | last post by:
Is there any documentation for creating a touch screen application using c#. Any information anyone has would be great The Bear. *** Sent via Developersdex http://www.developersdex.com ***...
0
by: Hiroyuki Tanaka | last post by:
Hi All, I am trying to develop an application for a touch screen using buttons for the numeric pad with Completion ComboBoxes. At the moment I am having a problem sending the button presses to...
4
by: Bob | last post by:
I have no experience with them... can I expect that "touch" will fire "mousedown" for any control? Or will I need special controls that understand touchscreen input? Bob
3
by: kiran.challagolla | last post by:
Hi All I want to write a touch screen POS application. I am trying to get this accomplished in c#.net. I have very good experience in developing stand alone applications and web applications using...
2
by: reidarT | last post by:
Do I need to do anything in my application if I want to use a touch screen instead of keyboard/mouse, or is everything controlled by the screen drivers? reidarT
2
by: Simon Verona | last post by:
I know that Windows has a "clickable" keyboard that can pop up when necessary.. I have a touch-screen based application. Is there anyway that I can utilise this keyboard application in windows...
1
by: MikeY | last post by:
Hi Everyone, I'm looking for suggestions for touch screen form sizes. Or better yet dealing with forms very various screen sizes. How to deal with anchoring buttons etc and so they don't overlap...
3
by: Elioth | last post by:
I want to make a program which it work with a touch screen, I need to know if I need any special control or programming in vb.net to do, to the program work with the touch screen? Thanks for...
3
by: brino | last post by:
hi all ! i have a database working on a touch screen. on one of the forms i would like to place some buttons with all numbers so you can enter a numeric value in without using the keyboard. ie....
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.