event-handling

Clarifications regarding weak references in actionscript listeners

旧时模样 提交于 2020-01-11 12:36:11
问题 I understand how weak references work, but I am bit confused regarding it's use in actionscript event listeners. Consider the example below: public class Rectangle extends MovieClip { public function Rectangle() { var screen:Shape=new Shape(); screen.addEventListener(MouseEvent.MOUSE_OUT, new Foo().listen, false, 0, true); addChild(screen); } } public class Foo extends MovieClip { public function listen(e:MouseEvent):void { trace("tracing"); } } Now here, since there is only a weak reference

WPF EventHandler fired on the wrong Element

一个人想着一个人 提交于 2020-01-11 11:22:52
问题 I am puzzled by this: I have made a very simple example: MainWindow.xaml: <Window x:Class="Test.MainWindow" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Title="MainWindow" Height="350" Width="525"> <Window.Resources> <Style TargetType="RichTextBox"> <Setter Property="Template"> <Setter.Value> <ControlTemplate TargetType="RichTextBox"> <Grid Height="100" Width="200"> <Grid.RowDefinitions> <RowDefinition/>

How to handle the event when click on empty space?

孤街浪徒 提交于 2020-01-11 05:23:25
问题 I want to catch the event when a listview is left-clicked on an empty space - i.e. clicking on no item within the listview control. I've search in the Events list of the listview but found none. How can I do this? Please help! [Edit] What I want to do if I could catch this event: Deselect all items in the listview. 回答1: If you attach a handler to the MouseLeftButtonDown event on the ListView it will only fire when areas outside of a ListViewItem are clicked. Any clicks inside the items will

jQuery Autocomplete verify selected value

点点圈 提交于 2020-01-10 07:50:09
问题 We are using the autocomplete jQuery plugin written by Jörn Zaefferer, and are trying to verify a valid option is entered. The plugin has result() event which fires when a selection is made. This is OK, but I need to check the value in the textbox when a user clicks out too. So we have tried a .change() and .blur() events, but they both pose an issue: when you click on an entry in the results div (the 'suggest' list) the .change() and .blur() events fire, and this is before the plugin has

Can't remove event listener

怎甘沉沦 提交于 2020-01-10 04:37:06
问题 Can anyone tell why bt2 event listener is not getting removed in if block. As when I remove the event listener in the p function, it's getting removed without any error or bug. I am pretty sure there might be any stack or scope problem due to which event listener is not getting removed but I can't figure out what that could be. And I know that event listener is not getting removed as with the succeeding clicks on bt2 element all the preceding event listeners are also running again, as the

Resize elements by dragging divider handler

|▌冷眼眸甩不掉的悲伤 提交于 2020-01-10 00:30:19
问题 I want to be able to drag a divider up and down to resize the divs above and below the divider on a fixed page height. These divs could be in a table, although they need not be. In short, I would like to be able to emulate what happens on the jsFiddle site, although I only need the vertical resize. jsFiddle have used mooTools, but I want to do it with jQuery. One important complication: I won't know the size of the div above the divider until it is actually built dynamically, so I can't just

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

大兔子大兔子 提交于 2020-01-09 13:58:56
问题 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> </Grid.ContextMenu> But in the event handler I cannot get know which of the objects was right-clicked: private void EditStatusCm_Click(object sender, RoutedEventArgs e) { MyCustControl SCurrent =

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

≯℡__Kan透↙ 提交于 2020-01-09 13:56:06
问题 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> </Grid.ContextMenu> But in the event handler I cannot get know which of the objects was right-clicked: private void EditStatusCm_Click(object sender, RoutedEventArgs e) { MyCustControl SCurrent =

JavaFX: How to make a Node partially mouse transparent?

霸气de小男生 提交于 2020-01-09 11:09:15
问题 Simplified Problem: Make one Node "A" that is on top of another Node "B" to be half transparent to MouseEvents, so the Events will reach the underlying Node "B". Both Nodes are of equal size but Node "A" has a half transparent background image so one half of Node "B" is visible. Real Problem: I have a menu of tabs. Each tab can be dragged to expand the corresponding menu layer. Therefore each tab layer is a Pane with a partially transparent background (basically a polygon) of which the

Calling one method from another within same class in Python

喜夏-厌秋 提交于 2020-01-09 09:22:48
问题 I am very new to python. I was trying to pass value from one method to another within the class. I searched about the issue but i could not get proper solution. Because in my code, "if" is calling class's method "on_any_event" that in return should call my another method "dropbox_fn", which make use of the value from "on_any_event". Will it work, if the "dropbox_fn" method is outside the class? I will illustrate with code. class MyHandler(FileSystemEventHandler): def on_any_event(self, event)