event-handling

C# dynamically add event handler

ぃ、小莉子 提交于 2019-12-18 04:30:15
问题 Hi i have a simple question. here is my code: XmlDocument xmlData = new XmlDocument(); xmlData.Load("xml.xml"); /* Load announcements first */ XmlNodeList announcements = xmlData.GetElementsByTagName("announcement"); for (int i = 0; i < announcements.Count; i++) { ToolStripMenuItem item = new ToolStripMenuItem(); item.Name = announcements[i].FirstChild.InnerText; item.Text = announcements[i].FirstChild.InnerText; /* HERE IS WERE I NEED HELP */ item.Click += new EventHandler(); this

Create event handler for OnScroll for web browser control

非 Y 不嫁゛ 提交于 2019-12-18 04:24:18
问题 Has any one successfully trapped the event of mouse scroll in a web browerser component? I have two web browser controls i would like to scroll at the same time. But there are no scroll events for web browsers. I would like to create an event something like this below? has any one done or seen this before? private void webCompareSQL_DocumentCompleted(object sender, WebBrowserDocumentCompletedEventArgs e) { Document.Window.AttachEventHandler("OnScroll"); } Here i would call my event and

JavaFX 2 TextArea: How to stop it from consuming [Enter] and [Tab]

时光毁灭记忆、已成空白 提交于 2019-12-18 04:15:06
问题 I want to use a JavaFX TextArea as though it were exactly like a multi-line TextField. In other words, when I press [Tab] I want to cycle to the next control on the form and when I press [Enter] I want the Key.Event to go to the defaultButton control (rather than be consumed by the TextArea). The default behavior for TextArea is that [Tab] gets inserted into the TextArea and [Enter] inserts a new-line character. I know that I need to use EventFilters to get the behavior that I want, but I'm

C# Drag and Drop From listBox

早过忘川 提交于 2019-12-18 03:48:21
问题 I'm trying to build a simple interface that allows users to drop files into a listBox to add them to a process, and to drag them out to remove them. Everything is working fine, but I'd like to add one feature to make it just a tad more sophisticated. Right now, I have the removal of the item tied to the DragLeave event, which means that as soon as the mouse leaves the box, the item is removed. But I'd like for users to be able to change their minds. In other words, if they realize they're

Hide MAAttachedWindow when clicking outside

梦想与她 提交于 2019-12-18 03:46:23
问题 I'm using an MAAttachedWindow to display a custom window under a NSStatusItem in the Menubar. Everything works fine, but I can't find an easy way to hide it when the user clicks outside of the window. I want to implement this behavior because it's what the user expects. This is the code used to display the MAAttachedWindow : - (void)toggleAttachedWindowAtPoint:(NSPoint)pt { if (!self.attachedWindow) { self.attachedWindow = [[MAAttachedWindow alloc] initWithView:logView attachedToPoint:pt

Event handler in DataTemplate

心不动则不痛 提交于 2019-12-18 03:32:39
问题 I have WPF ComboBox inside a data template (a lot of comboboxes in listbox) and I want to handle enter button. It would be easy if it was e.g. a button - I would use Command + Relative binding path etc. Unfortunately, I have no idea how handle key press with a Command or how to set event handler from template. Any suggestions? 回答1: You can use the EventSetter in the style you are setting the template with: <Style TargetType="{x:Type ListBoxItem}"> <EventSetter Event="MouseWheel" Handler=

Android clickable layout

时光总嘲笑我的痴心妄想 提交于 2019-12-18 02:41:34
问题 I've got a linear layout that i have set true to be clikable + focus, But the problem is there is no focus displayed when clicked. How can i get the focus to be displayed. Heres my code <LinearLayout android:id="@+id/linear_tv_layout" android:orientation="horizontal" android:layout_width="fill_parent" android:layout_height="fill_parent" android:layout_weight="1" android:clickable="true" android:focusable="true" android:paddingBottom="7px"> 回答1: I think you need to set as background for the

Form.Load event not firing, form showing

馋奶兔 提交于 2019-12-18 02:20:14
问题 I fear that there is something obviously wrong with my code, but I have come across a situation where the Form.Load event is not firing when I create and show my form. The form is not subclassed (as I've seen some problems with that in some searches), and I am not getting any errors thrown when I step through the code in the debugger. I have a break point set on the IDE-created form load function (which does have the Handles MyBase.Load signature suffix) but the breakpoint is never reached

Form.Load event not firing, form showing

人盡茶涼 提交于 2019-12-18 02:20:05
问题 I fear that there is something obviously wrong with my code, but I have come across a situation where the Form.Load event is not firing when I create and show my form. The form is not subclassed (as I've seen some problems with that in some searches), and I am not getting any errors thrown when I step through the code in the debugger. I have a break point set on the IDE-created form load function (which does have the Handles MyBase.Load signature suffix) but the breakpoint is never reached

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

送分小仙女□ 提交于 2019-12-18 02:01:27
问题 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 == MouseButtonState.Pressed) { if (e.ClickCount == 2) { MessageBox.Show("you double-clicked"); } } } But how do I catch them both on a single TextBlock and differentiate between the two