Search Results

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

Page 73/416 | < Previous Page | 69 70 71 72 73 74 75 76 77 78 79 80  | Next Page >

  • Correct way of using/testing event service in Eclipse E4 RCP

    - by Thorsten Beck
    Allow me to pose two coupled questions that might boil down to one about good application design ;-) What is the best practice for using event based communication in an e4 RCP application? How can I write simple unit tests (using JUnit) for classes that send/receive events using dependency injection and IEventBroker ? Let’s be more concrete: say I am developing an Eclipse e4 RCP application consisting of several plugins that need to communicate. For communication I want to use the event service provided by org.eclipse.e4.core.services.events.IEventBroker so my plugins stay loosely coupled. I use dependency injection to inject the event broker to a class that dispatches events: @Inject static IEventBroker broker; private void sendEvent() { broker.post(MyEventConstants.SOME_EVENT, payload) } On the receiver side, I have a method like: @Inject @Optional private void receiveEvent(@UIEventTopic(MyEventConstants.SOME_EVENT) Object payload) Now the questions: In order for IEventBroker to be successfully injected, my class needs access to the current IEclipseContext. Most of my classes using the event service are not referenced by the e4 application model, so I have to manually inject the context on instantiation using e.g. ContextInjectionFactory.inject(myEventSendingObject, context); This approach works but I find myself passing around a lot of context to wherever I use the event service. Is this really the correct approach to event based communication across an E4 application? how can I easily write JUnit tests for a class that uses the event service (either as a sender or receiver)? Obviously, none of the above annotations work in isolation since there is no context available. I understand everyone’s convinced that dependency injection simplifies testability. But does this also apply to injecting services like the IEventBroker? This article describes creation of your own IEclipseContext to include the process of DI in tests. Not sure if this could resolve my 2nd issue but I also hesitate running all my tests as JUnit Plug-in tests as it appears impractible to fire up the PDE for each unit test. Maybe I just misunderstand the approach. This article speaks about “simply mocking IEventBroker”. Yes, that would be great! Unfortunately, I couldn’t find any information on how this can be achieved. All this makes me wonder whether I am still on a "good path" or if this is already a case of bad design? And if so, how would you go about redesigning? Move all event related actions to dedicated event sender/receiver classes or a dedicated plugin?

    Read the article

  • CommandManager Executed Events don't fire for custom ICommands

    - by Andre Luus
    The WPF CommandManager allows you to do the following (pseudo-ish-code): <Button Name="SomeButton" Command="{Binding Path=ViewModelCommand}"/> And in the code-behind: private void InitCommandEvents() { CommandManager.AddExecutedEventHandler(this.SomeButton, SomeEventHandler); } The SomeEventHandler never gets called. To me this didn't seem like something very wrong to try and do, but if you consider what happens inside CommandManager.AddExecutedEventHandler, it makes sense why it doesn't. Add to that the fact that the documentation clearly states that the CommandManager only works with RoutedCommands. Nonetheless, this had me very frustrated for a while and led me to this question: What would you suggest is the best workaround for the fact that the CommandManager does not support custom ICommands? Especially if you want to add behavior around the execution of a command? For now, I fire the command manually in code behind from the button click event.

    Read the article

  • Event Tracking

    - by DRapp
    I want to understand event cycles. I have a form with a grid and textboxes. It has a grid, bound to DataTable, and textboxes bound to same table too. I'm trying to debug something and need to know how to identify ALL events fired in the form to see what may solve an issue for me. Anyhow, unless I explicitly subclass every class on my form, and override / attach to every event to my own event handlers, how can I get / listen to all events being fired during a certain action... Such as changing a "Selected" road in a DataGridView. It obviously updates its own "CurrentRow"... I need to know what / how to maybe FORCE a re-loading of SAME CurrentRow. Reason: during a form level "Edit Mode", and I change the content in another "Textbox" control, and reject changes, I need it to simulate the current "Record" is reloaded to go back to its original values.

    Read the article

  • jQuery / jqgrid / Editing form events

    - by MiBol
    I'm working with the jqGrid and I want to know if exists an event to read a double click in the Editing Form? Has example: I have a grid with ColumnA and ColumnB. I want read the event when the user perform a double click under ColumnB (In the Editing Form). Thanks! I found the solution of my problem ^^ Here is the code, to this example I use the alert "TEST!!!"... [Thanks to Oleg to wake up my mind :P] In the colModel { name: 'Total_uploads', index: 'Total_uploads', width: '100', editable: true, edittype: 'text', editoptions: { size: 10, maxlength: '20', dataInit: function (el) { $(el).click(function () { alert("TEST!!!"); }); } }, editrules: { required: true }, formoptions: { label: 'Total uploads: ', elmsuffix: '&nbsp;&nbsp; <span style="color : #0C66BE; font-family: Calibri">(*)</span>' } }

    Read the article

  • getting keyboard events with pyqt

    - by Moayyad Yaghi
    hello i converted recently from wxpython to pyqt and im still facing alot of problems since im still noob in pyqt so is it possible to detected if user pressed (CTRL+key ) in pyqt ? and how ? i've been trying to find an answer for this for 3 days . if you know website or a good place to learn pyqt, it will be highly appreciated thanx in advance

    Read the article

  • events is not displayed on my fullcalendar

    - by ChangJiu
    Hi BalusC! I have used your method at above in my servelt. **[CalendarMap]** public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { Map<String, Object> map = new HashMap<String, Object>(); map.put("id", 115); map.put("title", "changjiu"); map.put("start", new SimpleDateFormat("yyyy-MM-15").format(new Date())); map.put("url", "http://yahoo.com/"); // Convert to JSON string. String json = new Gson().toJson(map); // Write JSON string. response.setContentType("application/json"); response.setCharacterEncoding("UTF-8"); response.getWriter().write(json); } I want to display it my fullcalendar as follow. $(document).ready(function() { $('#calendar').fullCalendar({ eventSources: [ "CalendarMap" ] }); }); but it's not worked! Can you help me? thank you!

    Read the article

  • Pocket IE onmousedown onmousemove onmouseup ?

    - by eidylon
    Hello all, I have a control which I wrote for capturing signatures on a web page, by using onmousedown, onmousemove and onmouseup on a div to track the mouse, and capture points comprising a signature. Now we need this to work on Windows Mobile 6.5 powered devices... but it seems that the div element does not support the mouse events in Pocket IE, which would seem to be supported by this blog. But according to MSDN, the WinCE (which WinMo/PPC is based off of) version of IE does support these mouse events for some unknown list of elements. So can anyone tell me, are there any elements: img, a, span or whatever that support onmouse[down|move|up] in WinMo 6.5 Pocket IE? Thanks! If not, anyone have any other ideas for capturing a signature on a web page in Pocket IE?

    Read the article

  • jquery js how to avoid massive onmouseover onmouseout firing

    - by stephan
    i have a table with some columns. in each of them is a picture where i have a onmouseover onmouseout event on it, which show a message in a div and hide the msg. my problem is - after a user goes quick from left to right (and moving) over a lot o images. all mouseover/out events of the images where executed, which looks stupid... is it possible to rearrange the internal event stack to avoid this? so that he executes only the current (mostly the first event) - and than the last one, if it is not same type eg. if mouseover over first image is executed and mouse moving position stops over an image 3times next the first one. i can avoid all other events firing, because the mouse stopped over an image and the mouseover is like the one where i stopped with the mouse. how can i avoid this multiple event firing?!

    Read the article

  • Intercepting touch events on activity and button on Android

    - by hgpc
    I have an Android activity with an ImageButton. I would like to execute some logic when the button is clicked and show a different image for the pressed state, but also receive the touch event on the activity. By default only the button receives the touch event. If I set the clickable attribute of the button to false then only the activity receives the touch event. What's the best way to receive the touch event in both the activity and the button?

    Read the article

  • Exceptions and Access Violations in Paint events in Windows

    - by Patrick
    After executing some new code, my C++ application started to behave strange (incorrect or incomplete screen updates, sometimes no screen updates at all). After a while we found out that the new code is causing an Access Violation. Strange enough, the application simply keeps on running (but with the incorrect screen updates). At first we thought the problem was caused by a "try-catch(...)" construction (put there by an overactive ex-colleague), but several hours later (carefully inspecting the call stacks, adding many breakpoints, ...) we found out that if there's an Access Violation in a paint event, Windows catches it, and simply continues running the application. Is this normal behavior? Is it normal that Windows catches exceptions/errors during a paint event? Is there a way to disable this? (if not, it would mean that we have to always run in the debugger with all exceptions enabled while testing our code). Patrick

    Read the article

  • Add client-side events to ASP.Net custom control at runtime

    - by nw
    I'm building an ASP.net custom control that implements IScriptControl. I would like other users of my control to be able to assign client-side event handlers to the control. Unfortunately the JS generated by IScriptControl is always injected at the very bottom of the rendered page (see below), so any attempt to assign an event handler in the ASPX page fails because the code executes too early. ... <script type="text/javascript"> //<![CDATA[ Sys.Application.initialize(); Sys.Application.add_init(function() { $create(MyNamespace.MyControl, {}, null, null, $get("my_control_id")); }); //]]> </script> </form> What's the right way to assign an event handler to the instantiated control upon page load?

    Read the article

  • How to integrate conditional logic in postbuild events

    - by codymanix
    Hi I have a visual studio project which includes postbuildevents in the following form: MyTool.exe $(ProjectDir)somesrcfile.txt $(TargetDir)sometargetfile.bin Now I want to add some logic saying that these steps are taking place only if the files have changed. In peudocode: if (somesrcfile.txt is newer than sometargetfile.bin) { MyTool.exe $(ProjectDir)somesrcfile.txt $(TargetDir)sometargetfile.bin } Can I do this with MsBuild?

    Read the article

  • Change TreeNode image on expand-collapse events

    - by Alexander Stalt
    I have a treeView with many nodes. I want that some nodes change their image when node collapsed/expanded. How can I do it ? Unfortunately, TreeNode don't have properties like ExpandNodeImage, CollapseNodeImage \ TreeView can change very often, so nodes can be deleted/added.. i can delete child nodes and so on... Maybe, there is a class like ExpandAndCollapseNode ?

    Read the article

  • Increase width of divs, displayed side by side, using draggable events

    - by Vaibhav Shukla
    I have two divs of fixed length as of now, which loads external URL by dynamically embedding iframes inside them. Divs are appearing next to each other - one on left and other right. As of now, I have fixed their width to 50% each. But, I want to give user a flexibility to increase the width of any div to view the URL inside easily without scrolling horizontally. Something like dragging the border separating the two divs to either left or right according to his need. Is there a way I could achieve this? Please suggest any library or something. I have gone through a library twentytwenty which is used for images. I don't know how will that work for dynamic iframes. Here is the JSFiddle which displays the divs. <div> <div id="originalPage" style="width:54%;height: 730px;float:left"> <p>one div </p> </div> <div id="diffReport" style="width:45%; height: 730px;float:right"> <p>another div</p> </div> </div>

    Read the article

  • Flash AS3 - Dispatching Events from Parent Class to Child Class

    - by John Russell
    I think this is a pretty simply problem but I do not seem to be able to pull it off. Basically I have a parent class A, and a child class B. Class A instantiates class B with addChild. There is a shared object which is being updated from a java server (red5) that has an event listener attached to it in class A. I have a function in class A which will pass certain, specific updates from this shared object to class B. The problem occurs is that when class B is instantiated, the event listener from class A doesn't work anymore. I have not removed the event listener from A. Any thoughts?

    Read the article

  • C# NotifyIcon behaviour on Windows 7 with MouseClick, MouseDoubleClick events

    - by binball
    Hi, I have strange behaviour with my app after run it on Windows 7. It's connected with NotifyIcon while app is minimized. What should happens: 1) Click once on icon with mouse left button then Balloon with some text should appears 2) Double click on icon will show again app window On Windows 7 MouseDoubleClick is also fired but window is not showing. I don't know why. The same code works good on Windows XP. private void notifyIcon_MouseClick(object sender, MouseEventArgs e) { if (e.Button == MouseButtons.Left) { this.NotifyIconShowBalloonWithData(); } } private void notifyIcon_MouseDoubleClick(object sender, MouseEventArgs e) { this.Show(); WindowState = FormWindowState.Normal; notifyIcon.Visible = false; } What did I wrong? :) Thanks in advance for your answer.

    Read the article

  • UITouch Events and Table Views

    - by Andy
    I'm working on a navigation-based iPhone-only app that serves two main purposes: One, to present data in a hierarchical view, allowing users to drill down and eventually edit said data, and, two, to all users to perform a default action when the table view cell is tapped. I now need to offer a small set of options tied to the same data; however, both the didSelectRowAtIndexPath: and accessoryButtonTappedForRowAtIndexPath: methods are obviously taken. So, my options seem to be to implement a double-tap method, wherein the small list of additional options would be presented after (you guessed it) a double-tap on said table row; or, preferably, a tap-and-hold method. From what I can tell, tap-and-hold seems like the way to go in SDK 4.0 - which does me no good right this red-hot minute. I decided to go with the double-tap option, but I'm having a little trouble. First and foremost, the touchesBegan:withEvent: method does not seem to be getting called at all; a breakpoint placed within the method is never called while the application runs, and the table view responds exactly as it did before I inserted the method (which is to say, it performs the default action): - (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event { UITouch *aTouch = [touches anyObject]; if (aTouch.tapCount == 2) { [NSObject cancelPreviousPerformRequestsWithTarget:self]; } } Second, I don't really need to handle a single-tap - the didSelectRowAtIndexPath: method can handle the single-tap just fine. The double-tap is the funky one I want to handle. I suspect the answer is going to contain the phrase, "You can't have the table view handle the single-tap and the touchesBegan: method handle the double-tap. The touch handling methods have to handle all of them." I would really appreciate some guidance from some of you who've dealt with this issue. Thanks in advance.

    Read the article

  • NotifyIcon behaviour on Windows 7 with MouseClick, MouseDoubleClick events

    - by binball
    I have strange behaviour with my app after run it on Windows 7. It's connected with NotifyIcon while app is minimized. What should happens: 1) Click once on icon with mouse left button then Balloon with some text should appears 2) Double click on icon will show again app window On Windows 7 MouseDoubleClick is also fired but window is not showing. I don't know why. The same code works good on Windows XP. private void notifyIcon_MouseClick(object sender, MouseEventArgs e) { if (e.Button == MouseButtons.Left) { this.NotifyIconShowBalloonWithData(); } } private void notifyIcon_MouseDoubleClick(object sender, MouseEventArgs e) { this.Show(); WindowState = FormWindowState.Normal; notifyIcon.Visible = false; } What did I wrong? :)

    Read the article

  • Flash: dynamically adding events code to instances possible?

    - by Kohan
    I want to make a movieclip invisible initially but i dont want to set it manually within the properties in flash because i cant then see it on the scene. I was hoping i could add some code like so: MC Frame one. this.onClipEvent(load) { this._alpha = 0; } but I cannot. How can i set the MC _alpha to 0 for all instances without adding it manually to each instance or setting it in the properties? edit: or creating a class for it just to set the alpha.

    Read the article

  • bottom uicomponent does not receive mouse events

    - by firemonkey
    HI, I am sure this is very basic, however I am not able to find the solution. I have a base ShapeContainer(UIComponent). I add a uicomponent which has mouse down listener to ShapeContainer. the listener works great. When I add a simple sprite(draw square) on the ShapeContainer, The listener does not work any more. In the code, if I comment below lines, The event listener works fine. var square:Sprite = new Sprite(); square.graphics.lineStyle(4,0x00FF00); square.graphics.drawRect(0,0,20,20); square.mouseEnabled=false; shapeContainer.addChildAt(square,1); I have tried few things like, mouseenabled=false on top sprite. also tried to add addChildAt but non of them did any help. How can I draw a shape and also have the event listener work. enter code here protected function application1_creationCompleteHandler(event:FlexEvent):void { var shapeContainer:UIComponent = new UIComponent(); shapeContainer.x=100; shapeContainer.y=100; shapeContainer.width=200; shapeContainer.height=200; rawChildren.addChild(shapeContainer); var EventListenerShape:UIComponent = new UIComponent(); EventListenerShape.x=100; EventListenerShape.y=100; EventListenerShape.width=200;a EventListenerShape.height=200; EventListenerShape.graphics.clear(); EventListenerShape.graphics.beginFill(0xf1f1f1, 0.1); EventListenerShape.graphics.drawRoundRect(0, 0, 200, 200, 10, 10); EventListenerShape.alpha = 0; EventListenerShape.graphics.endFill(); EventListenerShape.addEventListener(MouseEvent.MOUSE_DOWN, mouseDownfunc); shapeContainer.addChild(EventListenerShape); var square:Sprite = new Sprite(); square.graphics.lineStyle(4,0x00FF00); square.graphics.drawRect(0,0,20,20); square.mouseEnabled=false; shapeContainer.addChildAt(square,1); } private function mouseDownfunc(e:MouseEvent){ trace("mouse Down **"); }    ]]> </mx:Script> <mx:Canvas id="uic" width="100%" height="100%" backgroundColor="0xFFFFFF"> </mx:Canvas>

    Read the article

  • Attaching javascript events to form widgets

    - by user334017
    I have a form with a drop down menu and I want to do a javascript action whenever the user changes the selection. I imagine it is possible find the input later, using javascript, and attach an event to to it; but it seems like it would be easier if there was some sort of attribute or option that could be defined in form-configure(): e.g. $this->widgetSchema['menu'] = new sfWidgetFormChoice(array( ... 'onclick' => javascript function )); obviously this doesn't work, and it probably wouldn't be an onclick method either, but my question is how do you attach a javascript event to a input/widget?

    Read the article

< Previous Page | 69 70 71 72 73 74 75 76 77 78 79 80  | Next Page >