event-handling

Listening for events in a UIWebView (iOS)

﹥>﹥吖頭↗ 提交于 2020-01-22 09:38:31
问题 I'm trying to listen for an event (specifically a button click) from a webpage I have opened in a UIWebView in my iOS app. I know that in other languages there are ways to attach event listeners to certain web calls, but I haven't yet found a way to do it in Objective-C. I also haven't found anyone online who says it can't be done, so I decided I should ask. I saw in the documentation that you can make Objective-C calls from Javascript, but I do not have control of the webpage I am wanting to

Listening for events in a UIWebView (iOS)

笑着哭i 提交于 2020-01-22 09:38:06
问题 I'm trying to listen for an event (specifically a button click) from a webpage I have opened in a UIWebView in my iOS app. I know that in other languages there are ways to attach event listeners to certain web calls, but I haven't yet found a way to do it in Objective-C. I also haven't found anyone online who says it can't be done, so I decided I should ask. I saw in the documentation that you can make Objective-C calls from Javascript, but I do not have control of the webpage I am wanting to

Should I use a central event bus with backbone.js?

邮差的信 提交于 2020-01-22 05:56:47
问题 I am currently working on my first backbone.js app. The concept of events is quite familiar to me but I am in question if I should use a central event dispatcher or not. Generally I see these two approaches: Directly wire event publishers and event receivers together. (I started with this approach.) Use an event bus and wire publishers and receivers to this bus. Is it favorable to use an event bus in terms of e. g. long time maintainability of the app and traceability of events? 回答1: Whether

Should I use a central event bus with backbone.js?

删除回忆录丶 提交于 2020-01-22 05:56:12
问题 I am currently working on my first backbone.js app. The concept of events is quite familiar to me but I am in question if I should use a central event dispatcher or not. Generally I see these two approaches: Directly wire event publishers and event receivers together. (I started with this approach.) Use an event bus and wire publishers and receivers to this bus. Is it favorable to use an event bus in terms of e. g. long time maintainability of the app and traceability of events? 回答1: Whether

JXTable not refreshed upon button click

五迷三道 提交于 2020-01-22 02:49:08
问题 I have a JFrame which holds a JXTable (from SwingX dependency) and a JButton . Once I click the JButton the table should get updated each time. In my case it gets updated only at the first time. Other events also get triggered on the button click (which happens each time I click the button). Only the table is not refreshed with the new rows added. I am using DeafultTableModel and have tried (explicit trigger) all suggested methods like repaint , fireTableDataChanged etc. Can someone please

Prevent refreshing / reloading a page with JavaScript

三世轮回 提交于 2020-01-21 05:14:09
问题 I know this is not recommended, but I need it because I have an iframe inside the page who has the actual content and I want that when the users hits refresh button, iframe reloads not entire page. I know I have to call onunload / onbeforeunload event, but I don't want to ask me if I want to leave the window, just don't. Is that possible? I've got handled the F5 key, but I like to prevent refreshing from button too. 回答1: UPDATE: I wrote this 5 years ago, browsers do different stuff now, you

Intercepting Tab key press to manage focus switching manually

被刻印的时光 ゝ 提交于 2020-01-20 04:18:55
问题 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? 回答1: The most elegant way I found to avoid focus change is to

How to detect ctrl-f in my SWT application

佐手、 提交于 2020-01-19 07:27:45
问题 I have written an SWT UI which has a primary function of displaying text in a StyledText control. I want to add a handler for Ctrl + F so that when that shortcut is pressed the focus is set to a search box. I have tried using the following code to detect the keypress. sWindow = new Shell(); ... sWindow.getDisplay().addFilter(SWT.KeyDown, new Listener() { @Override public void handleEvent(Event e) { System.out.println("Filter-ctrl: " + SWT.CTRL); System.out.println("Filter-mask: " + e

How to detect ctrl-f in my SWT application

孤街醉人 提交于 2020-01-19 07:27:05
问题 I have written an SWT UI which has a primary function of displaying text in a StyledText control. I want to add a handler for Ctrl + F so that when that shortcut is pressed the focus is set to a search box. I have tried using the following code to detect the keypress. sWindow = new Shell(); ... sWindow.getDisplay().addFilter(SWT.KeyDown, new Listener() { @Override public void handleEvent(Event e) { System.out.println("Filter-ctrl: " + SWT.CTRL); System.out.println("Filter-mask: " + e

Forwarding events in C#

霸气de小男生 提交于 2020-01-19 06:52:11
问题 I'm using a class that forwards events in C#. I was wondering if there's a way of doing it that requires less code overhead. Here's an example of what I have so far. class A { public event EventType EventA; } class B { A m_A = new A(); public event EventType EventB; public B() { m_A.EventA += OnEventA; } public void OnEventA() { if( EventB ) { EventB(); } } } Class A raises the original event. Class B forwards it as EventB (which is essentially the same event). Class A is hidden from other