event-handling

Form.Load event not firing, form showing

匆匆过客 提交于 2019-11-28 23:22:19
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 and the form does display and work. The form is passed three arguments in the constructor but the

C#: calling a button event handler method without actually clicking the button

橙三吉。 提交于 2019-11-28 22:32:30
问题 I have a button in my aspx file called btnTest. The .cs file has a function which is called when the button is clicked. btnTest_Click(object sender, EventArgs e) How can I call this function from within my code (i.e. without actually clicking the button)? 回答1: btnTest_Click(null, null); Provided that the method isn't using either of these parameters (it's very common not to.) To be honest though this is icky. If you have code that needs to be called you should follow the following convention:

Javafx Treeview item action event

南楼画角 提交于 2019-11-28 22:08:16
I'm trying to create a menu using a treeView. This is the first time I'm using treeView and have been reading up on it on several websites. I'm having some problems when it comes to action event. What I want to do is basically to fire and event when ever the user clicks a node in the treeview so far I have the following: TreeItem<String> rootItem = new TreeItem<String>("Navigation"); TreeItem<String> statistics = new TreeItem<String>("Statistics"); TreeItem<String> clan = new TreeItem<String>("Clan page"); clan.addEventHandler(MouseEvent, new EventHandler<MouseEvent>() { @Override public void

Changing UIButton text

隐身守侯 提交于 2019-11-28 21:43:33
问题 So I'm trying to update the text on a UIButton when I click it. I'm using the following line to change the text: calibrationButton.titleLabel.text = @"Calibration"; I have verified that the text is changing, but when I run the app and I click on the button, it changes to "Calibration" for a split second and then goes right back to its default value. Any ideas why this might be happening? Is there some sort of refresh function I need to be calling? 回答1: When laying out its subviews, a UIButton

Is there a way track the focus on tab with Javascript?

落爺英雄遲暮 提交于 2019-11-28 21:41:54
We need to track the EFFECTIVE time on site of our users Most users, when they're done, leave the tab open and move to another tab Time on site it's extremely inaccurate Is there a Javascript Event to track the "loss of focus" of the current tab ? This should work both on tab switch and on browser window losing focus: function onBlur() { document.body.className = 'blurred'; }; function onFocus(){ document.body.className = 'focused'; }; if (/*@cc_on!@*/false) { // check for Internet Explorer document.onfocusin = onFocus; document.onfocusout = onBlur; } else { window.onfocus = onFocus; window

LongClick event happens too quickly. How can I increase the clicktime required to trigger it?

纵然是瞬间 提交于 2019-11-28 21:22:55
In an application I'm working on, I have the requirement that a user must click & hold a component for a period time before a certain action occurs. I'm currently using an OnLongClickListener to listen for the longclick, but I find that the length of a click to trigger the OnLongClick event is too short. For example, let's say the LongClick event triggers after a 400ms click, but I want the user to have to click & hold for 1200ms before the event triggers. Is there any way I can configure the LongClick event to require a longer click? Or is there perhaps another construct that would allow me

Which JS event is fired when Chrome gets the download file?

谁说我不能喝 提交于 2019-11-28 21:22:23
问题 I am having a problem with onLoad event of an iframe on Google Chrome. I created an iframe and set value for its "src" attribute to get a file from server. While server is processing, a waiting box is displayed until client gets the returned file. I tried to use the onLoad event of iframe to detect when client get the file to turn off that waiting box, but on Google Chrome that event handler does not work. With Firefox, when client gets a file, a "Save to" popup will be displayed

Execute backing bean action on load?

陌路散爱 提交于 2019-11-28 20:52:03
I would like to build a results page for a report export page. This results page must display the status of the export and offer the download of this export. The export is done in an action method. I can execute it via a commandButton but it must be executed automatically on load. How can I accomplish this? JSF: <h:commandButton value="Download report" action="#{resultsView.downloadReport}"/> Backing bean: public String downloadReport() { ... FileDownloadUtil.downloadContent(tmpReport, REPORT_FILENAME); // Stay on this page return null; } Clarification: Is this feasible with a4j? I thought of

Javascript event delegation, handling parents of clicked elements?

允我心安 提交于 2019-11-28 20:40:36
http://jsfiddle.net/walkerneo/QqkkA/ I've seen many questions here either asking about or being answered with event delegation in javascript, but I've yet to see, however, how to use event delegation for elements that aren't going to be the targets of the click event. For example: HTML: <ul> <li><div class="d"></div></li> <li><div class="d"></div></li> <li><div class="d"></div></li> <li><div class="d"></div></li> <li><div class="d"></div></li> <li><div class="d"></div></li> </ul>​ CSS: ul{ padding:20px; } li{ margin-left:30px; margin-bottom:10px; border:1px solid black; } .d{ padding:10px;

ASP.NET/HTML: HTML button's onClick property inside ASP.NET (.cs)

孤人 提交于 2019-11-28 20:26:26
I just wanna find out if there's a way to put my onClick event inside .cs: <button type="submit" runat="server" id="btnLogin" class="button" onclick="btnLogin_Click();"> where Login_Click() should be inside .cs: protected void btnLogin_Click(object sender, EventArgs e) { // do something } Please do take note that I will not use ASP.NET button here, and that I will not put my Login_Click() event inside .html/.aspx so I can't 'expose' my codes. Any suggestions? Koen You can do that on any server control and this button is made a server control by defining " runat=server ". The problem is