Search Results

Search found 10381 results on 416 pages for 'delegate and events'.

Page 83/416 | < Previous Page | 79 80 81 82 83 84 85 86 87 88 89 90  | Next Page >

  • C# Event routing in code behind

    - by Nate
    I'm building a WPF MVVM-ish application. I want to be able to display an event log containing items in a collection that exists in my viewmodel. I want any of the objects in the model to be able to add data to the event log. Therefore every object needs to be able to pass data back to one central collection for databinding in the view. I could implement an event in every one of my data classes and manually pass the events up the object heirarchy but this seems super clumsy. On the visual tree a Routed Event would take care of this, is there some equivelent in the model scope? Any other ideas?

    Read the article

  • Drupal Event/Calendar Module not storing event time

    - by Selino
    Hello, all. I have installed a fresh copy of Drupal on an Xampp server. Within that install is a collection of modules for creating an event calendar. There's actually a great instructional video at http://www.youtube.com/watch?v=qO4TeEydtMs for getting all the necessary fields up. So far everything is working except... the events won't store the time as stated in the edit field. No matter what I do in the edit mode as admin or otherwise the time always says 12pm and the event on the calendar says "All Day". I know this is pretty obscure but I figured why not try and ask. Thanks.

    Read the article

  • Event firing sequence for a submit button.

    - by JSTyro
    Say a submit button has a click event handler as well (yes, it's wrong, but that's really the code I'm working on). And the click handler sets a value in a field of the form that's about to be submitted. So when the submit button is clicked: What will fire first, the form submit event or the click event? Will the value set in the form field by the click event submitted to the server? I think this depends on the answer to Q1. If the form is posted first, I'm guessing it won't. Note: I'm not looking for alternatives and advice. I know what the proper way of handling this will be. Just trying to understand the sequence of events and their implications.

    Read the article

  • MessageBox.Show not raising HelpRequested event

    - by Trevortni
    I have a form that is showing a MessageBox using MessageBox.Show, and trying to receive events from the Help button on the MessageBox so I can execute my own code. The Microsoft documentation shows how to do this; however, using what is suggested does not work. Here's a shortened version of my code: Private Function MethodName() As Boolean AddHandler Me.HelpRequested, AddressOf Me.MsgBoxHelpRequested Select Case MessageBox.Show("Text", "Title", MessageButtons.YesNoCancel, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2, 0, True) Case MsgBoxResult.Yes ' Do stuff Case MsgBoxResult.No ' Do stuff Case MsgBoxResult.Cancel RemoveHandler Me.HelpRequested, AddressOf Me.MsgBoxHelpRequested Return False End Select RemoveHandler Me.HelpRequested, AddressOf Me.MsgBoxHelpRequested End Function Private Sub MsgBoxHelpRequested(ByVal sender As Object, ByVal hlpevent As System.Windows.Forms.HelpEventArgs) ' Breakpoint that never gets hit ' More code End Sub I've been searching for a solution to this problem, but the best I've found is this question: http://stackoverflow.com/questions/2407880/how-to-detect-help-button-press-in-windows-forms-messagebox that refers me back to the same Microsoft code that doesn't seem to be working. Can anybody help me with this? Thank you.

    Read the article

  • Why would a 'public event EventHandler cccc' be null?

    - by Matt
    Why would a 'public event EventHandler cccc' be null? I have a class that's public class Builder { public event EventHandler StartedWorking; public Builder() { // Constructor does some stuff } public void Start() { StartedWorking(this, eventargobject); //StartedWorking is null -- } } This seems straightforward and something I do all the time? Am I missing something obvious or is there something that could cause this? EDIT: Does this mean that if I fire an event that is not subscribed to in a client class I have to check that it is not null? EDIT-2: I guess I'd never had events that were never not subscribed to and hence never ran into this -- You learn something new every day Sorry about the seemingly stupid question....

    Read the article

  • Is it possible to remove all event handlers of a given element in javascript?

    - by MartyIX
    Hi, I would like to remove ALL handlers for a given event type. Let's say I've added twice "onclick event" to a button and now I would like to return back to the original state where no event handler was set to the button. How can I do that? P.S.: I've found removeEventListener (non-IE)/detachEvent (IE) methods but the functions want me to pass as a parameter the function that handles the event which seems to me quite clumsy because I would have to store the functions somewhere. EDIT: http://ejohn.org/blog/flexible-javascript-events/ - I'm now using this code Thank you!

    Read the article

  • How to trigger Mouse-Over on iPhone?

    - by Andrew
    This might seem like a really dumb question, but I am writing an application and I have come across where my mouse-over, mouse-click and mouse-hover need different events bound to them. Now on Internet Explorer, Firefox, and Safari. It all works as expected. However, on my iPhone the actions will not trigger. Now my question is are their any specific ways I can have the Mouse-Over essentially be fired when I hold my finger down and trigger an event? An example where this doesn't work is right on this website when you hover over a comment it is supposed to display the +1 or flag icon. I am using jquery.

    Read the article

  • Best way to set a default button (or trigger its event in javascript) for an input field, not part of a form

    - by Sheldon Pinkman
    I've got a stand-alone input field, not part of any form. I also got a button, that has some onclick event. When I type something in the input field, and press the Enter key, I want it do effectively press the button, or trigger its onclick event. So that the button is "the input field's default button" so to speak. <input id='myText' type='text' /> <button id='myButton' onclick='DoSomething()'>Do it!</button> I guess I can mess around with the input field's onkeypress or onkeydown events and check for the Enter key, etc. But is there a more 'clean' way, I mean something that associated the button with that input field, so that the button is the 'default action' or something for that field? Note that I'm not inside a form, I am not sending, posting, or submitting something. The DoSomething() function just changes some of the HTML content locally, depending on the text input.

    Read the article

  • Create empty C# event handlers automatically

    - by TomA
    It is not possible to fire an event in C# that has no handlers attached to it. So before each call it is necessary to check if the event is null. if ( MyEvent != null ) { MyEvent( param1, param2 ); } I would like to keep my code as clean as possible and get rid of those null checks. I don't think it will affect performance very much, at least not in my case. MyEvent( param1, param2 ); Right now I solve this by adding an empty inline handler to each event manually. This is error prone, since I need to remember to do that etc. void Initialize() { MyEvent += new MyEvent( (p1,p2) => { } ); } Is there a way to generate empty handlers for all events of a given class automatically using reflection and some CLR magic?

    Read the article

  • Tkinter mouse event initially triggered

    - by user3714884
    I'm currently learning Tkinter and I cannot find a solution for my problem here nor outside Stackoverflow. In a nutshell, all events that I bind to my widgets are triggered initialy and don't respond to my actions. In this example, the red rectangle appears on the canvas when I run the code, and color=random.choice(['red', 'blue']) revealed that the event binding doesn't work after that: import Tkinter as tk class application(tk.Frame): def __init__(self, master=None): tk.Frame.__init__(self, master) self.can = tk.Canvas(master, width=200, height=200) self.can.bind('<Button-2>', self.draw()) self.can.grid() def draw(self): self.can.create_rectangle(50, 50, 100, 100, fill='red') app = application() app.mainloop() I use a Mac platform, but I haven't got a clue about its role in the problem. Could anyone please point me at the mistake i did here?

    Read the article

  • [Raise|Trigger|Fire|...] an event?!?

    - by winSharp93
    Hello, in a German programming forum we currently have a discussion about events and what you (grammatically) do with them. The MSDN talks about "Event Raising" and "to raise an event". Thus, this seems to be one possibility. Are there any other synonyms? What about "to trigger an event" and "to fire an event"? A Google search will bring results for all of the three possibilities. This, however, does not mean that they are correct, too, of course. Are they? Are there any (stylistic, ...) differences or are they used in different contexts? Many thanks in advance for ending a heated debate :-)

    Read the article

  • Continuously reading from a stream in C#?

    - by Damien Wildfire
    I have a Stream object that occasionally gets some data on it, but at unpredictable intervals. Messages that appear on the Stream are well-defined and declare the size of their payload in advance (the size is a 16-bit integer contained in the first two bytes of each message). I'd like to have a StreamWatcher class which detects when the Stream has some data on it. Once it does, I'd like an event to be raised so that a subscribed StreamProcessor instance can process the new message. Can this be done with C# events without using Threads directly? It seems like it should be straightforward, but I can't get quite get my head around the right way to design this.

    Read the article

  • Javascript - Text Input Attributes

    - by bobrusha
    I need to create a form element <input disabled type="text" value="smth" /> which is disabled by default. It enables when onmouseover occures. onmouseover="this.disabled=false;" And is disabled by onmouseout onmouseout="this.disabled=true;" What I need is to check the following. If the <input> is focused then it shouldn't be disabled. And if the form element loses focus it disables. Please help me to complete the events. <input disabled type="text" value="smth" onmouseover="this.disabled=false;" onfocus="???" onblur="???" onmouseout="if(???){this.disabled=true;}" />

    Read the article

  • Enableeventvalidation in web user control

    - by Khushi
    Hi, i have a web user control containing a repeater. The repeater contains three buttons. On button click it gives the following error : Invalid postback or callback argument. Event validation is enabled using in configuration or <%@ Page EnableEventValidation="true" % in a page. For security purposes, this feature verifies that arguments to postback or callback events originate from the server control that originally rendered them. If the data is valid and expected, use the ClientScriptManager.RegisterForEventValidation method in order to register the postback or callback data for validation. Since user control does not have page directive, so i changed the enableEventValidation to false, but it restricted the itemcommand event of the repeater. Can someone guide me, how to solve this problem?

    Read the article

  • prevent onmouseout when hovering child element of the parent absolute div

    - by John
    Hi I am having trouble with the onmouseout function in a absolute positoned div. When the mouse hits a child element in the div, the mouseout event fires, but I do not want it to fire until the mouse is out of the parent, absolute div. How can I prevent the mouseout event from firing when it hits a child element WITHOUT jquery. I know this has something to do with event bubbling, but I am having no luck on finding out how to work this out. A similar post I found here: How to disable mouseout events triggered by child elements? How ever that solution uses jquery.

    Read the article

  • How to decide between a method or event?

    - by Wil
    I read something ages ago I think by Jon Skeet (which I can't find now) saying that in IL, all events get converted to methods... it was before I understood C# and did not understand it all, but if that is (or even if it isn't) the gist of it.... In a purely hypothetical situation, I was wondering if someone could explain or point me to a resource that says when to use an event over a method? Basically, If I want to have a big red/green status picture which is linked to a Bool field, and I wanted to change it based on the value of the bool, should I: a) Have a method called Changepicture which is linked to the field and changes the state of the bool and the picture. b) Have a get/set part to the field and stick an event in the set part. c) Have a get/set part to the field and stick a method in the set part. d) Other?

    Read the article

  • Optimizing multiple dispatch notification algorithm in C#?

    - by Robert Fraser
    Sorry about the title, I couldn't think of a better way to describe the problem. Basically, I'm trying to implement a collision system in a game. I want to be able to register a "collision handler" that handles any collision of two objects (given in either order) that can be cast to particular types. So if Player : Ship : Entity and Laser : Particle : Entity, and handlers for (Ship, Particle) and (Laser, Entity) are registered than for a collision of (Laser, Player), both handlers should be notified, with the arguments in the correct order, and a collision of (Laser, Laser) should notify only the second handler. A code snippet says a thousand words, so here's what I'm doing right now (naieve method): public IObservable<Collision<T1, T2>> onCollisionsOf<T1, T2>() where T1 : Entity where T2 : Entity { Type t1 = typeof(T1); Type t2 = typeof(T2); Subject<Collision<T1, T2>> obs = new Subject<Collision<T1, T2>>(); _onCollisionInternal += delegate(Entity obj1, Entity obj2) { if (t1.IsAssignableFrom(obj1.GetType()) && t2.IsAssignableFrom(obj2.GetType())) obs.OnNext(new Collision<T1, T2>((T1) obj1, (T2) obj2)); else if (t1.IsAssignableFrom(obj2.GetType()) && t2.IsAssignableFrom(obj1.GetType())) obs.OnNext(new Collision<T1, T2>((T1) obj2, (T2) obj1)); }; return obs; } However, this method is quite slow (measurable; I lost ~2 FPS after implementing this), so I'm looking for a way to shave a couple cycles/allocation off this. I thought about (as in, spent an hour implementing then slammed my head against a wall for being such an idiot) a method that put the types in an order based on their hash code, then put them into a dictionary, with each entry being a linked list of handlers for pairs of that type with a boolean indication whether the handler wanted the order of arguments reversed. Unfortunately, this doesn't work for derived types, since if a derived type is passed in, it won't notify a subscriber for the base type. Can anyone think of a way better than checking every type pair (twice) to see if it matches? Thanks, Robert

    Read the article

  • How I pass a delegate prototype to a method?

    - by Jeff Dahmer
    SO lets say in my class I have: public delegate bool MyFunc(int param); How can I then do this someObj.PassMeADelegateToExamine(this.MyFunc); // not possible!?! SO that I can examine the delegate and perhaps use reflection or something idk to find out it's return type and any params it might have? Basically if I can transform it into an (uncallable) Action object that woul dbe grand

    Read the article

  • How to use NSNotificationCenter in delegate and respond to the notifation in my view in iphone?

    - by Warrior
    I am new to iphone development.I am parsing a url in my delegate class, i want to send a notification once the parsing is completed to my view "testviewcontroller".With reference to the notifation i want to perform some action in my view. I want to know ,how to set the notification in delegate with referring to the selector method in my "testviewcontroller" class.Please help me out.Thanks.

    Read the article

  • How to link a property setter to a delegate?

    - by Danvil
    I would like to give a property setter to a delegate. How is this done? class A { private int count; public int Count { get { return count; } set { count = value; } } } A a = new A(); delegate void ChangeCountDelegate(int x); ChangeCountDelegate dlg = ... ? // should call a.Count = x

    Read the article

  • Is there an existing delegate in the .NET Framework for comparison?

    - by Neil Barnwell
    The .NET framework provides a few handy general-use delegates for common tasks, such as Predicate<T> and EventHandler<T>. Is there a built-in delegate for the equivalent of CompareTo()? The signature might be something like this: delegate int Comparison<T>(T x, T y); This is to implement sorting in such a way that I can provide a lambda expression for the actual sort routine (ListView.ListViewItemSorter, specifically), so any other approaches welcome.

    Read the article

  • Analytics: Test events not showing up - how to troubleshoot?

    - by David Parks
    I've got 3 profiles: Master, Raw Data, and Test, on the Test profile I have no filters configured. I want to test using some events. I created a local HTML file as shown below to generate some test data that I could play with in Analytics. But the events never showed up in Analytics. I wonder what I might be doing wrong? Is the lack of a domain an issue maybe? <html><head></head><body>Login_popup_complete_Facebook <script type="text/javascript"> var _gaq = _gaq || []; _gaq.push(['_setAccount', 'UA-28554309-1']); _gaq.push(['_trackPageview']); _gaq.push(['_trackEvent', 'Login popup completed', 'Facebook']); (function() { var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true; ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js'; var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s); })(); </script> </body></html>

    Read the article

  • How can I design my classes to include calendar events stored in a database?

    - by Gianluca78
    I'm developing a web calendar in php (using Symfony2) inspired by iCal for a project of mine. At this moment, I have two classes: a class "Calendar" and a class "CalendarCell". Here you are the two classes properties and method declarations. class Calendar { private $month; private $monthName; private $year; private $calendarCellList = array(); private $translator; public function __construct($month, $year, $translator) {} public function getCalendarCellList() {} public function getMonth() {} public function getMonthName() {} public function getNextMonth() {} public function getNextYear() {} public function getPreviousMonth() {} public function getPreviousYear() {} public function getYear() {} private function calculateDaysPreviousMonth() {} private function calculateNumericDayOfTheFirstDayOfTheWeek() {} private function isCurrentDay(\DateTime $dateTime) {} private function isDifferentMonth(\DateTime $dateTime) {} } class CalendarCell { private $day; private $month; private $dayNameAbbreviation; private $numericDayOfTheWeek; private $isCurrentDay; private $isDifferentMonth; private $translator; public function __construct(array $parameters) {} public function getDay() {} public function getMonth() {} public function getDayNameAbbreviation() {} public function isCurrentDay() {} public function isDifferentMonth() {} } Each calendar day can includes many calendar events (such as appointments or schedules) stored in a database. My question is: which is the best way to manage these calendar events in my classes? I think to add a eventList property in CalendarCell and populate it with an array of CalendarEvent objects fetched by the database. This kind of solution doesn't allow other coders to reuse the classes without db (because I should inject at least a repository services also) just to create and visualize a calendar... so maybe it could be better to extend CalendarCell (for instance in CalendarCellEvent) and add the database features? I feel like I'm missing some crucial design pattern! Any suggestion will be very appreciated!

    Read the article

  • How can I design my classes for a calendar based on database events?

    - by Gianluca78
    I'm developing a web calendar in php (using Symfony2) inspired by iCal for a project of mine. At this moment, I have two classes: a class "Calendar" and a class "CalendarCell". Here you are the two classes properties and method declarations. class Calendar { private $month; private $monthName; private $year; private $calendarCellList = array(); private $translator; public function __construct($month, $year, $translator) {} public function getCalendarCells() {} public function getMonth() {} public function getMonthName() {} public function getNextMonth() {} public function getNextYear() {} public function getPreviousMonth() {} public function getPreviousYear() {} public function getYear() {} private function calculateDaysPreviousMonth() {} private function calculateNumericDayOfTheFirstDayOfTheWeek() {} private function isCurrentDay(\DateTime $dateTime) {} private function isDifferentMonth(\DateTime $dateTime) {} } class CalendarCell { private $day; private $month; private $dayNameAbbreviation; private $numericDayOfTheWeek; private $isCurrentDay; private $isDifferentMonth; private $translator; public function __construct(array $parameters) {} public function getDay() {} public function getMonth() {} public function getDayNameAbbreviation() {} public function isCurrentDay() {} public function isDifferentMonth() {} } Each calendar day can includes many events stored in a database. My question is: which is the best way to manage these events in my classes? I think to add a eventList property in CalendarCell and populate it with an array of CalendarEvent objects fetched by the database. This kind of solution doesn't allow other coders to reuse the classes without db (because I should inject at least a repository services also) just to create and visualize a calendar... so maybe it could be better to extend CalendarCell (for instance in CalendarCellEvent) and add the database features? I feel like I'm missing some crucial design pattern! Any suggestion will be very appreciated!

    Read the article

< Previous Page | 79 80 81 82 83 84 85 86 87 88 89 90  | Next Page >