Link to home
Start Free TrialLog in
Avatar of girlswants_me
girlswants_me

asked on

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!

Avatar of robert_marquardt
robert_marquardt

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.
download an example for Touch Screen Monitor (it works great) from:
page:        http://www.geocities.com/esoftbg/
  link:        Q_21122981.zip
Avatar of girlswants_me

ASKER

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.
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 ....
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.
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..

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

anyway, what should i do with the button problem????
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;
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.
ASKER CERTIFIED SOLUTION
Avatar of esoftbg
esoftbg
Flag of Bulgaria image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
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