event-handling

Create event handler for OnScroll for web browser control

这一生的挚爱 提交于 2019-11-29 05:11:56
Has any one successfully trapped the event of mouse scroll in a web browerser component? I have two web browser controls i would like to scroll at the same time. But there are no scroll events for web browsers. I would like to create an event something like this below? has any one done or seen this before? private void webCompareSQL_DocumentCompleted(object sender, WebBrowserDocumentCompletedEventArgs e) { Document.Window.AttachEventHandler("OnScroll"); } Here i would call my event and proceed with the code. private void windowEvents_OnScroll() { int nPos = GetScrollPos(webCompareSQL.Handle,

VBA trigger macro on cell value change

北城余情 提交于 2019-11-29 05:09:05
This should be simple. When the value of a cell changes I want to trigger some VBA code. The cell (D3) is a calculation from two other cells =B3*C3 . I have attempted 2 approaches: Private Sub Worksheet_Change(ByVal Target As Range) If Target.Column = 4 And Target.Row = 3 Then MsgBox "There was a change in cell D3" End If End Sub Since the cell is a calculation this is not triggered when the value changes, because the calculation remains the same. I also tried: Private Sub Worksheet_Calculate() MsgBox "There was a calculation" End Sub But I have multiple calculations on the sheet and it

Intercepting Tab key press to manage focus switching manually

帅比萌擦擦* 提交于 2019-11-29 04:53:47
I want to intercept Tab key press in my main window to prevent Qt from switching focus. Here's what I've tried so far: bool CMainWindow::event(QEvent * e) { if (e && e->type() == QEvent::KeyPress) { QKeyEvent * keyEvent = dynamic_cast<QKeyEvent*>(e); if (keyEvent && keyEvent->key() == Qt::Key_Tab) return true; } return QMainWindow::event(e); } This doesn't work, event isn't called when I press Tab . How to achieve what I want? The most elegant way I found to avoid focus change is to reimplement in your class derived from QWidget the method bool focusNextPrevChild(bool next) and simply return

Getting Matlab handles events or properties

余生颓废 提交于 2019-11-29 04:49:14
The question How may I get the list of events and properties for a handle of double type, as a figure , axes ? The issue Matlab documentation says to you to use the WindowButtonDownFcn , WindowButtonMotionFcn , and so on in order to listen to whatever happens at your interface. The issue is that this properties are very limited as the following fact : Keeping Variables in Scope When MATLAB evaluates function handles, the same variables are in scope as when the function handle was created. (In contrast, callbacks specified as strings are evaluated in the base workspace.) This simplifies the

How to make tkinter repond events while waiting socket data?

纵然是瞬间 提交于 2019-11-29 04:47:28
I'm trying to make the app read data from a socket, but it takes some time and locks the interface, how do I make it respond to tk events while waiting? Thats is easy! And you don’t even need threads! But you’ll have to restructure your I/O code a bit. Tk has the equivalent of Xt’s XtAddInput() call, which allows you to register a callback function which will be called from the Tk mainloop when I/O is possible on a file descriptor. Here’s what you need: from Tkinter import tkinter tkinter.createfilehandler(file, mask, callback) The file may be a Python file or socket object (actually, anything

OnTouch in MapView only fires the first time

这一生的挚爱 提交于 2019-11-29 04:39:33
I'm trying to implement a double-tap zoom like function in my MapView. The event always fires the first time, but never subsequent times. Below is my code. I have a feeling it has something to do with the map controller getting lost after the first time the event is fired. import android.os.Bundle; import android.view.MotionEvent; import android.view.View; import android.view.View.OnTouchListener; import com.google.android.maps.MapActivity; import com.google.android.maps.MapController; import com.google.android.maps.MapView; public class mainmap extends MapActivity implements OnTouchListener{

When to wire up event handlers asp.net

只愿长相守 提交于 2019-11-29 04:35:25
Let's say we have a pretty standard form with a textbox and a button (for simplicity). You want to handle a Click event and do some stuff based on user's input. I was wondering, does it matter, when exactly you wire up an event handler for the Click event in a code-behind? If it does, where is the best place to put it? Page load? Page init? I've tried both places, but didn't notice any difference. Or it's just a personal preference of the programmer? I've already searched the internet couple of times, but haven't found any satisfactory answer. I know when the actual method execute, just not

JavaFX 2 TextArea: How to stop it from consuming [Enter] and [Tab]

女生的网名这么多〃 提交于 2019-11-29 04:26:38
I want to use a JavaFX TextArea as though it were exactly like a multi-line TextField. In other words, when I press [Tab] I want to cycle to the next control on the form and when I press [Enter] I want the Key.Event to go to the defaultButton control (rather than be consumed by the TextArea). The default behavior for TextArea is that [Tab] gets inserted into the TextArea and [Enter] inserts a new-line character. I know that I need to use EventFilters to get the behavior that I want, but I'm getting it all wrong. I don't want the TextArea to consume these events ... I just want it to let them

How to remove all Click event handlers? [duplicate]

限于喜欢 提交于 2019-11-29 04:26:32
Possible Duplicate: How would that be possible to remove all event handlers of the Click event of a Button? I want to remove all click event handlers from a button. I found this method in Stack Overflow question How to remove all event handlers from a control . private void RemoveClickEvent(Button b) { FieldInfo f1 = typeof(Control).GetField("EventClick", BindingFlags.Static | BindingFlags.NonPublic); object obj = f1.GetValue(b); PropertyInfo pi = b.GetType().GetProperty("Events", BindingFlags.NonPublic | BindingFlags.Instance); EventHandlerList list = (EventHandlerList)pi.GetValue(b, null);

How can I dynamically inject code into event handlers in Delphi?

浪尽此生 提交于 2019-11-29 04:23:49
For debugging / performance tests I would like to dynamically add logging code to all event handlers of components of a given type at run time. For example, for all Datasets in a Datamodule, I need to run code in the BeforeOpen and AfterOpen events to capture the start time, and to log the elapsed time in AfterOpen. I would prefer to do this dynamically (no component subclassing), so that I can add this to all existing datamodules and forms with minimal effort only when needed. Iterating all components and filtering by their type is easy, but for the components which already have event