Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 651
  • Last Modified:

Touch Screen Monitor Button

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
girlswants_me
Asked:
girlswants_me
  • 8
  • 6
  • 4
  • +1
1 Solution
 
robert_marquardtCommented:
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
 
esoftbgCommented:
download an example for Touch Screen Monitor (it works great) from:
page:        http://www.geocities.com/esoftbg/
  link:        Q_21122981.zip
0
 
girlswants_meAuthor Commented:
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!

 
esoftbgCommented:
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
 
robert_marquardtCommented:
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
 
girlswants_meAuthor Commented:
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
 
girlswants_meAuthor Commented:
Sorry for the poor english.
0
 
esoftbgCommented:
Oh, I didn't know you use Delphi 3. My example is written by Delphi 7....
0
 
esoftbgCommented:
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
 
girlswants_meAuthor Commented:
I know this sounds "dumn", can you share me a copy of those delphi you have?
0
 
esoftbgCommented:
Even you promise to use Delphi 7 only for evaluation purposes, how can I share 651 MB ?
0
 
girlswants_meAuthor Commented:
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
 
robert_marquardtCommented:
Please no illegal activities here!
0
 
esoftbgCommented:
Sorry girlswants_me, you see that's illegal !
0
 
girlswants_meAuthor Commented:
That's OK, i understand. sorry.

anyway, what should i do with the button problem????
0
 
esoftbgCommented:
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
 
robert_marquardtCommented:
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
 
esoftbgCommented:
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
 
insomniac92Commented:
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

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

  • 8
  • 6
  • 4
  • +1
Tackle projects and never again get stuck behind a technical roadblock.
Join Now