FAQ Database Discussion Community


How to raise Shown event in form opened using P/Invoke?

.net,vb.net,winforms,events
I need to open notification form without giving it a focus when it appears. It works fine using P/Invoke except the fact that Shown event is not getting launched. My solution is here, but is there more elegant (more generic) one? Public Shared Sub ShowInactiveTopmost(frm As Form) 'standard P/Invoke code...

Change theme based on param url

magento,events,observers
I would like to know if I can change the theme based on url parameter (or if it's too late) and if it is possible which is the right event to observe I have only found a guy who was talking about observing controller_action_predispatch but with this event I can't...

Portlet IPC after recieved Event

jsf,events,event-handling,ipc,portlet
I have a Navigation portlet which schows all Students, when a Student gets clicked im sending a event with the id of the clicked student to other portlets. Sending and receiving the event is not the problem, that works fine. What i don't get, is how to proceed with the...

Implementing EventArgs Empty Correctly

c#,events,eventargs
I'm trying to properly understand Events and EventArgs but can't quite get a handle on the whole EventArgs.Empty property. EventArgs implements: public static readonly EventArgs Empty; and allows us to create an EventHandler and call it using: public event EventHandler<EventArgs> TestHappening; private void MyMethod() { TestHappening( this, EventArgs.Empty ); }...

Visual Studio: replace default doubleclick-event

c#,winforms,visual-studio,events,attributes
I am aware of DefaultEventAttribute but I am still a bit clueless of how to implement it correctly. I have made a simple control class that inherits from NumericUpDown: public class NumericControl : System.Windows.Forms.NumericUpDown I want to use it in my project instead of a default NumericUpDown control, and I...

Force angular.element .on 'change' to call specified function on the same file

angularjs,events,jquery-selectors,document
When I select say hello.png the first time, it loads it and calls handleFileSelect() function. However, if I pick the same file again, the function won't get called until I pick another filename. How can I force it to call the function? I was thinking that the modification would be...

Center JoptionPaneMessageDialog in parent element of the source element that generated the event

java,swing,events,java-8
I need to center the JOptionPaneMessageDialog in the parent element of e.getSource. The problem is that I have two differents classes. One listener class and another class that use that listener this is the line that I need to change JOptionPane.showMessageDialog((Component)e.getSource(), "pulsado"); package excepciones; import java.awt.BorderLayout; import java.awt.Component; import java.awt.Toolkit;...

Is there an “onOpen” event for paper-dialog?

javascript,events,polymer,paper-elements
Is there an "onOpen" event for paper-dialog? I would like to know when the dialog is fully "opened" and "closed", mostly for changing content when the dialog has finishing its opening animation. Previously in Polymer 0.5 one can listen to the core-overlay-close-completed event for that. However it doesn't seem to...

Polymer 1.0 custom events

events,polymer
I was using this code on Polymer 0.5 but on Polymer 1.0 it's not working. On child element: this.fire('login-start', { username: this.username, password: this.password, me: this }); On parent element (app-main.html): <dom-module name="app-main" on-login-start="{{checkLogin}}"> And on app-main.js: checkLogin: function() { alert("This is not working."); } How do I fire and...

jquery works on its own, but fires only once inside js

javascript,jquery,events
this jquery (just below), which hides columns in tables based on dropdown selection, works. (Shoutout to the member called Oka, whose help with this code was hugely appreciated.). However it works fully only in stand-alone documents. $(document).ready(function() { $('#sel').on('change', function () { var val = $(this).val(), target = '.' +...

Trying to fire events from a Class that is within a Dictionary instantiated on the MainForm

vb.net,class,events,dictionary,raiseevent
Trying to have events raised within a class be received within the MainForm when this class is within a Dictionary. Here are some code samples. Created a Class: Public Class Zone Public _ZoneID As Integer Public _ZoneName As String Public Event ZoneEntered(ByVal intToolID As Integer, ByVal intZoneID As Integer) Public...

Flask server to notify webclient when changes occur

python,events,flask
I am building a server using Flask that will be called by a web client. When a certain change occurs on the db my Flask app interacts with, I need the web client to be alerted so it can display the update. Would someone be able to give me some...

Should all Objects that register events be IDisposable

c#,events,event-handling,destructor,idisposable
As per my understanding when an Object is no longer required it is best practice to unsubscribe all event handlers in any Objects that subscribes to events. This is done to avoid handling an event within an Object when the given Object may reside in a invalid state (no doubt...

How to detect when a specific window is closed in java

java,events,window,action,windowlistener
I'm pretty new to Java and I've tried looking this up but couldn't really find any thing that helped. I'm wondering how I could detect when a specific window is closed? I've been using windowClosing() but this applies to any window that is closed, and so the event that I...

“DOMAttrModified” event not supported by modern browser?

javascript,jquery,html,events,web
Here are the codes (Jsfiddle demo) : <a href="#">Click me!</a> <script> var a = document.body.children[0] a.onclick = function() { alert('in onlick') this.setAttribute('href', 'lala') alert('out onclick') return false } function onpropchange() { alert('onpropchange') } if (a.addEventListener) { // FF, Opera a.addEventListener('DOMAttrModified', onpropchange, false) } if (a.attachEvent) { // IE a.attachEvent('onpropertychange', onpropchange)...

When and how often does the EV_RXCHAR event fire (from WaitCommEvent)?

c#,.net,winapi,events,serial-port
I've been digging through the reference sources for the .NET SerialPort and SerialStream classes, and have found that they fire their DataReceived events by waiting on WaitCommEvent(). The event usually fires just once, when the serial port has received some amount of data. Usually when the event fires, transmission has...

Preventing double event binding in jQuery

javascript,jquery,events,binding
I have this code $(".generate").click(function() { $.getJSON("jsonfile.json").done(function(data) { if (parseInt(data)>0) { $(".mybutton").click(function() { alert(data); }); } }); }); When the "generate" button is clicked, the getJSON function is called and if data says "ok" then I can press the "mybutton" to alert the data; Only problem is if I press...

Plot hlines on fixed x values when click happens between x values

python,events,python-3.x,matplotlib,plot
On this piece of code below I'm simulating a problem that I'm currently dealing with and I've been trying to figure it out for quite some time now (I'm practicing matplotlib by the way). What it's supposed to do is: when I click somewhere on the plot a little horizontal...

Angularjs $watchCollection on $rootScope not triggered when values updated from directive

javascript,angularjs,events,angularjs-directive,angularjs-watch
I'm running into a bit of an issue solving a problem with some Angularjs functionality I'm working on. The basic idea is that I have a system where certain criteria must be met before the user is allowed to advance to the next section of the app. One example of...

How to achieve mouseleave effect with absolutely-positioned non-descendants?

javascript,jquery,events,mouseleave,mouseout
One problem with the standard mouseout event is that it fires not only when the cursor leaves the region of the screen bounded by the element's external perimeter, but also when the cursor hovers over some other element contained within this perimeter. The rationale for jQuery's mouseleave event is to...

google charts remove event listener

events,google-visualization,listener
I haven't seen much documentation and cant seem to get my code to work. the code snippet is below. I'm trying to remove the on mouse over listener but have had no success. Google charts docs has the method as such - google.visualization.events.remove Listener(listener_handler). I'm uncertain what the listener_handler actually...

Prism event aggregator Persistent Events

c#,wcf,events,prism,msmq
I have implemented Prism event Aggregators on my server where a service publishes an event and another one listens to it. My subscription code: my_aggregator.GetEvent<MyEvent>().Subscribe(Handler,true); whereas I publish my event as: my_aggregator.GetEvent<MyEvent>().Publish(Payload); The thing is that if the subscriber is alive then, everything works fine. But, lets say an event...

how to trigger click event underlying in jQuery

javascript,jquery,events
All: I have two , overlap partially, top one has class "top", bottom one has class "bottom", what I want to do is trigger both onclick event when I click the overlap area. How can I do that? The HTML is like: .bottom { width: 300px; height: 200px; position: absolute;...

jQuery - Multiple events to trigger same function but with different elements

jquery,events
jQuery Snippet: function main_call(){ jQuery("#user_registration").on('submit',function(event) { load_product_serial(); }); jQuery("#reg_submit").on('blur',function(event) { load_product_serial(); }); } function load_product_serial(){ var result = []; var prod_serial = jQuery('#reg-product-serial').val(); //fetch input value jQuery.ajax({ type: "GET", url: ajaxurl, async: false, dataType : "JSON", contentType: 'application/json; charset=utf-8', data : {action: "get_product_serial"}, //cache: false, success: function(data){ result = data;...

Load all user controls of a form on start

c#,winforms,events,user-controls
My Winform application has a main form with a tab control. In each tab there is a User Control. And each user control has Controls (such as DataGridViews, etc) that are loaded on the Load event of the user control. The problem I have is that I would like to...

Delegate with generic list signature for passing data to another form

c#,winforms,events,delegates
I'm quite new in C#, so I'm struggling with this more than two days. I hope that some one can help me out with this one. Below some simplified code from my application. I want to pass a List from Form1 to Form2 using delegate and event. How can I...

How to secure tcp connection - nodejs?

javascript,node.js,events,authentication,tcp
I have following sample code used in the tcp server var server = net.createServer(); server.on('connection', function (socket) { if(restrictedIP == sock.remoteAddress){ //How to close the particular connection safely without //affecting other connections } socket.on('data', function(data) { console.log(data); }); socket.on('close', function(data) { console.log('client disconnected'); }); }); server.listen(3000, '127.0.0.1'); Note : I...

How to code a arrival generator with a varying intensity rate

events,simulation,stochastic
This is for a simulation model: Most questions I've come about deal with how to code an generator with exponential arrival times. But I'm currently stuck on how to program a generator where the arrival rate can change within a discrete event simulation. In particular I'm stuck with the following...

Double-click event fires at window level and control level, even when it is handled within the control

c#,wpf,events
I am working on a WPF application where I have a Window level double-click event that maximizes the app window when a user double-clicks anywhere within the window. However, I also have a custom control within the app window, and a separate double-click event within the custom control. When a...

AS3 - How do you call previous currentTarget from within a different event?

actionscript-3,events
I have a dropdown menu that lets you select an item to be placed on the stage. The item is drag and droppable so I use event.currentTarget.startDrag(); to start the drag. Ok, everything works fine so far. However, I also need to be able to rotate the item while it...

jquery button scroll on click

jquery,events,scroll,click
I am making buttons, when hovered shows me border on specifiec items, which suits it's category. But I meet some problems, when there are more images, they are not visible on page, I have to scroll down. My code right now looks $(".cat1-button").hover(function () { $(".cat1").css("border", "4px solid #4f7b37"); });...

dispatch mouse out event when the mouse not out

actionscript-3,events,tooltip,mouseevent,mouseover
I created a tooltip class. When the mouse over on MovieClip it enable and when it out it disable. The movieclip containt some other movieclips. My code is that: to.addEventListener(MouseEvent.MOUSE_OVER, showTip); to.addEventListener(MouseEvent.MOUSE_OUT, hideTip); to.addEventListener(MouseEvent.MOUSE_MOVE, MoveTip); and the functions is that: private function showTip(evt: MouseEvent) { if (tip != null &&...

GUI - Linux - C - how click events are managed?

c,linux,user-interface,events
Context: Reading some GUI libraries on Linux 64. I've always used libraries (or done headless applications). Now, it is time to move on and complete my understanding. Question: I am not sure how the system knows when one clicks a button on a gui app. It seems that poll/select/epoll helps...

Events - Publish & Subscribe

c#,events,delegates
Lets say I have a class which has a static event in it. This event is subscribe by three or more different classes. [Lets say 4] Now when something noteworthy happen the event in class got raised. As 4 different classes subscribe to the event, the corresponding handler in them...

jQuery event.PreventDefault not working in User Defined Function

javascript,jquery,function,events
I am creating a function which will take in a URL and then display that URL in a light box. I am having trouble with event.preventDefault() in my function though, it says it is not a function in the error console. I have tried explicitly passing event to the function...

jQuery remove highlight only if already selected

javascript,jquery,html,css,events
This should be a very basic fix. Im wanting to remove the selected class from when clicking on an already highlighted button. I would like for only one button to be highlighted at any given time. http://jsfiddle.net/7wy7sjm5/1/ The reason I have the remove class for all of them to execute...

winforms, form has been shown, event handler [closed]

c#,winforms,events
I need to run certain code each time after form has been shown by from.Show(). I tried form_Activated(), form_Loaded(), form.Shown() ... nothing works how I want, it only runs once, the first time. Is there a simple way how to do that? Thank you.

laravel events - call another event from an event

events,laravel
My EventServiceProvider has the following, 'App\Events\EventCreated' => [ 'App\Handlers\Events\EventCreatedNotifications', 'App\Handlers\Events\EventCreatedMail' ], I want to call the EventCreatedMail event from the EventCreatedNotifications by passing parameters, is it possible to do this....

How do I know when a YouTube video has paused or finished?

javascript,jquery,events,youtube,youtube-api
I'm pulling videos onto a website via the YouTube Data API and would like to register a callback for when a video has paused or finished. Does an event fire once either of these actions take place? Is there a method that detects whether a video has paused or finished?

how to fire a keydown or keypress event

c#,winforms,events,keypress,keydown
I want key press event fire without pressing a key by user. so I use InputSimulator.SimulateKeyPress(VirtualKeyCode.VK_U); also System.Windows.Forms.SendKeys.Send("a"); that did not cause it so I use var key = Key.Insert; // Key to send var target = Keyboard.FocusedElement; // Target element var routedEvent = Keyboard.KeyDownEvent; // Event to send target.RaiseEvent(...

How to register event for TextBox end editing

c#,events,winrt-xaml
Super newbie to C# (first day coding), so please don't judge me too much if the following is really a stupid question to you. But I am looking for a way to register an event for when a TextBox end editing, which is similar textFieldDidEndEditing(_ textField: UITextField) delegate in iOS....

Event in Maya Api to capture currentTime / frame change

c++,events,callback,message,maya
I am currently developing a Maya plugin. How can I set-up a callback that gets fired each time the frame number / current time is changed in the scene ? I had a look at the MSceneMessage Class, but it doesn't seem to contain what I am looking for....

Return a value created in an event handler inside a function from the same function

javascript,jquery,events
I have an input box and a go button. When the user clicks the go button I want to compare the inserted value with another value. I am trying to acquire the input value inside a function like so function getInput(){ var entry =''; $('button.go').on('click',function(){ var entry = $(this).siblings('.input').val(); //return...

How do you start a function at a certain time in Python?

python,multithreading,events,time,condition
I have a list of timestamps, and I need to call a specific method when those timestamps are reached. Those timestamps are roughly 20ms apart. At the moment I am using busy waiting in a separate thread, but I am worried about the CPU overload. Example : while True: if...

wait for an event regulary

multithreading,events
In a program I need to wait for an event (keypress) and get it's char. after that program will continue. this progress will Repeat several time. in my first try, codes run and any character did not save. I find out I should use threading but I am not Familiar...

How do I catch a click event on a polygon in HighCharts without having the tooltip popping up

events,highcharts,polygon
I have a chart <script src="http://code.highcharts.com/highcharts.js"></script> <script src="http://code.highcharts.com/highcharts-more.js"></script> <div id="container" style="min-width: 310px; height: 400px; max-width: 600px; margin: 0 auto"></div> $(function () { $('#container').highcharts({ series: [{ type: 'polygon', data: [[153, 42], [149, 46], [166, 45]], color: '#ff0000', enableMouseTracking: true, events: { click: function(event) { alert("I am clicked"); } } }] });...

KeyDown Event is not being fired

c#,winforms,events
I have added on top of my form PictureBox & Panel and docked them to the form, and I have registered the KeyDown event, but it's not firing, why is that if the Form is the Container for both Controls?

Missing 'Text Cursor Moved' and 'Scrollbar Adjusted' events in .NET Scintilla component?

c#,.net,winforms,events,scintilla
Like the RichTextBox, I want to be able to handle events for when the vertical scrollbar has been adjusted (through slider dragging, the mouse wheel or otherwise), and for when the caret / text cursor has been moved. However, these events appear to be missing from Scintilla. How can I...

C# Process Termination notifications

c#,events,process,exit,terminate
I am currently looking for a way to delete a certain file when a specific process has closed. I've found plenty of examples for creating a process and adding an event handler for exited but I need to get notified of any processes in the system, not just those I...

Component event detection in Delphi

delphi,events,components
I am developing a DataAware component and executing some code after the database is open. This is the code I have at the moment: TMyDataAwareComponent = class(TDataAwareComponent) private { Private declarations } procedure ToBeExecutedOnAfterOpen(DataSet: TDataSet); protected { Protected declarations } public { Public declarations } constructor Create(AOwner: TComponent); override; end;...

DevForce doesn't always fire Queued Events if they are queued during a call to FireQueuedEvents

c#,events,devforce
We are running into cases where we change a property on our entity but the PropertyChanged event doesn't fire. We are doing this logic as part of a Save and so the problem seems to be the way DevForce queues events like this during a Save. Looking at the code...

Event triggered by a cell change

excel,excel-vba,events
I have a validation box that has stored in it a number of sales channels i.e "SME100", "Indirect" etc... Now I have an auto filtering system set up but I want to create an event that states, "when cell "B2" changes then activate 'Auto_Filter'". Here is what I currently have....

Windows Phone: how to handle an event from a web page in a WebView?

events,webview,event-handling,windows-phone,handler
Which callback/delegate is the one to intercept the event of a user clicking on a link within a WebView? I'd want that URL. I just need to know if it is possible and how should I do in some way.

AngularJS: Error: event is undefined (Firefox only)

angularjs,events
Even though I'm defining the event and it works in Chrome it does not work in Firefox? app.controller('lightbox_close_controller',['$scope', '$rootScope', function($scope, $rootScope){ $scope.close_rating_lightbox = function(event) { if (!$(".lightbox").hasClass("mobile_ratebox")) { event.stopPropagation(); $("#image_in_lightbox_inside").empty(); } } }]); ...

WhitEvent and AddHandler in VB

vb.net,events,addhandler
I asking myself what the differences are between Dim WithEvents EClass As New EventClass and AddHandler Obj.XEvent, AddressOf Me.XEventHandler In which context you should use the first or the second? Can anyone explain it? Thanks...

Triggering events from async/await functions in the right order

c#,events,design-patterns,asynchronous,async-await
I have problems ensuring the order of events in my asynchronous task. The class from which other async tasks inherit has the following functions and takes the EventHandlers (ExecutionProgress, ExecutionStarted, ExecutionCompleted) in the constructor arguments: public abstract Task Operation(IProgress<EventArgs> progress); public virtual void Execute() { ExecuteAsync() } private void ReportProgress(EventArgs...

Fire off an event when async javascript is loaded

javascript,events,asynchronous,onload
I'm changing my external javascript resources to be loaded asynchronously to speed up page load. To do this, I'm adding the async property to my script tags: <script async type="text/javascript" src="external.js"></script> Right before the end of the body tag I have included this code to perform callbacks: if (typeof(myFuncion) ===...

Singleton events

c#,events,design
I am refactoring some old code, where I have a lot of static events like this public static event Action Updated; public static void OnUpdated() { if (Updated != null) Updated(); } I found out what using lazy singletons is often better than using static classes: no memory is consumed...

AngularJS proper events biding with parent and child directives

javascript,angularjs,events,angularjs-directive,event-propagation
I'm trying to implement popup window and button which reveals it. I'm doing that by the means of directives: <div class="wrapper" wrapper> <div class="popup" ng-class="{'popup__active':isActive}"> Popup message </div> <button btn>Click me</button> </div> When popup is visible I need to be able to close it by clicking anywhere outside of the...

Is there a way to enclose multiple event declarations on a single [] block?

events,f#,annotations
It is a little tedious to write: let e1 = Event<_>() let e... = Event<_>() let en = Event<_>() [<CLIEvent>] member this.E1 = e1.Publish [<CLIEvent>] member this.E... = e....Publish [<CLIEvent>] member this.En = en.Publish In the code, I show how I need to write n [<CLIEvent>], 1 for each event....

How to call Form_Load of one form from another form in Access VBA

forms,vba,ms-access,events
I have a MS Access form which displays list of records in grid . Each row is having a detail buttton. When clicked on it , it opens up a new form with details of that particular selected row. When click on close button of detail form , the values...

onClick event for dropdown list meteor javascript

javascript,events,drop-down-menu,meteor
is there a way I can add a click event to a dropdown menu in Meteor? I know how to do it for buttons, but I couldn't find documentation for dropdown menus. My dropdown menu is: <td> <select id="orderStatus"> <option value="Submitted">Submitted</option> <option value="Sent">Sent</option> <option value="Complete">Complete</option> </select> </td> I want an...

brain freeze - cant catch keystrokes with javascript

javascript,events,keyboard
I know its really simple, but why doesn't this code alert on key presses? Tried with both Chrome and Firefox. <html> <head></head> <body style="height: 100%; margin: 0px; padding: 0px;"> <div style="height: 100%;" id="main">sds</div> <script> window.onload = function() { var m = document.getElementById("main"); m.onkeydown = function(event) { alert("keydown!"); }; m.focus(); };...

ExtJS 5.0 cellclick event returns incorrect column

events,extjs,datagridcolumn
I'm trying to use cellclick on a grid where based on a certain column clicked, I want to run some operations. But every time, it returns a wrong column i.e. if I click on column 0 (first col), it returns the next column. cellclick: function(view, td, cellIndex, record, tr, rowIndex,...

How to combine different event triggers

javascript,jquery,events,triggers
I am new to jQuery and hope someone can help me with this. I have a JS function that is triggered by various elements / classes with the difference that for some of them the event is triggered by a click and for others on keyup etc. So far I...

Using framework event dispatcher to raise domain event

php,events,laravel,domain-driven-design,dispatcher
When i need to raise domain events, should i use framework specific Event Dispatcher or create my own Event Dispatcher that implemented by framework event dispatcher ? Since the framework has a really nice event dispatcher and the term of DDD said the domain layer should not dependent on any...

Show what the user typed in the body

javascript,jquery,events,event-handling
I have a code and I want that after the user type something in the textfield and press enter, what he typed appears on the screen. But I'm not being able to do that, I'd like some help here guys. Thanks. <!DOCTYPE html> <html> <head> <title>Tasks for the day</title> <script...

Calculate the time between a range of key events in Python

python,events,tkinter,keyboard-events
As a part of my self learning projects, I decided to create an application in Python that listens to certain keyevents and finds the amount of time it takes to type a word. It's been more than 12 hours of straight debugging and loop/logic experiments and all I could do...

WPF CheckBox CheckChanged event

c#,.net,wpf,events,checkbox
After Checkbox.IsChecked = true, the Checked event is fired. After Checkbox.IsChecked = false, the UnChecked event is fired. But what event is fired after IsChecked = null?

Why does Source for ContextMenuOpening behave differently for Canvas and UserControl?

c#,wpf,events,contextmenu,source
I have a simple window: <Window x:Class="WpfApplication1.MainWindow" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:self="clr-namespace:WpfApplication1" Title="MainWindow" Height="435" Width="613"> <StackPanel> <Canvas Name="canvas"> <self:Red /> </Canvas> <UserControl Name="uc"> <self:Blue /> </UserControl> </StackPanel> </Window> Redand Blueare very simple UserControls: <UserControl...

ActionScript: How to listen for an event from a different XML

actionscript-3,events,flash-builder,mxml
I have a popup screen in which the player enters their name and clicks OK. When OK is clicked I want the player's name to be passed to the main XML. How can I do this? Here is the function in the main XML that handles the popup: private function...

jQuery.Event — where's my data?

jquery,events
I've got some code that looks like this (shortened): $.ajax({ url: $form.attr('action'), data: formData, type: $form.find('input[name=_method]').val() || $form.attr('method') || 'POST' }).done(function (data, textStatus, $xhr) { var eventParams = { xhr: $xhr, validator: validator }; $form.trigger($.Event('ajaxify-success',eventParams)); }); I use it like this: $('#label-form').on('ajaxify-success', function(ev) { console.log(ev); }); But ev.data is always...

Google map infowindow position

javascript,google-maps,events,infowindow
Here is a sample google map with three polygons. I am setting the infowindow for each polygon as, for (var i in coordinates) { arr = []; for (var j=0; j < coordinates[i].length; j++) { arr.push( new google.maps.LatLng( parseFloat(coordinates[i][j][0]), parseFloat(coordinates[i][j][1]) )); bounds.extend(arr[arr.length-1]) } // Construct the polygon. polygons.push(new google.maps.Polygon({ paths:...

How to handle a Button Click in C# [closed]

c#,windows,events,button
I am making a windows application with C# and I can't seem to figure out how to create a Click event handler on a button. None of the examples I have seen work and I don't understand why. Can someone please show and explain how to handle button clicks in...

IOS Swift handle global events

ios,swift,cocoa-touch,events
How can I handle global events triggered by the notification centre for example in my API class I fire an event if an error response is received e.g. (500). When that event is fired an UIAlert should be displayed on what ever view controller is active, or on logout the...

Detect if Application was suspended in OnNavigatedFrom for Windows Phone 8

c#,events,event-handling,windows-phone
Is there anyway to know in the OnNavigatedFrom if the App is navigating from this page because it is being suspended? I have event handlers that update the UI, that I dont want them unsubscribed from if I am just suspending the App

Manually triggering the ttk notebook tab change event

python,events,tabs,tkinter,ttk
I'm talking about <<NotebookTabChanged>> event that ttk.Notebook can be bound to. Say I have: def tabChanged(self, event): print "tab changed" And say I want to manually trigger this method. What I actually mean by this is, say I have a basic, tabbed GUI and there's a start button which makes...

Constantly check the length of an element and perform an action if it is ever 1

javascript,jquery,events,javascript-events,google-chrome-extension
I have an element on a page that I am constantly monitoring. If at any time that length is equal to 1, it means it exists on the page (the user has logged out) and I want to prompt them with a popup to login. So at the moment I...

how to unbind/prevent context menu by keybord (key #93) with FF?

javascript,firefox,events,contextmenu,unbind
I want to prevent the default event on key #93 ("select key", between "alt gr" and "ctrl right" on AZERTY keybord). This key open context menu like right click. I tried : $(document).off('keydown'); $(document).off('keyup'); $(document).off('keypress'); $(document).on('keypress', function(e){ if(e.keyCode == 93) { e.preventDefault(); return false; } }); $(document).on('keyup', function(e){ if(e.keyCode ==...

Prints value when clicked on but line isn't created?

python,events,python-3.x,matplotlib
I'm currently learning the matplotlib library on python 3.4. I'm practicing on a code where the user is supposed to interact with the plot only by clicking on it. When the click happens somewhere on the plot two things are supposed to happen: print out the y value and create...

jquery .data() is not attaching data to element

jquery,html,events
I would like it so when the user clicks on the "2" button (code below) a data attribute of clicked = true should appear on the button. eventually I would like it so that when user clicks on the "3" button the "2" button clicked data should be removed and...

OnDetaching function of behavior is not called

wpf,events,mvvm,memory-leaks,behavior
I have WPF behavior on specific control. When I close the window that hold the control the OnDetaching function is not called. The behavior continues to exist (because of the events to which it's registered), although the window does not exist anymore (memory leak). Why the OnDetaching function does not...

How to emit event in mongoose middleware?

node.js,events,mongoose,emit
I want to emit event when new blog saved blog.post('save',function(blog){ this.emit('newBlog',blog) }) and somewhere else in my project say app.js can listen this event EventEmitter = require('events').EventEmitter; emitter = new EventEmitter(); emitter.on('newBlog',function(blog){ console.log(blog); }) how to do this?...

Is there something like ThrottleOrMax in rx?

c#,events,system.reactive,throttling
Use case: I'm writing a thing that monitors changes and saves automatically. I want to Throttle so that I don't save more often than every five seconds. I want to save every 30 seconds if there is a continuous stream of changes. Could not find observable.Throttle(mergeTime, maxTime) in the docs...

Angular fire ng-click on row but not on href

html,angularjs,twitter-bootstrap,events,angularjs-ng-click
I've made a page with bootstrap, and i would like to have an action when the user clicks on the row. This is easy, I put ng-click on the div that is the row. However, inside the row elements I've a link, and I would like to avoid the firing...

Making JQuery function Plain JS [duplicate]

javascript,jquery,events,listener,document
This question already has an answer here: Uncaught TypeError: Object #<NodeList> has no method 'addEventListener' 3 answers Hey I have the following function which works great in JQuery, but for many reasons I require it in plain JS. $('audio').on("play pause ended", function () { document.title = document.title.replace("\u25B6", "") $("audio").each(function...

password check directive elem.add error

javascript,angularjs,validation,events,angularjs-directive
I'm making a password checking directive to ensure password and confirm_password fields are the same: angular .module('myModule') .directive('pwCheck', function() { return { require: 'ngModel', link: function (scope, elem, attrs, ctrl) { var password = "#" + attrs.pwCheck; elem.add(password).on('keyup', function() { scope.$apply(function () { ctrl.$setValidity('pwmatch', elem.val() === $(password).val()); }); }); }...

Why do I get KeyEventArgs from XAML but RoutedEventArgs from C# when I refer to the exact same KeyDown event?

wpf,xaml,events
This must be something simple but I can't seem to google it easily. e.g. <TextBox Name="blah" KeyDown="TextboxKEYDOWN"> And now C# can use an events function with KeyEventArgs available but if I do in C# blah.KeyDown += (s, r) => TextboxKEYDOWN(s, e); then TextboxKEYDOWN only gets RoutedEventArgs and complains that it...

Unity Listener/Event like OnValueChanged for GameObject properties

c#,events,unity3d
I want to call a function each time my gameObject.renderer.isVisible is set to false without using Update(){ if(gameObject.renderer.isVisible == false) FunctionToCall(); } It's quite ugly. So I was wondering how can I make a Listener/Event like OnValueChanged(bool ) for GameObject properties and scripts variables in general ? Maybe there is...

Adding Event to Control in Loop: Object reference not set to an instance of an object [duplicate]

c#,winforms,events,eventhandler
This question already has an answer here: What is a NullReferenceException and how do I fix it? 17 answers My code creates multiple forms at runtime. These forms are populated with multiple controls read from a text file. What I'm also trying to do is create actions for the...

Dependencies in forms Symfony2

php,forms,symfony2,events,entities
I'm working on a webapplication in Symfony2. I came to a point in which I need some advice/explanation from some one more advanced in Symfony. I have a part of my database that is set up as follows: I have cards that belong to a card attribute set and consists...

Setting multiple events in one ext.net button

javascript,events,extjs,ext.net
I have a form with some grids and fields. When I click on submit button, I need to send all information do database. After that, I need to redirect to other page. Actually, my code appears as so, but the redirect event is not firing. <ext:Button runat="server" Text="Finalizar" Width="150" ID="Button1"...

jqGrid onDelete event handler

events,jqgrid,delete,handler,extend
I'm using a jqGrid with datatype: 'local'. The data of the grid is being set dynamically via addRowData. I don't use the asynchronous ajax stuff such as url + datatype: json because the grid has to display only client state. Now I want to use the jqGrid delete row functionality...

VBA - Trapping events on dynamically created Textbox

excel,vba,excel-vba,events,userform
I am writing a VBA application in Excel. I have a Userform that dynamically builds itself based upon the data contained in one of the worksheets. All of the code that creates the various comboboxes, textboxes and labels is working. I created a class module to trap OnChange events for...

Location of event components in a multi class situation

c#,class,events,delegates
I am trying to understand how events should be properly constructed when you have more than one class. For instance if you have class that detects value and you want to update a text box in a form, where should the event components be placed. From what I read: Event...

event for runtime controls in c#

c#,events,runtime,controls
i try to make an controls in runtime (not one, "n" controls in runtime) but now i want to create event for every single controls i made one but it just work for the last control i create in runtime how can i create event for every controls? private void...

function wait to execute

matlab,events,delay
In Matlab functions can be started at events,but occasionally, like with the resize function, the events are called in rapid order and the function is called many times in succession, which can cause weird behavior and lag. Is there a way to have it listen for the event but only...

Error in reading Ubuntu 14.04 mouse event file (/dev/input/event3) with java programmig

java,events,ubuntu,terminal,mouse
I want to handle mouse event in Linux terminal via java programming. I wrote two program via c++ and java that they do same process. when i use c++ programming to open and read file ("/dev/input/event3"-mouse event file), there is no problem while running executable file. (Ubuntu 14.04 terminal and...

jQuery event.preventDefault() don't work unless debugging

javascript,jquery,events,javascript-events,event-handling
I am trying to use this approach in order to convert GET parameters to POST. I also want the anchor to be properly handled even if the middle mouse button is clicked. This is how I did the the event handlers binding: $(document).ready(function () { $(".post").each(function(){ $(this).mousedown(function(evt){ switch(evt.which){ case 1:...

C# Controlling the number of times fired

c#,events
I'm probably over complicating this but I've been stuck and I find myself coding up really silly solutions to this issue anyway. Here's the scenario. I've got a stream of numbers coming in. 1,2,3,4,5,6,6,6,5,6 etc.... private void NotifyAlert(int p) { EventHandler<DataEventArgs> handler = Value; if (handler != null) { handler(this,...