event-handling

asp.net: send an object's event from a UserControl to its Parent

送分小仙女□ 提交于 2019-12-14 02:22:00
问题 I have a User class with functions to Login() and Logout() and GetData() . There's a UserChanged event, it fires when either of these functions are called. I have UserControls on my Default.aspx (they're added dynamically). I have a UserControl named Login.ascx. It provides the functionality to use the User class: you can Login / Logout here. I have an ****EventHandler* for **UserChanged***** (if I don't have one, it will fail with a object not found exception). I need to alert the other

Adding a click event to a dynamic button rendered through a literal

℡╲_俬逩灬. 提交于 2019-12-14 02:18:36
问题 I have a dynamic button which is being rendered through an ASP:Literal StringBuilder sb = new StringBuilder(); StringWriter sw = new StringWriter(sb); HtmlTextWriter writer = new HtmlTextWriter(sw); Button btnOpenFile = new Button(); btnOpenFile.ID = "BtnOpenFile-" + additionalReadingFileID; btnOpenFile.Text = "Open"; btnOpenFile.CssClass = "SettingsChangeButton"; btnOpenFile.Click += new EventHandler(OpenFileInLocation); btnOpenFile.RenderControl(writer); writer.Close(); sw.Close(); this

Synchronous Event Handler thread execution in non-Win Form C# app

耗尽温柔 提交于 2019-12-14 02:18:25
问题 I'm running a number of time\CPU intensive processes (TimeExpensive type) one after another. The Main thread (A) starts TimeExpensive process in another thread (B) asynchronously and becomes inactive. On Completion, Thread B fires caller's completion handler synchronously and starts next TimeExpensive process in thread B. A new thread (C) is created but After starting C, B finishes. So for n processes, n threads are created and most of time, they don't co-exist. One may wish its

Click Handlers for Trees in GXT 3?

萝らか妹 提交于 2019-12-14 01:30:15
问题 I've been looking through GXT3's Tree API for some way to execute an action when I click or double click on a node in a tree, and I can't seem to find anything that would work. I know TreeGrid has a CellClickHandler and CellDoubleClick handler, but there doesn't seem to be anything similar for Tree . There's the generic addHandler method inherited from Widget but this seems like it would apply to the whole tree, not a specific node. Is there something I'm overlooking, or a different / better

Mouse click location on an image

僤鯓⒐⒋嵵緔 提交于 2019-12-14 01:16:45
问题 I have a GWT container with some stuff in it and an image which is added a clickhandler. What I try to do is to get the exact mouse event's X and Y coordinates relative to the image. I saw the post here but this is not what I want. As far as I can see, I have option like getting the image absolute location and event location but this works only if the user doesn't scroll down the page. event.getNativeEvent().getClientY()- image.getElement().getAbsoluteTop(); 回答1: Thanks to Samuel, here is the

Pausing execution of code in the actionPerformed() method of ActionListener

时光怂恿深爱的人放手 提交于 2019-12-13 20:43:21
问题 I have this actionPerformed method that draws two cards. In between of drawing of those two cards I want to pause the the program for a certain amount of time so that I will be able see drawing of cards one by one. I tried Thread.sleep() method but it just pauses the program after the execution of actionPerformed method. 回答1: Because a long-running operation (like pausing) in the Swing event thread will freeze the UI, this is not a recommended strategy. Instead, maybe consider using a Timer

ExtJS find events handlers registered with an object

风流意气都作罢 提交于 2019-12-13 19:44:06
问题 I would like to find which event handlers are registered over an object (in my concrete case it's the pagetree in the TYPO3 CMS backend). Is there a method to get all event handlers ? 回答1: You can simply walk through its events property. Most of the members will be just true , but those actually representing attached events will be objects. Type something like: var es = Ext.getCmp('my-tree-id').events; for (var k in es) { if (Ext.isObject(es[k])) { console.log(es[k]); } } If your object is a

Java - Handle multiple events with one function?

爱⌒轻易说出口 提交于 2019-12-13 18:08:09
问题 First of all, I am a complete Java NOOB. I want to handle multiple button presses with one function, and do certain things depending on which button was clicked. I am using Netbeans, and I added an event with a binding function. That function is sent an ActionEvent by default. How do I get the object that was clicked in order to trigger the binding function from within that function so I know which functionality to pursue? 回答1: The object that sent the event is the event source so evt

Capturing clicks on all A tags using eventListener

别说谁变了你拦得住时间么 提交于 2019-12-13 14:51:26
问题 I'm trying to come up with a solution that will allow me to know whenever an "A" tag (or any other tag within an "A" tag) is clicked. For example: <a href="#">Link 1</a> <a href="#"><span>Link 2</span></a> <a href="#"><img src="#">Link 3</img></a> So far I have this: <script> document.getElementsByTagName("BODY")[0].addEventListener('click', function(e) { if(e.target && e.target.tagName == "A") { console.log(e.target.text); } }, false); </script> This is returning the text for link 1, but not

WPF: Asynchronous progress bar

左心房为你撑大大i 提交于 2019-12-13 14:18:36
问题 I'm trying to create a progress bar that will work asynchronously to the main process. I'm created a new event and invoked it however everytime I then try to perform operations on the progress bar I recieve the following error: "The calling thread cannot access this object because a different thread owns it" The following code is an attempt to send an instance of the progress bar to the event as an object, it obviously failed but it gives you an idea of what the code looks like. private event