event-handling

Difference between event handlers and callbacks

旧城冷巷雨未停 提交于 2019-12-02 13:57:39
What is the difference between an event handler and a callback function? James Anderson Generally speaking, a 'callback' is under the control of the detecting process. So you tell a GUI manager "call myaction when this button is pressed" and the GUI manager calls the action when the button is pressed. Event Handlers on the other hand operate at one step removed. The GUI manager is configured to send messages to an event handler. You tell an event manager that button pushes are handled by the myaction program. When the button is pushed the GUI manager puts a message on the event handler's queue

Dynamic created Buttons VB.Net with Loop

╄→尐↘猪︶ㄣ 提交于 2019-12-02 13:25:01
问题 I have a very strange Problem with dynamic created Buttons in VB.NET: The Click Event is not fired when creating them in a Loop. Here is my code: Panel1.Controls.Clear() For i As Integer = 0 To 100 Step 1 Dim b15 As new Button b15.Text = "Test3" b15.id = "a" & i AddHandler b15.Click, AddressOf updateFunc Panel1.Controls.Add(b15) Next This one doesn't work (only the PageLoad is fired, not the Click Event), but when i type Dim b14 As New Button b14.Text = "Test" b14.id = "asdf" AddHandler b14

How to get tcmid of currently logged user in Tridion?

故事扮演 提交于 2019-12-02 13:23:01
private void Subscribe() { EventSystem.Subscribe<User, LoadEventArgs>(GetInfo, EventPhases.Initiated); } public void GetInfo(User user, LoadEventArgs args, EventPhases phase) { TcmUri id = user.Id; string name = user.Title; Console.WriteLine(id.ToString()); Console.WriteLine(name); } I wrote above code and add the assembly in config file in Tridion server but no console window is coming on login of a user The event you were initially subscribing to is the processed phase of any identifiable object with any of its actions, that will trigger basically on every transaction happening in the SDL

Identify who invokes Event Handler

房东的猫 提交于 2019-12-02 12:24:41
问题 I have my app with my labels written to centralize when its text was modified. To make that I invoke a method through an EventHandler. I want to use same method to each one of my labels, but I don´t know how to identify in the method which label invoke it. If I have a code like this: lbl_TextChanged(object sender, EventArgs e) { ..code.. label1.Location = new Point("label's location"); ..more code.. } and I invoke again that method from another label, how could I modify that code in order to

initializeCulture of pages fires before the selectedIndexChange of dropdownlist in masterPage

99封情书 提交于 2019-12-02 11:42:17
I have a masterpage with a language selector dropdownlist it has multiple subpages using the masterpage but, in the subpages (i created a basePage class which i then let the pages inherit from) i override the initializeCulture. like this: protected override void InitializeCulture() { String selectedLanguage = Common.SessionManager.Language; if (selectedLanguage == "") { selectedLanguage = ConfigurationManager.AppSettings.Get("defaultLanguage"); } if (selectedLanguage == "") { selectedLanguage = "nl-BE"; } UICulture = selectedLanguage; Culture = selectedLanguage; Thread.CurrentThread

How to read input in a html page with javascript without focus in one field

此生再无相见时 提交于 2019-12-02 11:19:17
I want to ask how can someone read keystrokes while in a html page without having focus in a particular field. Is there some event that i can hook a method that reads input? Thanks in advance. PS. We use JQuery if that helps. Use document.onkeypress (or the siblings onkeydown and onkeyup ): document.onkeypress = function (event) { ... }; jQuery offers for these events, e.g., $(document).keypress (function (event) { ... }); This will catch all key press events on your site. Inside the function you can get the numeric code of the pressed key with event.keyCode . Be aware, that there are some

Capturing Javascript Alert in Webbrowser Control

家住魔仙堡 提交于 2019-12-02 11:15:01
Using the webbrowswer control to cruise a site. Sometimes errors occur which involve a javascript popup box. I would like to do a couple of things when this happens. Know when a javascript alert popups up. I have used the LostFocus event with some success but anytime it losses focus that code runs which is annoying. I would like to know the exact text that the alert box says. I am not sure where to find the alert box object or cast it for use in C#. I looked all over the internet and couldn't find it. Any one any clue? If you're looking to only trap script error dialogs that appear, I would

How to override the dragging events in C3.js

守給你的承諾、 提交于 2019-12-02 10:59:34
问题 I am currently trying to implement a zooming feature that is slightly different from the one that already exists. Actually, I would like that if a user clicks and drags on the graph it zooms on the so defined domain. I would like to do it that way because with the mouse wheel it prevents the user from the page up/down. As it doesn't seem to be possible with the C3.js API , I tried to implement the drag event by following this little walkthrough on D3.js Drag Behaviour. However, I didn't

Expose all event handlers of UserControl

给你一囗甜甜゛ 提交于 2019-12-02 10:56:40
I have a bunch of TextBoxes in my WinForm UserControl. Each of those text boxes has few event handlers such as On_Enter - show ListBox with suggestions, On_KeyUP - if Keys.Code == Keys.Enter - SelectNextControl(). When I place that control in a Form, none of those events fire up. How to expose all those events to the containing form? How to make UserControl's events fire up event handlers of that UserControl? Ben So, if I understand correct, I think there are 2 ways you can proceed: Approach 1 In the UserControl, set the Modifiers property of each textbox (or the ones you are interested in) to

JXTable not refreshed upon button click

旧巷老猫 提交于 2019-12-02 10:39:33
I have a JFrame which holds a JXTable (from SwingX dependency) and a JButton . Once I click the JButton the table should get updated each time. In my case it gets updated only at the first time. Other events also get triggered on the button click (which happens each time I click the button). Only the table is not refreshed with the new rows added. I am using DeafultTableModel and have tried (explicit trigger) all suggested methods like repaint , fireTableDataChanged etc. Can someone please help? EDIT-1 (code snippet added): - // the actions will take place when VALIDATE button is clicked