|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Announcements
Chapters
Services
Feature Zones
|
IntroductionPen Flicks is the latest methodology in Microsoft Windows Vista™ which is designed specifically for a Ultra Mobile/Tablet PC. They are gestures you can make with your tablet pen to quickly navigate and perform shortcuts. This article describes a Touch Screen Windows Explorer which will leverage this new technology and will compare it with the traditional Windows Explorer. Here is a screenshot:
The GoalThe goal is to create an efficient Touch Screen Windows Explorer which can be used in the Tablet PC / Ultra Mobile PC environment, where mouse and keyboards are barely available.
BackgroundPen Flicks are quick, linear pen movements associated with scrolling actions and commands. Pen Flicks allow quick pen access to navigation and editing actions. Pen Flicks in action: standard up and down Flicks.
There are two categories of Pen Flicks: navigational and editing. Navigational Pen Flicks include drag up, drag down, move back, and move forward. Editing Pen Flicks include copy, paste, undo, and delete. For example, you can drag up or down on a page, move back or forward in a browser window, or paste an item into a document, all with a flick of your pen. Pen Flicks settings can be found in the Control Panel of Windows Vista. You can see the details inside Pens and Input Devices. The feature works only with the Tablet PC / Ultra Mobile PC with Microsoft Vista. Click here to see the screenshot. Windows Vista includes a set of eight basic Pen Flicks. See image below.
These is the default set for Pen Flicks, and can be customized using the Pen Flicks API. If you don't override the feature, these functions will be called. You can customize Pen Flicks to perform other functions, which increases your efficiency while making pen use feel more natural. To make pen training easier, Windows Vista includes a tutorial that presents the essentials of using a tablet pen to perform these shortcuts. How the application talks with Pen FlicksThe Windows Vista operating system uses two approaches to interact with the application when a pen flick occurs, and they are in the following order:
A client application can process the
WM_TABLET_FLICK
WPARAM wParam
LPARAM lParam
Parameters
The typedef struct FLICK_DATA { FLICKACTION_COMMANDCODE iFlickActionCommandCode:5; FLICKDIRECTION iFlickDirection:3; BOOL fControlModifier:1; BOOL fMenuModifier:1; BOOL fAltGRModifier:1; BOOL fWinModifier:1; BOOL fShiftModifier:1; INT iReserved:2; BOOL fOnInkingSurface:1; INT iActionArgument:16; }FLICK_DATA; The typedef struct FLICK_POINT { INT x:16; INT y:16; }FLICK_POINT; The following is a list of application commands that can be assigned to flicks, with the backup keystroke message that might be sent.
Using the codeIn this example, I am using the // the user control
public TouchScreenExplorer()
{
InitializeComponent();
}
protected override System.Windows.Forms.CreateParams CreateParams
{
get
{
CreateParams Cp = base.CreateParams;
Cp.Style = Cp.Style & ~0x200000;
return Cp;
}
}
public void ResetFolder()
{
listBox1.Items.Clear();
imglpreview.Images.Clear();
}
public void SetFolder(ListView myView, ImageList imglp)
{
explorerListItems = myView;
listBox1.Items.Clear();
imglpreview.Images.Clear();
//imglpreview = myImageList;
int i = 0;
ImageCount = 0;
for (int j = 0; j < myView.Items.Count; j++)
{
try
{
imglpreview.Images.Add(imglp.Images[j] );
listBox1.Items.Add(new Controls.Development.
ImageListBoxItem(myView.Items[j].Text, j));
}
catch(Exception e1)
{
MessageBox.Show(e1.Message + i);
}
}
}
The default Up and Down Flicks can be directly used to scroll up and down in the Touch Screen Windows Explorer. To navigate a level up and down in the Explorer tree, I am explicitly checking if the calling Pen Flick is causing Alt + Left arrow for backward action or Alt + Right arrow for forward action, which is again caused by the default flick left and right action. Here is a portion of the code, see attached file for details: public void NextImage()
{
if (listBox1.SelectedIndex < listBox1.Items.Count-1)
{
listBox1.SelectedIndex = listBox1.SelectedIndex +1;
ImageChangedEvent(this,EventArgs.Empty);
}
}
public void PreviousImage()
{
if (listBox1.SelectedIndex >0)
{
listBox1.SelectedIndex = listBox1.SelectedIndex - 1;
ImageChangedEvent(this,EventArgs.Empty);
}
}
private void listBox1_MouseUp(object sender, MouseEventArgs e)
{
if (e.Button == MouseButtons.Right )
GoBackEvent(this, EventArgs.Empty);
}
private void listBox1_KeyDown(object sender, KeyEventArgs e)
{
if (e.Alt && (e.KeyCode == Keys.Left) )
GoBackEvent(this, EventArgs.Empty);
if (e.KeyCode == Keys.Back)
GoBackEvent(this, EventArgs.Empty);
if (e.Alt && (e.KeyCode == Keys.Right))
{
ResetFolder();
GoForwardEvent(this, EventArgs.Empty);
}
if (e.KeyCode == Keys.Enter)
{
ResetFolder();
GoForwardEvent(this, EventArgs.Empty);
}
}
Three screens of the Touch Screen Explorer tree
A backward Flick in the second screen will display the first screen, and a forward Flick the third screen. About the Explorer tree, I have made a Touch Screen Explorer control based on a Windows Explorer control from here and here. The Explorer control DLL can be found along with the source code. Here is a piece of code which shows the private void expTree1_ExpTreeNodeSelected (string pathName, CShItem CSI)
{
ArrayList dirList = new ArrayList();
ArrayList fileList = new ArrayList();
int TotalItems;
LastSelectedCSI = CSI;
if (CSI.DisplayName.Equals(CShItem.strMyComputer)) {
dirList = CSI.GetDirectories(true );
// avoid re-query since only has dirs
}
else {
dirList = CSI.GetDirectories(true);
fileList = CSI.GetFiles();
}
SetUpComboBox(CSI);
TotalItems = (dirList.Count + fileList.Count);
if ((dirList.Count > 0))
{
sbr1.Text = "Location: " + pathName + ", "
+ dirList.Count + " Directorie(s) and " +
fileList.Count + " File(s)";
ArrayList combList = new ArrayList(TotalItems);
combList.AddRange(dirList);
combList.AddRange(fileList);
lv1.BeginUpdate();
lv1.Items.Clear();
imglpreviewForm.Images.Clear();
foreach (CShItem item in combList)
{
ListViewItem lvi = new ListViewItem
(item.DisplayName);
if (item.IsFolder)
{
CShItem localitem = item;
imglpreviewForm.Images.Add(SystemImageListManager
.GetIcon(localitem.IconIndexNormal, false));
lvi.ImageIndex = SystemImageListManager
.GetIconIndex(ref localitem, false, false);
lvi.Tag = item;
lv1.Items.Add(lvi);
}
}
lv1.EndUpdate();
myPhotos1.SetFolder(lv1, imglpreviewForm);
myPhotos1.CaptionText = CSI.DisplayName;
}
else {
lv1.Items.Clear();
}
}
In action
ThoughtsThe Touch Screen Windows Explorer uses the latest technology, Pen Flicks, and gives more mobility to the user. It makes a Tablet PC/Ultra Mobile PC efficient by giving it the independence of keyboard and mouse. How different would have been the interface if there were never a keyboard or mouse ? What if scrollbars were never invented? These are some of the questions to get you started on interface interaction, when you develop your application for Tablet PC/Ultra Mobile application. Scrollbars are out, Point & click is out, Keyboard and mouse are out, Pen Flicks is in, Touch Screen in. References
And thanksFor coming so far! I hope you find this useful, and take care. Article history
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||