event-handling

How to hook up a COM event dispatcher?

孤人 提交于 2019-12-10 19:58:07
问题 The VBIDE API exposes the wonderfully cryptic _dispVBComponentsEvents interface (among others), which look like something that I could use to capture various interesting events in the VBE. So I implemented the interface in a class that intends to capture the event and raise a "normal" .net event for the rest of my application to handle, like this: public class VBComponentsEventDispatcher : _dispVBComponentsEvents { public event EventHandler<DispatcherEventArgs<VBComponent>> ComponentAdded;

Lambda expression not working in setting the event-handler of some controls

痞子三分冷 提交于 2019-12-10 19:56:43
问题 I'm creating an array of controls and adding them to the form, and setting their events to a function that receives the index of the clicked button using a lambda expression ( b.Click += (sender, e) => myClick(i); ). But the problem is... Whichever you click on, you receive the index 100, not the real index of the button! What is the problem here? namespace testArrayOfControls { public partial class Form1 : Form { Button[] buttons; public Form1() { InitializeComponent(); buttons = new Button

Windows Logoff Capture with C

六月ゝ 毕业季﹏ 提交于 2019-12-10 19:50:16
问题 I am attempting to use C to capture a logoff event on a Windows Server 2008 64 bit system. Currently I am using the console logoff event code illustrated here: http://www.cplusplus.com/forum/beginner/1501/ (6th comment down by Grey Wolf, his second coding example) will be attached to the end of this post. There are several issues with this code. It works fine standalone and when the user starts the program. When I begin to add calls to some of our proprietary code it stops catching logoff

ASP.NET 2.0 TreeView - OnSelectedNodeChanged does not fire in an User Control

时光怂恿深爱的人放手 提交于 2019-12-10 19:32:09
问题 I have a small User Control defined as: <%@ Control Language="C#" AutoEventWireup="true" CodeBehind="CompanyTree.ascx.cs" Inherits="RivWorks.Web.UserControls.CompanyTree" %> <div class="PrettyTree"> <asp:TreeView runat="server" ID="companyTree" OnSelectedNodeChanged="SelectedNodeChanged" OnAdaptedSelectedNodeChanged="SelectedNodeChanged" > </asp:TreeView> <asp:Label runat="server" ID="currentParentID" Text="" Visible="false" /> <asp:Label runat="server" ID="currentCompanyID" Text="" Visible=

The best way to add eventlistener to an element

只谈情不闲聊 提交于 2019-12-10 19:31:46
问题 I'm trying to find the most productive way to hanging event. Lets imagine we have this structure: <ul> <li> 1st li </li> ... <li> 99999th li </li> <ul> So, we have about 10000 li elements and we want to add event listener to all this elements, lets say we can use jQuery too. First thought <li onclick="console.log(this)" >...</li> bad part of this solution - we have increase a size of html markup because always repeating onlick. Second thought $('ul li').on('click', function(){ console.log

How to get Magento Order data from Observer

烂漫一生 提交于 2019-12-10 19:03:39
问题 Ok, Ive searched all over the web and nothing worked. The results were very inconsistent. Let me first show you what I have here. It will create an export file in the end but unable to obtain order data and object. class Packagename_Modulename_Model_Observer { public function exportFeed (Varien_Event_Observer $observer) { $order = $observer->getEvent()->getOrder(); $ordered_items = $order->getAllItems(); and in config.xml <global> <events> <sales_order_place_after> <observers> <packagename

How come HTMLDocumentEvent onclick fires up multiple times?

╄→尐↘猪︶ㄣ 提交于 2019-12-10 19:02:15
问题 I am using Visual C# Express 2010 (.NET Framework 4.0), Windows 7 32bit. I created WinForm project which only has WebBrowser control and ListItem object that displays the html information by onclick event. My goal is to run the project and click text field in web site in the webbrowser control and display the html document info that has been clicked (such as text field tag etc) code namespace WindowsFormsApplication1 { public partial class Form1 : Form { private mshtml.HTMLDocument doc = null

WxPython - trigger checkbox event while setting its value in the code

北慕城南 提交于 2019-12-10 18:43:40
问题 Consider the following piece of code: import wx class MyFrame(wx.Frame): def __init__(self, *args, **kwds): wx.Frame.__init__(self, *args, **kwds) self.cb1 = wx.CheckBox(self, -1, "CheckBox 1") self.cb2 = wx.CheckBox(self, -1, "CheckBox 2") self.cb3 = wx.CheckBox(self, -1, "CheckBox 3") sizer = wx.BoxSizer(wx.VERTICAL) sizer.Add(self.cb1, 0, wx.ADJUST_MINSIZE, 0) sizer.Add(self.cb2, 0, wx.ADJUST_MINSIZE, 0) sizer.Add(self.cb3, 0, wx.ADJUST_MINSIZE, 0) self.SetSizer(sizer) self.Layout() self

Event Listener in Google Charts API

橙三吉。 提交于 2019-12-10 18:36:33
问题 I'm busy using Google Charts in one of my projects to display data in a table. Everything is working great. Except that I need to see what line a user selected once they click a button. This would obviously be done with Javascript, but I've been struggling for days now to no avail. Below I've pasted code for a simple example of the table, and the Javascript function that I want to use (that doesn't work). <html> <head> <script type='text/javascript' src='https://www.google.com/jsapi'></script

How to catch event when click pause/play button on MediaController

♀尐吖头ヾ 提交于 2019-12-10 17:37:23
问题 How to catch event when click pause/play button on MediaController. i try onKey,onTouch - and then i click on pause/play button on MediaController did nothing happened. 回答1: A bit of a late answer, but I posted a solution to an identical question overhere, in case you're still looking (or others that perhaps bump into this...) //Edit: ups, didn't notice someone already posted a link as comment... 来源: https://stackoverflow.com/questions/7868191/how-to-catch-event-when-click-pause-play-button