?
Solved

Touch Screen Monitor Button

Posted on 2004-09-12
19
Medium Priority
?
593 Views
Last Modified: 2010-04-05
Hi Everyone!

I am creating an application that will be using a touchscreen instead of the mouse pointer.

The problem now is that if i used the TButton or any buttons found on DELPHI, it hardly responds when i placed my hands on the screen or it do responds but the button seems not to work as pressed.

Anybody here knows how to create a sensitive button? when  i press the button, the button image is "down" when i get my fingers off the button then it may look as "Up" or in normal state.

Thanks in advance!

0
Comment
Question by:girlswants_me
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 8
  • 6
  • 4
  • +1
19 Comments
 
LVL 11

Expert Comment

by:robert_marquardt
ID: 12041633
A touchscreen is an absolute pointing device. It is a mouse and is handled as mouse by Windows.
Your problems have to be elsewhere. Obviously you do not get the messages as expected.
Probably the driver gives you only MouseDown/MouseUp pairs if you tap on the screen.
This is standard touchscreen behavior. It is an interpretation of the touchscreen driver.
In fact there is no way that the touchscreen driver can generate separate MouseDown and MouseUp messages.
0
 
LVL 12

Expert Comment

by:esoftbg
ID: 12041682
download an example for Touch Screen Monitor (it works great) from:
page:        http://www.geocities.com/esoftbg/
  link:        Q_21122981.zip
0
 

Author Comment

by:girlswants_me
ID: 12041702
Have you tried to run your TButton on the touchscreen?
I have 1 touch screen here, when uses a mouse pointer i can see the button image changes to "Down" then "Up"
when i use my fingers, the button will not stay to "Down" but instead remains to "UP" and run the showmessage('ss') instead.

procedure onclick(Sender:TObject);
begin
 showmessage('ss');
end;

i also tried the onmousedown event still dont serve the purpose.
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 12

Expert Comment

by:esoftbg
ID: 12041968
I just uploaded an improved version on the above example which buttons after pressing holds down (you alwais see the last pressed button). If you would like to see how OnPress button is Down and after a while is back Up, I could do that ....
0
 
LVL 11

Expert Comment

by:robert_marquardt
ID: 12042407
The easiest solution is to install the control panel for disabled persons which should allow to make the mouse buttons click & lock,
ie first click generates only mouse down whereas next click generates only mouse up.
0
 

Author Comment

by:girlswants_me
ID: 12050958
esoftbg,

How can i cannot run your apps? im using delphi 3 here and whenever i open your apps. it prompts me a "Variant" error etc..

0
 

Author Comment

by:girlswants_me
ID: 12051611
Sorry for the poor english.
0
 
LVL 12

Expert Comment

by:esoftbg
ID: 12051649
Oh, I didn't know you use Delphi 3. My example is written by Delphi 7....
0
 
LVL 12

Expert Comment

by:esoftbg
ID: 12051677
May be you have to delete Variants from the uses-clause, but I'm not sure. I have Delphi 5, Delphi 6 and Delphi 7 on CD Roms, but I have not Delphi 3 ....
0
 

Author Comment

by:girlswants_me
ID: 12051765
I know this sounds "dumn", can you share me a copy of those delphi you have?
0
 
LVL 12

Expert Comment

by:esoftbg
ID: 12051842
Even you promise to use Delphi 7 only for evaluation purposes, how can I share 651 MB ?
0
 

Author Comment

by:girlswants_me
ID: 12052340
How about splitting it by 60mb each and i will just download it tru FTP. Anyway, still i can't ran the apps you created on my delphi 3.0
0
 
LVL 11

Expert Comment

by:robert_marquardt
ID: 12052430
Please no illegal activities here!
0
 
LVL 12

Expert Comment

by:esoftbg
ID: 12052531
Sorry girlswants_me, you see that's illegal !
0
 

Author Comment

by:girlswants_me
ID: 12052650
That's OK, i understand. sorry.

anyway, what should i do with the button problem????
0
 
LVL 12

Expert Comment

by:esoftbg
ID: 12053048
This code will keep the SpeedButton1 dow for about 2 seconds:
Ofcourse you should add your own code here

procedure TForm1.SpeedButton1Click(Sender: TObject);
var
  B:      Boolean;
  DTB:    TDateTime;
  DTC:    TDateTime;
begin
  if (Sender is TSpeedButton) then
  with (Sender as TSpeedButton) do
  begin
    DTB := Now;
    DTC := DTB;
    B := True;
    Down := True;
    while B do
    begin
      B := (DTC-DTB<0.000016);
      DTC := Now;
      Down := B;
    end;
  end;
end;
0
 
LVL 11

Expert Comment

by:robert_marquardt
ID: 12055638
Still the basic problem is that the touchscreen always generates a mouse down and a mouse up aka click when you touch it.
Touching and moving is only mouse movement not mouse click.
0
 
LVL 12

Accepted Solution

by:
esoftbg earned 500 total points
ID: 12064095
Or better using GetTickCount function retrieves the number of milliseconds that have elapsed since Windows was started.

procedure TForm1.SpeedButton1Click(Sender: TObject);
var
  B:      Boolean;
  GTCB:   Cardinal; // DWORD;
  GTCC:   Cardinal; // DWORD;
begin
  if (Sender is TSpeedButton) then
  with (Sender as TSpeedButton) do
  begin
    GTCB := GetTickCount;
    GTCC := GTCB;
    B := True;
    Down := True;
    while B do
    begin
      B := (GTCC-GTCB<1000);
      GTCC := GetTickCount;
      Down := B;
    end;
  end;
end;
0
 
LVL 2

Expert Comment

by:insomniac92
ID: 12072786
Have you looked at the settings for the touch screen. Normally the drivers for the touch screen have modes you can set the screen to. I can't remember off hand, but these are usually something like drawing mode, button mode, etc...I know Microtouch screens have this setting. These settings can make a big difference to how your buttons react when you press on them.
Cheers


0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The uses clause is one of those things that just tends to grow and grow. Most of the time this is in the main form, as it's from this form that all others are called. If you have a big application (including many forms), the uses clause in the in…
In my programming career I have only very rarely run into situations where operator overloading would be of any use in my work.  Normally those situations involved math with either overly large numbers (hundreds of thousands of digits or accuracy re…
Have you created a query with information for a calendar? ... and then, abra-cadabra, the calendar is done?! I am going to show you how to make that happen. Visualize your data!  ... really see it To use the code to create a calendar from a q…
In this video, Percona Solutions Engineer Barrett Chambers discusses some of the basic syntax differences between MySQL and MongoDB. To learn more check out our webinar on MongoDB administration for MySQL DBA: https://www.percona.com/resources/we…
Suggested Courses
Course of the Month10 days, 10 hours left to enroll

764 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question