Search Results

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

Page 62/416 | < Previous Page | 58 59 60 61 62 63 64 65 66 67 68 69  | Next Page >

  • Delegates in Action -Help

    - by Amutha
    I am learning delegates.I am very curious to apply delegates to the following chain-of-responsibility pattern. Kindly help me the way to apply delegates to the following piece. Thanks in advance.Thanks for your effort. #region Chain of Responsibility Pattern namespace Chain { public class Player { public string Name { get; set; } public int Score { get; set; } } public abstract class PlayerHandler { protected PlayerHandler _Successor = null; public abstract void HandlePlayer(Player _player); public void SetupHandler(PlayerHandler _handler) { _Successor = _handler; } } public class Employee : PlayerHandler { public override void HandlePlayer(Player _player) { if (_player.Score <= 100) { MessageBox.Show(string.Format("{0} is greeted by Employee", _player.Name)); } else { _Successor.HandlePlayer(_player); } } } public class Supervisor : PlayerHandler { public override void HandlePlayer(Player _player) { if (_player.Score >100 && _player.Score<=200) { MessageBox.Show(string.Format("{0} is greeted by Supervisor", _player.Name)); } else { _Successor.HandlePlayer(_player); } } } public class Manager : PlayerHandler { public override void HandlePlayer(Player _player) { if (_player.Score > 200) { MessageBox.Show(string.Format("{0} is greeted by Manager", _player.Name)); } else { MessageBox.Show(string.Format("{0} got low score", _player.Name)); } } } } #endregion #region Main() void Main() { Chain.Player p1 = new Chain.Player(); p1.Name = "Jon"; p1.Score = 100; Chain.Player p2 = new Chain.Player(); p2.Name = "William"; p2.Score = 170; Chain.Player p3 = new Chain.Player(); p3.Name = "Robert"; p3.Score = 300; Chain.Employee emp = new Chain.Employee(); Chain.Manager mgr = new Chain.Manager(); Chain.Supervisor sup = new Chain.Supervisor(); emp.SetupHandler(sup); sup.SetupHandler(mgr); emp.HandlePlayer(p1); emp.HandlePlayer(p2); emp.HandlePlayer(p3); } #endregion

    Read the article

  • Telerik RadAjaxManager and Mouse Events in Chrome

    - by kuzco
    Whenever I'm using Telerik's RadAjaxManager in Chrome, the events sent to any mouse events I'm using are passed as null. For instance, the following: <img id="Image1" src="image.gif" onclick="alert(event)" /> <rad:RadAjaxManager ID="RadAjaxManager1" runat="server"> <AjaxSettings> </AjaxSettings> </rad:RadAjaxManager> Alerts null when clicking the image. This does not happen in IE or FF. The version of the RadAjaxManager is 1.8.5.0. I'm guessing the problem does not occur in later versions, but an upgrade is not an option at the moment. I tried Telerik's support forum, but they didn't really provide any answer. What could cause such a problem? And how can it be dealt with?

    Read the article

  • How can I process a form's events in another class / module automatically in VB.NET

    - by CowKingDeluxe
    Here's my code: Public Class Form1 End Class Public Class Form1Handler Inherits Form1 Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click MsgBox("I") End Sub End Class I'm trying to get Form1Handler to process Form1's events automatically. How can I do this? Should I use a module instead? I'm doing this in VB 2010. I don't want to have to make an event handler in Form1 and then pipe it to the other class / module, is there some way to automatically "pipe" the events from form1 to form1handler?

    Read the article

  • XMLEncoder and PersistenceDelegate

    - by Johannes Rössel
    I'm trying to use XMLEncoder to write an object graph (tree in my case) to a file. However, one class contained in it is not actually a Java bean and I don't particularly like making its guts publicly accessible. It's accessed more like a list and has appropriate add methods. I've already written a custom PersistenceDelegate to deal with that. However, is there any way for XMLEncoder to pick it up on its own or do I really need to add it whenever I use an encoder to write a graph that may contain said class?

    Read the article

  • How do I process a jQuery SVG group event in a single handler?

    - by rmflow
    I'm trying to draw a button using jQuery SVG, the button is a filled rect and the text is placed on top of the rect. Rect and text are grouped and I want to control the mouseover/mouseout events. The problem is: mouseover/mouseout events are triggered separately for every element of the group. Is it possible to make a single event handler for entire group? Here is an example: gClear = svg.group(); btClear = svg.rect(gClear, 10, 10, 100, h-20, 5 ,5, attrs); txtClear = svg.text(gClear, 35, 30, "Clear", {fontFamily: "Verdana", fontWeight: "bold", fontSize: "16px"}); $(gClear, svg.root()).bind("mouseover", function() { $(btClear).animate({svgFill: '#adf'}, 100); }).bind("mouseout", function() { $(btClear).animate({svgFill: '#fff'}, 100); }) When I move the mouse inside the rect the events mouseover/mouseout are triggered. Can I make "text" events transparent or can I have a single event handler for the group?

    Read the article

  • PowerPoint.Application not raising events in C#

    - by AdmSteck
    I have a simple application written in C# and .Net 2.0 that displays several PowerPoint 2003 files in a loop. (It is going to be used for a information board in our cafeteria) The application works fine on my development machine but when I deploy it to another machine the events I have registered for SlideShowNextSlide and PresentationClose are never fired. I have tried registering the events with this method. private void InitPPT() { app.SlideShowNextSlide += new Microsoft.Office.Interop.PowerPoint.EApplication_SlideShowNextSlideEventHandler(app_SlideShowNextSlide); app.PresentationClose += new Microsoft.Office.Interop.PowerPoint.EApplication_PresentationCloseEventHandler(app_PresentationClose); app.SlideShowEnd += new Microsoft.Office.Interop.PowerPoint.EApplication_SlideShowEndEventHandler(app_PresentationClose); } And with this method that I found here: private void InitPPT() { IConnectionPointContainer oConnPointContainer = (IConnectionPointContainer)app; Guid guid = typeof(Microsoft.Office.Interop.PowerPoint.EApplication).GUID; oConnPointContainer.FindConnectionPoint(ref guid, out m_oConnectionPoint); m_oConnectionPoint.Advise(this, out m_Cookie); } Do I need to register some dll's on the client machine or am I missing something.

    Read the article

  • Reference Object calling function in Javascript

    - by Louis
    I have a makeshift events system in JS and the attacher looks like this: events.attach(events.NEW_TASK,this.update); Where this.update is a callback/handler/function. The problem is, when the dispatcher tries to call this handler, it loses it's original context. How can I bind the handler with the context of the object that calls the attach function without passing this as an argument and using that?

    Read the article

  • setDelegate explanation

    - by mac
    Hi i am new to iphone developement , can any one explain me , why setDelegate is used, where we should use it. [request setDelegate:sender]; thanks in advance.

    Read the article

  • Multiple generic types in one container

    - by Lirik
    I was looking at the answer of this question regarding multiple generic types in one container and I can't really get it to work: the properties of the Metadata class are not visible, since the abstract class doesn't have them. Here is a slightly modified version of the code in the original question: public abstract class Metadata { } public class Metadata<T> : Metadata { // ... some other meta data public T Function{ get; set; } } List<Metadata> metadataObjects; metadataObjects.Add(new Metadata<Func<double,double>>()); metadataObjects.Add(new Metadata<Func<int,double>>()); metadataObjects.Add(new Metadata<Func<double,int>>()); foreach( Metadata md in metadataObjects) { var tmp = md.Function; // <-- Error: does not contain a definition for Function } The exact error is: error CS1061: 'Metadata' does not contain a definition for 'Function' and no extension method 'Function' accepting a first argument of type 'Metadata' could be found (are you missing a using directive or an assembly reference?) I believe it's because the abstract class does not define the property Function, thus the whole effort is completely useless. Is there a way that we can get the properties?

    Read the article

  • Get a list of events owned by a facebook page

    - by Tom Wright
    Does anyone know how I can get a list of events owned (created) by a Facebook page? I seem to be able to use the "graph api" to generate a list of the events an entity is attending. I also looked at FQL, but it seems to require that the 'where' clause is an indexable field (and, naturally, the id is the only indexable field). For bonus points, we'd be able to do this without any authentication. (Though I'm resigned to the fact that I'm likely going to need at least a permanent access_token.) If anyone know how to do this I'd be eternally grateful.

    Read the article

  • In c++ is there any Events/delegates/interfaces/notifications! anything?

    - by Bach
    Say i have these classes ViewA and ViewB In objective C using the delegate pattern I could do @protocol ViewBDelegate{ - (void) doSomething(); } then in ViewB interface: id<ViewBDelegate> delegate; then in ViewA implementation i set the delegate: viewB.delegate = self; and now I can call in doSomething from viewB onto any that unknown type delegate. [delegate doSomething]; "C++ How to Program" has been the worse read an can't find simple examples that demonstrates basic design patterns. What i'm looking for in C++ is: events ActionScript and java either delegates or notifications in Objective C anything that allows class A, Class B and Class C to know that ClassX didSomething()!!! thanks

    Read the article

  • How do I find out if an object can be Invoke()'d?

    - by Jurily
    Consider the following class: public class Event<T> { public delegate void Handler<t>(t msg); private event Handler<T> E; public void connect(Delegate handler) { E += delegate(T msg) { object target = handler.Target; if (Invokable(target) { target.BeginInvoke(handler, new object[] { msg }); } }; } public void emit(T msg) { if ( E != null ) { E(msg); } } private static bool Invokable(object o) { // magic } } How do I implement Invokable(), and what else do I need for this code to compile?

    Read the article

  • Managing memory of polymorphic timed events with DLL

    - by Milo
    Here is my issue. My Gui library that I made supports timed events. Basically, I have a class called TimedEvent which users inherit from. They then do: addTimedEvent(new DerivedTimedEvent(...)); However given the nature of timed events, I manage the memory afterwards. So when the timed event has done its thing, my library calls delete on it. Although it runs fine, that is because the exe and the library were both built with msvc 2008. I think I might have trouble if I have 2 versions of the runtime, one for the lib, and one for the exe. What can I do to fix this? I can't create a factory because the derived type is on the exe side of things. I also cannot ask the user to call delete since they might not have a way to keep track of time, or know if the event was delayed for whatever reason. Thanks

    Read the article

  • Update NSView in function of events

    - by Forchita
    Hi everyone! I have a main view (subclass of NSView) and as i'm new to cocoa, i'd like to know how to update the view in function of events. I know there are many methods that take events such as -(void)mouseMoved:(NSEvent*)event or - (void)mouseClicked:(NSEvent*)event My algorithm to determine what to do is ready. I want to know where I should update the main view: is it in the -(void)mouseMoved:(NSEvent*)event or in the - (void)drawRect:(NSRect)dirtyRect. And if it is in drawRect, then how should i pass the information to it? Thanks in advance!

    Read the article

  • Help me find article on Multi-threading and Event Handling in Java

    - by JDR
    I once read an article on how to properly write event handlers for multi-threading in Java, but I can't for the life of me find it anymore. It described the pitfalls and potentials for deadlocks that can occur when firing events (not Swing events mind you, but general events like model update notifications). To clarify, the situation would be as such: // let's say this is code from an MVC model somewhere public void setSomeProperty(String myProperty){ if(!this.myProperty.equals(myProperty)){ this.myProperty = myProperty; fireMyPropertyChangedEvent(...); } } The article described how passing control to arbitrary external listener code was a potential cause for deadlock. I now find myself in a situation where I need to fire such events in a multithreaded environment and I would very much like to read the article again to see what it has to say before I continue. Does anyone know the article I'm referring to? I believe it came as a (fairly short) PDF. It started off with an initial naive implementation and incrementally pointed out flaws and improved upon it. It ended with a sort of final proper-way-to-fire-multithreaded-events. I've searched endlessly in my browse history and on google, but all I could find were endless amounts topics on Swing event dispatch threads. Thank you.

    Read the article

  • iPhone xcode - Best way to control audio from several view controllers

    - by Are Refsdal
    Hi, I am pretty new to iPhone programming. I have a navBar with three views. I need to control audio from all of the views. I only want one audio stream to play at a time. I was thinking that it would be smart to let my AppDelegate have an instance of my audioplaying class and let the three other views use that instance to control the audio. My problem is that I don´t know how my views can use the audioplaying class in my AppDelegate. Is this the best approach and if so, how? Is there a better way?

    Read the article

  • Logging events as an Office 2007 application opens.

    - by Joshua King
    Is it possible to log what a Microsoft Office 2007 application does as it starts up. We are having an issue with Word where it hangs on the splash screen for a particular user and no one else and would like to find out what is causing it to hang. Windows event viewer only shows that the application was terminated unexpectedly because of a hang.

    Read the article

  • Entourage Reminders for events not on calendar

    - by Jon Lasser
    After a series of nasty mishaps, I needed to create a new Entourage profile and re-populate my calendar by resynching it with my Exchange Server. Now I'm receiving multiple notifications for a single appointment -- two or even four at once. (Perhaps four is due to the intermediate 'reset' attempts I made before discarding and creating a new profile.) Reviewing my calendar I see only a single appointment, not multiple appointments. Checking my Outlook calendar confirms only a single appointment. My local calendar is completely empty. Is there a separate Entourage database for reminders that I can clear or resync? Is there somewhere else for calendar appointments to live where I'm not looking?

    Read the article

  • Ubuntu Lucid startup events

    - by Lakshman Prasad
    On starting up Ubuntu, I seem to have to do the following, all the time: Enter the password for the keyring to unlock, so that it connects to wifi Enable the "Extra" Visual effects from the Appearances preferences Start skype. How can I automate all of these. Bonus points, if I can use the existing chat bundled in the system to use my skype account. Also, since I dual boot, I get the grub options initially to select Windows or Ubuntu that waits for 10 seconds for me to choose. How do I make it go to ubuntu, unless I explicitly not press a key to boot to windows. Thanks in advance.

    Read the article

< Previous Page | 58 59 60 61 62 63 64 65 66 67 68 69  | Next Page >