Search Results

Search found 20074 results on 803 pages for 'click upvote'.

Page 17/803 | < Previous Page | 13 14 15 16 17 18 19 20 21 22 23 24  | Next Page >

  • Checking if a RoutedEvent has any handlers

    - by AK
    I've got a custom Button class, that always performs the same action when it gets clicked (opening a specific window). I'm adding a Click event that can be assigned in the button's XAML, like a regular button. When it gets clicked, I want to execute the Click event handler if one has been assigned, otherwise I want to execute the default action. The problem is that there's apparently no way to check if any handlers have been added to an event. I thought a null check on the event would do it: if (Click == null) { DefaultClickAction(); } else { RaiseEvent(new RoutedEventArgs(ClickEvent, this));; } ...but that doesn't compile. The compiler tells me that I can't do anything other than += or -= to an event outside of the defining class, event though I'm trying to do this check INSIDE the defining class. I've implemented the correct behavior myself, but it's ugly and verbose and I can't believe there isn't a built-in way to do this. I must be missing something. Here's the relevant code: public class MyButtonClass : Control { //... public static readonly RoutedEvent ClickEvent = EventManager.RegisterRoutedEvent("Click", RoutingStrategy.Bubble, typeof(RoutedEventHandler), typeof(MyButtonClass)); public event RoutedEventHandler Click { add { ClickHandlerCount++; AddHandler(ClickEvent, value); } remove { ClickHandlerCount--; RemoveHandler(ClickEvent, value); } } private int ClickHandlerCount = 0; private Boolean ClickHandlerExists { get { return ClickHandlerCount > 0; } } //... }

    Read the article

  • WinForms Taskbar Icon - Click Event not firing

    - by Greycrow
    I have created a non-form c# program that uses the NotifyIcon class. The text "(Click to Activate)" shows up when I hover the mouse. So I am getting some events handled. However, The "Click" event does not fire and the Context menu doesnt show up. public class CTNotify { static NotifyIcon CTicon = new NotifyIcon(); static ContextMenu contextMenu = new ContextMenu(); static void Main() { //Add a notify Icon CTicon.Icon = new Icon("CTicon.ico"); CTicon.Text = "(Click to Activate)"; CTicon.Visible = true; CTicon.Click += new System.EventHandler(CTicon_Click); //Create a context menu for the notify icon contextMenu.MenuItems.Add("E&xit"); //Attach context menu to icon CTicon.ContextMenu = contextMenu; while (true) //Infinite Loop { Thread.Sleep(300); //wait } } private static void CTicon_Click(object sender, System.EventArgs e) { MessageBox.Show("Clicked!"); } }

    Read the article

  • Usability: Do mac users understand "right-click"?

    - by Stefan Kendall
    I have a feature of my application which depends on alternate-click. Windows users don't understand "alternate-click" though, and I was wondering if most mac users understood "right-click", and if so if they were offended or annoyed when they see such text. Does anyone have experience developing usable (consumer) applications for mac users? Does anyone have any opinions on this?

    Read the article

  • Validation plugin hijacks click function?

    - by timkl
    Absolute newbie question, any help is highly appreciated :) I am using curvycorners (http://www.curvycorners.net/) in combination with the jQuery validation plugin (http://bassistance.de/jquery-plugins/jquery-plugin-validation/), and I'm having problems getting the div to redraw the rounded corners when I do like this: $("input[type='submit']").click(function(e) { curvyCorners.redraw(); }); When I click the submit-button the first time the form validates, the validation error-message pops up and expands the div, causing the layout to go ugly. However when I click on it the second time the rounded corners redraw nicely. Could it be that my validation plugin hijacks my initial click? How do I go about this? Any hint is very much appreciated.

    Read the article

  • wpf prevent second click button

    - by neki
    hi! i have a problem again. when i click button, window appears. when i click button again same window appears again. i want when i click button first time, page appears. but i wanna prevent second click. can anyone help me about this problem? thanks in advance. private void Dictionary_Click(object sender, RoutedEventArgs e) { Dictionary dic = new Dictionary(); dic.Show(); dic.Topmost = true; }

    Read the article

  • How to Use JQuery Click Event on Button in an AJAX Form

    - by dpierre23
    I admittedly don't know much about JQuery but I have an AJAX page where I need to trigger a click event when someone clicks a button, but because the button is not there on the initial page load, I'm having issues using the click event. In my code, I just want to run a function when a button is clicked. <script type="text/javascript"> //Run function when button is clicked $(document).ready(function() { $("#idOfButton").click(function() { doSomething(); }); }); //The function I want ran when page visitor clicks button function doSomething() { //Do Something } </script> Obviously this code doesn't work, but any suggestions on how to use .click? I'm only able to insert JS via a tag management system, so I can't hard code anything into the page. Also, the JQuery version is 1.4, so I can't use .on. Thanks for your help.

    Read the article

  • Jquery button.click bug?

    - by Chris
    I have the following home-grown jquery plugin: (function($) { $.fn.defaultButton = function(button) { var field = $(this); var target = $(button); if (field.attr('type').toLowerCase() != 'text') return; field.keydown(function (e) { if ((e.which || e.keyCode) == 13) { console.log('enter'); target.click(); return false; } }); } })(jQuery); I'm using it like so: $('#SignUpForm input').defaultButton('#SignUpButton'); $('#SignUpButton').click(function(e) { console.log('click'); $.ajax({ type: 'post', url: '<%=ResolveUrl("~/WebServices/ForumService.asmx/SignUp")%>', contentType: 'application/json; charset=utf-8', dataType: 'json', data: JSON.stringify({ email: $('#SignUpEmail').val(), password: $('#SignUpPassword').val() }), success: function(msg) { $.modal.close(); } }); }); The first time, it works. The second time, nothing happens. I see enter and click the first time in the firebug log, but the second time I only see the enter message. It's almost like the button's click handler is being unregistered somehow. Any thoughts?

    Read the article

  • WPF/C#: Enable/Disable buttons depending on the number of clicks

    - by eibhrum
    Hi, I do have two buttons 'btnPrev' and 'btnNext' What I want to do is to be able to determine the number of clicks of the button so that I could enable and disable them. The process is almost similar to 'paging' method. Initial state: btnPrev - disabled, btnNext - enabled 1st Click (btnNext): btnPrev - enabled, btnNext - enabled 2nd Click (btnNext): btnPrev - enabled, btnNext - enabled 3rd Click (btnNext): btnPrev - enabled, btnNext - disabled the idea is almost the same vice-versa (for btnPrev) any suggestions how to do it?

    Read the article

  • click event not trigerred in IE

    - by ZX12R
    I am trying to trigger a click event for a button from jquery. it works very well in FF but IE(all versions) seem to ignore it. this is what i have tried so far.. $('#uxcSubmit').trigger('click'); then tried this.. $('#uxcSubmit').click(); then even tried this to check if it is a problem of jquery.. document.getElementById('uxcSubmit').click(); nothing seems to help IE.. thanks in advance..

    Read the article

  • Making selectable again a WPF TreeviewITem after the first click

    - by pileggi
    Hi, I have a TreeVIew WPF with 2 Levels of Data. I have deleted the ToogleButton from the TreeViewItemTemplate. Now I'd like to expand / collapse the groups with a single mouse-click (not with a double click as the default behaviour). I have tried in this way: Private Sub tvArt_SelectedItemChanged(ByVal sender As System.Object, _ ByVal e As RoutedPropertyChangedEventArgs(Of System.Object)) Handles tvArt.SelectedItemChanged If e.NewValue Is Nothing = False Then Dim ri As P_RicambiItem = TryCast(e.NewValue, P_RicambiItem) If ri Is Nothing = False Then If ri.isExpanded Then ri.isExpanded = False Else ri.isExpanded = True End If ri.isSelected = False End If End If End Sub Using my properties "isExpanded" and "isSelected" in the collection data source. But it works only halfway: after the first click, infact, I can't click for a second time on the same item, because, even if I've deselected it, the event handler "remembers" that it was the last selected item and it doesn't capture the event "SelectedItemChanged". How can I do? Thanks a lot, Pileggi

    Read the article

  • Enable/Disable WPF buttons depending on the number of clicks

    - by eibhrum
    I have two buttons 'btnPrev' and 'btnNext' What I want to do is to be able to determine the number of clicks of the button so that I could enable and disable them. The process is almost similar to 'paging' method. Initial state: btnPrev - disabled, btnNext - enabled 1st Click (btnNext): btnPrev - enabled, btnNext - enabled 2nd Click (btnNext): btnPrev - enabled, btnNext - enabled 3rd Click (btnNext): btnPrev - enabled, btnNext - disabled the idea is almost the same vice-versa (for btnPrev).

    Read the article

  • detect click inside iframe

    - by ismal
    i wanna detect click INSIDE iframe not onclick on iframe itself i tried onclick event u must click on iframe itself to trigger function i even tried addeventlistener to window or document nothing work as if the iframe isn't there the function never triger when i click inside iframe :( plz help

    Read the article

  • click event launched only once problem

    - by user281180
    I have a form in which I have many checkboxes. I need to post the data to the controller upon any checkbox checked or unchecked, i.e a click on a checbox must post to the controller, and there is no submit button. What will be the bet method in this case? I have though of Ajax.BeginForm and have the codes below. The problem im having is that the checkbox click event is being detected only once and after that the click event isnt being launched. Why is that so? How can I correct that? <% using (Ajax.BeginForm("Edit", new AjaxOptions { UpdateTargetId = "tests"})) {%> <div id="tests"> <%Html.RenderPartial("Details", Model); %> </div> <input type="submit" value="Save" style="Viibility:hidden" id="myForm"/> <%} %> $(function() { $('input:checkbox').click(function() { $('#myForm').click(); }); });

    Read the article

  • Click event on submit buttons only fires once

    - by Chris
    I subscribe to the click event on all submit buttons on my page once loaded. All buttons fire off the correct event when clicked, but this only works once. If you click any two buttons in a row the second button submits the form normally as opposed to running the script. What am I doing wrong?. Note: I load the form data from "myurl" using .load() then hook up to the submit buttons' click events in the complete event. $(document).ready(function() { //Load user content $("#passcontent").load("myurl", function() { //subscribe to click events for buttons to post the data back $('input[type=submit]').click(function() { return submitClick($(this)); }); }); }); function submitClick(submitButton) { submitButton.attr("disabled", true); alert(submitButton.closest("form").serialize()); $.post("myurl", submitButton.closest("form").serialize(), function(data) { alert("woop"); $("#passcontent").html(data); }); //Prevent normal form submission process from continuing return false; }

    Read the article

  • jQuery - Add click event to Div and go to first link found

    - by LuckyShot
    Hi guys, I think I've been too much time looking at this function and just got stuck trying to figure out the nice clean way to do it. It's a jQuery function that adds a click event to any div with a click CSS class found in the page and when clicked it redirects the user to the first link found in the div. function clickabledivs() { $('.click').each( function (intIndex) { $(this).bind("click", function(){ window.location = $( "#"+$(this).attr('id')+" a:first-child" ).attr('href'); }); } ); } The code simply works although I'm pretty sure there is a fairly better way to accomplish it, specially the selector I am using: $( "#"+$(this).attr('id')+" a:first-child" ) looks too long and slow. Any ideas? Please let me know if you need more details. Thanks! PS: I've got some jQuery benchmarking reference from Project2k.de here: http://blog.projekt2k.de/2010/01/benchmarking-jquery-1-4/

    Read the article

  • Jquery click behaviour

    - by VP
    I'm developing a menu. This menu, will change the background image when you click on a link, as almost all menus does. if i click in one link from the menu, this link backgroun will change the color. My jquery script is: $(function() { $('#menu ul li').click(function() { $('#menu ul li').removeClass("current_page_item"); $(this).addClass("current_page_item"); //return false; }); }); today, with the "return false" commented, when i click on the link under "#menu ul li" it changes the background open the new page and the background is reseted. For sure, if i uncomment the return false, the background works fine but then i cannot open any link. So its looks like after that i open a new page, it reset the classes. How can i make it persistent?

    Read the article

  • Increasing number once per mouse click/key press in XNA

    - by DMan
    This has been bothering me lately- when I use some code like below to increase selection every mouse click: if (m.LeftButton == ButtonState.Pressed) currentSelection++; Then currentSelection increases by a ton, simply because this code is in my Update() function and by design, runs every frame and so increases currentSelection. There is almost no chance you can click and release fast enough to prevent currentSelection from increasing more than one. Now my question is what I should do to make it so everytime I click the mouse down once, it only increases currentSelection once until the next time I click down again.

    Read the article

  • Silverlight Datagrid select on right click

    - by VexXtreme
    Hi Is there a way for a right click event to select a row in toolkit datagrid? I'm using toolkit context menu which works nicely, but the problem is, only left click is able to select rows, and I need right click to be able to do that if I want my context menu to work properly. Any help is appreciated

    Read the article

  • jQuery Cluetip not activated until after hover or click event

    - by kenny99
    I'm not sure what is causing this, but I am using cluetip and binding it to a live event (either click or mouseenter), but in each situation the cluetip isn't firing until after one click or hover event. I am using the live event for ajax loaded content, but I'm also having this issue with non-Ajax loaded content. I'm not sure why this is happening - can anyone see where I might be going wrong? Many thanks. $("a.jTip").live("click", function(){ $('a.jTip').cluetip({ attribute: 'href', cluetipClass: 'jtip', arrows: true, activation: 'click', ajaxCache: false, dropShadow: true, sticky: true, mouseOutClose: false, closePosition: 'title' }) return false; });

    Read the article

  • Get a button in itemscontrol and add eventhandler to its click event

    - by rockdale
    I have a custom control shows a customer info with an itemscontrol shows this customer's invoices. within the itemscontrol, I have button, in my code behind I want to wire the button's click event to my host window, but do now know how. //public event RoutedEventHandler ViewDetailClick; public static readonly RoutedEvent ButtonViewClickEvent = EventManager.RegisterRoutedEvent( "ButtonViewClick", RoutingStrategy.Bubble, typeof(RoutedEventHandler), typeof(custitem)); public event RoutedEventHandler ButtonViewClick { add { AddHandler(ButtonViewClickEvent, value); } remove {RemoveHandler(ButtonViewClickEvent, value);} } public override void OnApplyTemplate() { base.OnApplyTemplate(); this.lstInv = GetTemplateChild("lstInv") as ItemsControl; lstInv.ItemContainerGenerator.StatusChanged += new EventHandler(ItemContainerGenerator_StatusChanged); } private void ItemContainerGenerator_StatusChanged(object sender, EventArgs e) { if (lstInv.ItemContainerGenerator.Status == System.Windows.Controls.Primitives.GeneratorStatus.ContainersGenerated) { lstInv.ItemContainerGenerator.StatusChanged -= ItemContainerGenerator_StatusChanged; for (int i = 0; i < this.lstInv.Items.Count; i++) { ContentPresenter c = lstInv.ItemContainerGenerator.ContainerFromItem(lstInv.Items[i]) as ContentPresenter; DataTemplate dt = c.ContentTemplate; Grid grd = dt.LoadContent() as Grid; Button btnView = grd.FindName("btnView") as Button; if (btnView != null) { btnView.Click += new RoutedEventHandler(ButtonView_Click); //btnView.Click+= delegate(object senderObj, RoutedEventArgs eArg) //{ // if (this.ViewDetailClick != null) // { // this.ViewDetailClick(this, eArg); // } //}; } } private void ButtonView_Click(object sender, RoutedEventArgs e) { MessageBox.Show("clicked"); //e.RoutedEvent = ButtonViewClickEvent; //e.Source = sender; //RaiseEvent(e); } I succeed getting the btnView, then attach the click event, but the click event never get fired. Thanks in advance -rockdale

    Read the article

  • Javascript click function not working

    - by Nabe
    I need to null the value in text box on click, currently I have written a code as such <div class="keyword_non"> <h1>Keywords : <a class="someClass question_off" title="Keywords "></a></h1> <h2><input type="text" name="kw1" value="one" /></h2> <h2><input type="text" name="kw2" value="two" /></h2> <h2><input type="text" name="kw3" value="three" /></h2> <h2><input type="text" name="kw4" value="four" /></h2> </div> <script type="text/javascript" src="/functions/javascript/custom/non_profit_edit.js"></script> <script type="text/javascript" src="/functions/javascript/jquery-1.7.1.min.js"></script> <script type="text/javascript" src="/functions/javascript/custom/jquery-ui-1.8.7.custom.min.js"></script> Inside non_profit_edit.js i have written as such $(document).ready(function(){ $(".kw1").click(function() { $(".kw1").val(" "); }); $(".kw2").click(function() { $(".kw2").val(" "); }); $(".kw3").click(function() { $(".kw3").val(" "); }); $(".kw4").click(function() { $(".kw4").val(" "); }); }); But write now its not working properly... Is this any browser issues or error in code..

    Read the article

  • how to write right click event for selected row in ng-grid using angularjs

    - by user3819122
    i am using angularjs to write click event for selected row from ng-grid.but i want to write right click event for selected row from ng-grid in angularjs.below is my sample code for click event for selected row in ng-grid. Sample.html: <html> <body> <div ng-controller="tableController"> <div class="gridStyle" ng-grid="gridOptions"></div> </div> </body> </html> Sample.js: app.controller('tableController', function($scope) { $scope.myData = [{ name: "Moroni", age: 50 }, { name: "Tiancum", age: 43 }, { name: "Jacob", age: 27 }, { name: "Nephi", age: 29 }, { name: "Enos", age: 34 }]; $scope.gridOptions = { data: 'myData', enableRowSelection: true, columnDefs: [{ field: 'name', displayName: 'Name', cellTemplate: '<div ng-click="foo()" ng-bind="row.getProperty(col.field)"></div>' }, { field: 'age', displayName: 'Age', cellTemplate: '<div ng-click="foo()" ng-bind="row.getProperty(col.field)"></div>' } ] }; $scope.foo = function() { alert('select'); } }); please suggest me how to do this.

    Read the article

  • WPF TreeView PreviewMouseDown on TreeViewItem

    - by imekon
    If I handle the PreviewMouseDown event on TreeViewItem, I get events for everything I click on that TreeViewItem include the little +/- box to the left (Windows XP). How can I distinguish that? I tried the following: // We've had a single click on a tree view item // Unfortunately this is the WHOLE tree item, including the +/- // symbol to the left. The tree doesn't do a selection, so we // have to filter this out... MouseDevice device = e.Device as MouseDevice; // This is bad. The whole point of WPF is for the code // not to know what the UI has - yet here we are testing for // it as a workaround. Sigh... // This is broken - if you click on the +/- on a item, it shouldn't // go on to be processed by OnTreeSingleClick... ho hum! if (device.DirectlyOver.GetType() != typeof(Path)) { OnTreeSingleClick(sender); } What I'm after is just single click on the tree view item excluding the extra bits it seems to include.

    Read the article

  • Multiple click events

    - by Le_Coeur
    I have some popup dialogs on my webpage, in each of this dialogs i have defined some click event with jquery : $(".links_view").click(function(e){ //code }); But the problem is when i activate one this click event, it will be executed in each dialog...

    Read the article

< Previous Page | 13 14 15 16 17 18 19 20 21 22 23 24  | Next Page >