问题标签 [eventhandler]

For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.

0 投票
1 回答
865 浏览

c# - 事件处理程序后 DataGridView 行数为 0

我在动态构建 DataGridView 和一组单选按钮时遇到了一个非常奇怪的问题。我在面板中有一组单选按钮和一个 DataGridView。我遇到的问题是我正在尝试使用某些单选按钮上的事件处理程序来获取 DataGridView 中的行数。我使用的 DataTable 有 3 行。您可以重新创建此问题,手动将行添加到 DGV,这没关系。当我在初始化 DataGridView 后调用 rows.count 时,它按计划工作并返回 3,但是当触发 EventHandler 时,返回的行数为 0。我的代码如下:

这真的让我很困惑,但如果我弄清楚了,我一定会在这里学到一些东西。我不知道这是否与 DGV 和单选按钮位于面板内的事实有关,我不知道...感谢您对此提供的任何帮助并帮助我学习!

0 投票
1 回答
83 浏览

matlab - save data to popupmenu

I have a popup-menu that has an option, add own material, and when this is chosen, a pushbutton is enabled that say SAVE. I alose have a bunch of edit-boxes.

What I want to do is to make a callback so whenever I click the SAVE, the data from one of the textboxes will possible to select in the popupmenu. when this is selected, I want to set the other edit-boxes to contain the same data that they did when I clicked the save button.

Thanks in advance

0 投票
1 回答
1239 浏览

java - Bukkit - EventHandler 方法出错

@EventHandler出于某种原因,当我对注释执行某些操作时,我收到了一个错误。我正在使用 Bukkit 1.7.9。这是我的代码的一部分:

这是我的错误日志:

关于我做错了什么有什么建议吗?

0 投票
2 回答
56 浏览

javascript - scope Issue seeing object methods

I have tried searching through a lot of S.O. pages but nothing has touched EXACTLY on this top while also NOT USING JQUERY.... I am trying to stick to pure JavaScript as I want to learn it 115% before advancing my current knowledge of JQuery.

I have an object called ScreenResizeTool like this...

and a method like this...

My trouble is probably obvious to an experienced JavaScript user but I am having trouble not making this into a messy dirty awful OOP set. I have done various tests to show and prove to myself that the this inside the addEventHandler changes when it becomes bound to the window. This much I assumed before testing but I was able to see that once window.resize event happens the listen method is gone and not a part of the global window variable....

I have also tried adding a this capture such as this.me = this inside the object constructor however it also couldn't see the me variable once it ran. Once the window took the function over it no longer knew anything about the me variable or any reference to my class methods....

I am aware that I could separate this differently but my goal here is to learn how to fully encapsulate and use as many clean OOP structures as possible as I just came from the .NET world and I need it in my life.

I am also aware that I could make messy calls and or store this object or access to the methods inside the window variable but that seems outright wrong to me. I should be able to fully encapsulate this object and have its events and methods all implemented in this class structure.

I also know that the currImg variable is not going to be seen either but lets start small here. I assume once I figure out my incorrect train of thought on scope for JavaScript I should be fine to figure out the currImg problem.

I know there's 1000 JavaScript programmers out there waiting to rip me a new one over asking this simple question but I gotta know...

Thoughts anyone?

0 投票
2 回答
2359 浏览

c# - 使用 Telerik RadGrid 的 OnRowClick 以及自定义用户控件事件处理程序

我在 C# 的 Web 用户控件中填充了 Telerik RadGrid,它有一个客户端 OnRowClick 事件,该事件在我的用户控件客户端的 Javascript 中发生。这很好用。

我还有一个名为 ControlClick 的事件,它与我想在 Web 窗体上触发的用户控件相关联。ControlClick 在我的 UserControl 的 CodeBehind 中绑定到 OnControlClick,然后绑定到我的 Web 窗体中的用户控件。

OnRowClick 事件触发没有问题,但 ControlClick 事件永远不会触发,所以我从不进入我的 Web 窗体函数来处理单击 RadGrid 中的某些内容时的行为。

我不确定我是否错误地实现了我的事件,或者它是否与我已经将点击行为绑定到带有 RadControl 的东西的事实有关。有人有想法么?

干杯!

代码段

RadGrid 的东西:

在我的 UserControl 的 CodeBehind 中:

在我的主页标记中

在我的主页 CodeBehind 中:

编辑:这是我的 RowClickEvent:

0 投票
1 回答
208 浏览

eventhandler - 每次发布作业失败时如何在项目事件处理程序 onPublishing 中发送电子邮件?

当项目没有基线时,我已经制作了事件处理程序以取消正在发布的项目。每次发生时,我都必须通知项目所有者。每次发布作业失败时,我需要什么代码让它发送电子邮件?

谢谢回答。

0 投票
1 回答
756 浏览

c# - 列表更改时的事件

我有一个事件,每当我的列表中的项目发生更改时就会触发该事件,并且当触发此事件时,我会调用一个方法来处理此列表。当列表中有 5 个新项目时,我的方法被调用 5 次,foreach 新元素,但我只需要处理最后一个事件。我该如何解决这个问题?

然后在方法中:

如果我的通信中有 5 个新项目,ListItemsChanged 事件会被触发 5 次,但我只需要最后一个事件,因为我不必做同样的工作大约 5 次

希望这会有所帮助

0 投票
1 回答
72 浏览

javascript - 使用 EventHandler 动态添加 onsubmit 时,如何创建与 onsubmit="return groupAdd()" 相同的功能?

用于仅onclick使用 a 添加事件button并收集数据,甚至不需要 a form element,但HTML5您可以利用用户提交表单时显示的错误检查和默认消息。

由于类型是email并且存在一个require属性,因此浏览器将检查结构良好的电子邮件地址onsubmit。如果值失败,则输入下方会显示一条消息,指示用户必须修复该值。

例如,您还可以使用正则表达式

你一起拥有

当我动态生成表单元素时,我需要附加一个事件处理程序:

我想保留默认提交功能的原因是内置的 HTML5 功能。

使用 EventHandler 动态添加取消提交时,如何创建与 onsubmit="return groupAdd()" 相同的功能?

0 投票
4 回答
2428 浏览

c++ - C++ - 如何在应用程序退出时执行命令?

我对 C++ 很陌生,最近开始了一个项目,我需要访问一个设备,收集某些数据并将其转发到本地网络上的数据流。

虽然我的应用程序执行所有需要它的功能,但它缺少功能:当我关闭正在运行应用程序的窗口时,它不会停止硬件设备。结果是,每次我完成程序时都必须进行硬件重置。这不仅不方便,而且对于程序的预期用途来说是不可能的。

我基本上只是想为一个函数设置一个回调,即在程序关闭时执行(通过单击 x、按 Alt-F4 等)

这可能吗?我可以为此类事件创建处理程序:

如果这是一个正确的方法,我想知道如何使用这个处理程序?我是否需要在我的程序中创建这样的处理程序并且不断更新?

我很感谢乔纳斯的任何帮助

0 投票
1 回答
1181 浏览

jaxb - jaxb - 如何知道何时调用事件处理程序(在验证期间)

我正在使用 JAXB 解析 XML,并创建了一个事件处理程序,如果验证出现问题,它将显示错误。

事件处理程序被调用并打印出错误;如果调用事件处理程序(在打印输出之后?),我如何抛出异常?

在代码中,我不知道何时调用事件处理程序,它只是在验证错误时调用;我需要在事件处理程序返回后将文件移动到 /dir/ 的能力。


我的事件处理程序如下所示:

处理时,我的代码如下所示: