event-handling

visibilitychange event is not triggered when switching program/window with ALT+TAB or clicking in taskbar

ε祈祈猫儿з 提交于 2019-12-29 04:15:27
问题 Basically, the problem is with the behaviour of the event "visibilitychange". It's triggered: - When I switch to a different tab inside the browser window. When I click in minimize / restore buttons for the browser window. (this is ok) It's not triggered: - When I switch to a different window/program using ALT+TAB. When I switch to a different window/program clicking on taskbar. (this SHOULD trigger, because, just like when minimizing, the window's visibility may change) W3 Page Visibility

LongClick event happens too quickly. How can I increase the clicktime required to trigger it?

自古美人都是妖i 提交于 2019-12-29 04:14:31
问题 In an application I'm working on, I have the requirement that a user must click & hold a component for a period time before a certain action occurs. I'm currently using an OnLongClickListener to listen for the longclick, but I find that the length of a click to trigger the OnLongClick event is too short. For example, let's say the LongClick event triggers after a 400ms click, but I want the user to have to click & hold for 1200ms before the event triggers. Is there any way I can configure the

Force loop to wait for an event

こ雲淡風輕ζ 提交于 2019-12-29 01:59:13
问题 I am trying to write a method that goes through a list of items - for each one adds it to a form, then waits for the user to input some data and click a button. However I have no idea of what I should/could be using to create this. foreach (string s in List) { txtName.Text = s; //wait for button click... // When the user is ready, they click the button to continue the loop. } So far all I have found is the EventWaitHandle class, which seems to only apply for threads. How can I achieve this?

Python tkinter: stopping event propagation in text widgets tags

ぐ巨炮叔叔 提交于 2019-12-29 01:36:17
问题 I'm currently writing a color scheme editor. For the preview of the scheme, I use a text widget, where I insert text with the corresponding color tags (which I generate programmatically). What I want is the following behaviour: click anywhere on the text widget where no text is: change background color click on text inserted with a tag: change tags corresponding foreground color Now here's my problem: When I click on a tagged text, the callback of the tag is called. So far so good. But then,

wait for document.body existence

寵の児 提交于 2019-12-28 18:11:14
问题 I wrote a chrome extension that works before the page is loaded (using the attribute "run_at": "document_start" ). The problem is that I want to add a div tag to the webpage body as soon as it is created. Before that document.body is null so I can't append tags to it. I don't care about full load of the body, I just need it to be existent. I am trying to find the best way to be alerted when the body tag in html is created (not loaded fully, just created). Is there any event handler for this

Vanilla JavaScript version of jQuery .click

半腔热情 提交于 2019-12-28 08:38:21
问题 So maybe I'm just not looking in the right places but I can't find a good explanation of how to do the equivalent of jQuery's $('a').click(function(){ // code here }); in plain old JavaScript? Basically I want to run a function every time an a tag is clicked but I don't have the ability to load jQuery into the page to do it in the way above so I need to know how to do it using plain JavaScript. 回答1: Working Example: http://jsfiddle.net/6ZNws/ Html <a href="something">CLick Here</a> <a href=

Event not working on dynamically created element

六眼飞鱼酱① 提交于 2019-12-28 06:48:07
问题 I'm pulling my hair out trying to figure out why the mouseover event won't work with the .on handler with a dynamically created element from ajax. The only thing that seems to work is the code with .live but I understand that it is deprecated. $(".dropdown ul li").live("mouseover", function() { alert('mouseover works'); }); However, when I try using .on, it will not work - no matter what variations I try (document.ready, .mouseover, etc etc) $(".dropdown ul li").on("mouseover", function() {

How to get a right click mouse event? Changing EventArgs to MouseEventArgs causes an error in Form1Designer?

杀马特。学长 韩版系。学妹 提交于 2019-12-28 06:17:08
问题 I have a method to detect the left click event that visual studio made by double clicking on the form. private void pictureBox1_Click(object sender, EventArgs e) { MessageBox.Show("Left click"); } I want to have a right-click event by right-clicking on the same object. I read online that you can use this switch: private void pictureBox1_Click(object sender, EventArgs e) { if (e.Button == System.Windows.Forms.MouseButtons.Right){MessageBox.Show("Right click");} if (e.Button == System.Windows

How do I make an eventhandler run asynchronously?

落花浮王杯 提交于 2019-12-28 04:50:31
问题 I am writing a Visual C# program that executes a continuous loop of operations on a secondary thread. Occasionally when that thread finishes a task I want it to trigger an eventhandler. My program does that but the when the event handler is triggered, the secondary thread waits until the event handler is finished before continuing the thread. How do I make it continue? Here is the way I currently have it structured... class TestClass { private Thread SecondaryThread; public event EventHandler

ASP .NET Button event handlers do not fire on the first click, but on the second click after a PostBack

♀尐吖头ヾ 提交于 2019-12-28 03:39:08
问题 Background: I am customizing an existing ASP .NET / C# application. It has it's own little "framework" and conventions for developers to follow when extending/customizing its functionality. I am currently extending some of it's administrative functionality, to which the framework provides a contract to enforce implementation of the GetAdministrationInterface() method, which returns System.Web.UI.Control . This method is called during the Page_Load() method of the page hosting the GUI