473,385 Members | 1,661 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.

How to ignore user click?

Hi

How can I make all user clicks (mouse and keyboard) to be ignored on a windows form (using C#), while a computer bot is still able to do so? All buttons, listbox, textbox, etc. need to stay enabled. A computer bot selections, changes and click animations need to be and stay viewable by the user, but only able to be done by the bot. It should be like the computer is having the full control over the form and the user is only watching him work on it.

Thanks
Mar 4 '09 #1
6 3547
IanWright
179 100+
If you have an OnMouseDown and on OnKeyDown method on your Form that don't do anything, you could override each control and ensure that their methods just call the form methods. Or I believe you could add events to each of the controls to fire on a MouseDown or KeyDown as they're added to the form, call the main Forms methods to process the events, and cancel the Eventargs afterwards so the original control does not process the message.
Mar 4 '09 #2
I don't know how to do that.
If i leave those events empty on each control, it still works as normal.
And not always the bot works on the form. Sometimes user gets the control over it, but when bot does (bot turn) that behavior should be.
Plus, does that prevent user to select something?
Mar 4 '09 #3
you could add something like the following code to all the functions, but it might be a bit bothersome to do on many controls.
and you would need an extra boolean to tell wether its the bots turn

Expand|Select|Wrap|Line Numbers
  1. if(botTurn == true)
  2. {
  3.      //Do nothing or tell the user its not his/her turn
  4.      return;
  5. }
  6. //Code you want done if it is your turn
Mar 4 '09 #4
Well it is not that kind if ignoring the click i need.
I still can see the button icon animating by my click and on a dialog it will return a result.
To make the understanding on it how it should behave, imagine that you have an opened dialog of some child form. At that point u can't do anything to the parent. That is behavior i need. As a parent form, but still not to have that child.
Mar 4 '09 #5
IanWright
179 100+
You mean you want a Parent to display a Child form, and for only the Child form to respond to any events?

If so... do you mean you want to do Form.ShowDialog(); ?
Mar 4 '09 #6
I know what ShowDialog() means. what i need is my form to act as if it had a child opened with ShowDialod and not to have that child actually. User actions to be ignored by the form. Only my background computer logic to work as a user could work normally. To see all animation on button clicks and selections by that logic.
Mar 4 '09 #7

Sign in to post your reply or Sign up for a free account.

Similar topics

10
by: john | last post by:
I want the page to completely ignore all mouse clicks. I can create the onmouseclick event and return false, but that only disables certain types of things. I can still, for example, click in a...
0
by: Anina | last post by:
It looks like the button control captures all of the clicks on the button no matter if the program is busy accessing code. For example: if the click event of a button has code that takes 10 seconds...
1
by: Lars Netzel | last post by:
I really need to stop users from reposting the form with Enter or Return keys. It bypasses so many onClick validations that nothign works if they use Enter. I must force the user to CLICK on the...
2
by: bretth | last post by:
In a VB.Net Windows Forms application, I have a user control that handles mouse events. Another section of code programmatically adds a label to the control. I would like label to ignore all...
1
by: Robert Jones | last post by:
If my application doesn't have focus and someone clicks on the menu, the menu click is "lost" as the form gets focus, and the user then has to click on the menu a second time to actually activate...
1
by: alw0015 | last post by:
I'm working on a piece of code that reads in a time from the user. This time value consists of 3 separate inputs: 1 integer representing hours 1 char representing the ":" 1 integer...
29
by: gs | last post by:
let say I have to deal with various date format and I am give format string from one of the following dd/mm/yyyy mm/dd/yyyy dd/mmm/yyyy mmm/dd/yyyy dd/mm/yy mm/dd/yy dd/mmm/yy mmm/dd/yy
4
by: tiago.private | last post by:
Hi everybody, Imagine the following scenario: One System.Web.UI.UserControl (UC1) with 2 drop downs and one button "Filter" One Webform with (UC1) and a GridView, basically the UC1 provides...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
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: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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...

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.