event-handling

How to reference ObservableCollection from WPF ListView SelectionChanged event handler?

In WPF app I have a ListView which is connected with ObservableCollection ShQuCollection through databinding: <ListView Name="ShSelList" ItemsSource="{Binding Source={StaticResource myDataSource},Path=ShQuCollection}" SelectionChanged="ShSelList_SelectionChanged"> <ListView.View> <GridView> <GridViewColumn Header="Co...

jquery firefox stopPropagation()

Hi, I'm binding two event handlers to an input field on 'keydown'. If the enter key has been pressed, the first event handler needs to stop the propagation of the event so that it doesn't hit the second eventhandler. I'm doing it like so: if (jQuery.browser.msie) { event.cancelBubble = true; } else ...

How to reference right-clicked object in WPF Context Menu item click event handler?

In WPF application there is a Grid with a number of objects (they are derived from a custom control). I want to perform some actions on each of them using context menu: <Grid.ContextMenu> <ContextMenu> <MenuItem Name="EditStatusCm" Header="Change status" Click="EditStatusCm_Click"/> </ContextMenu> ...

Should I add control event handlers programmatically within Page_Init?

I want to add event handlers programmatically to the server controls rather than using their predefined OnClick properties, etc. But which would be considered a better practice for defining handlers: Define them in Page_Init Define them in Page_Load ...and why? ...

How g_main_loop works in gtk programming ?

I am new to GTK+ programming. I came across an API called g_main_loop(). I have used it in my code but I am still unaware that how exactly it works. Can somebody explain g_main_loop() with small code snippet? ...

bind event to generated html link

Hi I generate in a foreach loop html links ("test which I add to a pre defined literal. How can I add a void to the generated html link? I tried with runat server and onclick.. but does not work.. Goal is to add by the onclick a pre defined void from a API. Thank you. ...

OnLoaded vs. Window_Loaded / event handler versus overriding

What's better: Private Sub Window_Closed(sender As Object, e As EventArgs) Handles Me.Closed 'Do stuff End Sub Protected Overrides Sub OnClosed(ByVal e As System.EventArgs) MyBase.OnClosed(e) 'Do stuff End Sub I personally think that the second is better, 1st because it doesn't add a handler, and also because the synta...

Prevent disabled UIButton from propagating touch events

My application has two overlapping UIButtons. The top button may be disabled at times. However, in this case any touch events it receives seem to be passed down to the underlying view, which in my case is the other button. What I need is the top button intercepting all touches and preventing them from reaching the bottom button, even in...

Creating Buttons Dynamically, Could I select one and deselect the other buttons?

I'm creating buttons dynamically ... for(int i=0; i<colSize;i++){ final Button btn = new Button(this); btn.setText(SectionName[i]); btn.setTextSize(10); btn.setPadding(8, 3,8, 3); btn.setTextColor(Color.WHITE); btn.setTypeface(Typeface.SERIF, Typeface.BOLD); btn.setOnClickListener(new OnClic...

How do I create a custom event class in Javascript?

How do I create a custom event class similar to ActionScript? What I mean by that is a class that I can use to fire off my own events, send the necessary data. I don't wanna use third-party libraries like YUI or jQuery to do it. My goal is to be able to send a event that looks like this. document.addEventListener("customEvent", eventHa...

MouseBinding overrides EventBindings in style

Hello I created a named style on an image, and in the style I set an EventBinding for the MouseDown event to a handler at the ResourceDictionary's code-behind, it worked good. When I use the image as the following: <Style TargetType="{x:Type Image}" x:Key="ImageStyle"> <EventSetter Event="MouseDown" Handler="Image_MouseDown"/> </S...

Event handlers in XAML or Code Behind

I am new to Silverlight and XAML. While trying to learn the syntax and best practices I continue to come across a discrepancy (or at least to me it seems that way) in the way some implement event handlers. In an example from MSDN I see the following code used: <UserControl x:Class="DragAndDropSimple.Page" xmlns="http://schemas.mic...

How do you get the control that was clicked to open a ContextMenuStrip?

I'm using a ContextMenuStrip for multiple controls and I'm trying to figure out the best way to get the control that was actually clicked on to open the Context Menu. The sender just gives the ToolStripMenuItem reference, which has an Owner property that references the ContextMenuStrip, but I cannot figure out how to tell which control ...

Respond to events in other JPanels

Ok so lets say I have 3 Jpanels - 1 parent and 2 Children //Assume necessary imports etc parent is something like: public class ParentPanel extends JFrame { private JPanel mainPanel,controlPanel; public ParentPanel(){ MainPanel pp= new ParentPanel(); controlPanel cp = new controlPanel(); } ... Main Panel in real thing is ...

Which event-driven applications are implemented in Haskell?

I've been looking at Haskell lately and it seems like a very nice way to watch programming problems from an alternative point of view - alternative to my usual imperative (I have a strong C++ background) view, at least. However, all the articles I see seem to deal with the same kinds of programming problems: Parsers Compilers Numeric ...

Which event is fired before current record changes in ADOQuery and how NOT to change the current record?

In my application, there are these data components linked like so: DBGrid > (DataSource > ADOQuery > ADOConnection) DBNavigator > (DataSource > ADOQuery > ADOConnection) Whenever the user selects a different row from the DBGrid, or uses the DBNavigator, the ADOQuery's current record changes. Fine, but when the user makes some changes ...

How can I catch both single-click and double-click events on WPF FrameworkElement?

I can catch a single-click on a TextBlock like this: private void TextBlock_MouseDown(object sender, MouseButtonEventArgs e) { MessageBox.Show("you single-clicked"); } I can catch a double-click on a TextBlock like this: private void TextBlock_MouseDown(object sender, MouseButtonEventArgs e) { if (e.LeftButton == MouseButtonS...

Running expensive operations on ObservableCollection.CollectionChanged

In my model I need to be made aware when a particular collection is changed so I am subscribing to the CollectionChanged event of the ObservableCollection. This is working really well except that the operation is fairly resource expensive. So when client code does: foreach(Item i in longList) { model.ObservableCollection.Add(i); } ...

Listing the event handlers for a wxPython window

I have a wxPython window. How can I check its event handler table? (i.e. which handler is handling each event.) ...

Flex Event Blocked by Another Object

I am using a box element to add a transparent overlay to a column of buttons. I want to add a click event to the buttons. However, when you click a button the click event is only triggered on the overlaying box. Is there anyway to pass the event to the underlying button or perhaps a better way to display an overlay without blocking the c...