Help with NSButton event

Hi,
I have a problem: I want to place a NSButton with type of "Recessed Button" on NSView and part of button should be on view and another part should be outside of this view
That's ok, but when cursor of mouse move inside button and outside view, button receive event about this.
What need to do for this event do not send to button when cursor move outside my view ?
Thanks

I think that if replace options in NSTrackingArea for NSButton it will be help me
In Debugger I saw that default options is 4225 - I think that it's NSTrackingMouseEnteredAndExited|NSTrackingActiveAlways|NSTrackingAssumeInside
I want replace it to NSTrackingMouseEnteredAndExited|NSTrackingActiveAlways|NSTrackingInVisibleRect
But if I do it in awakeFromNib function and add breakpoint in drawRect: -- it have first value. Somewhere value overwrite before drawRect:
Code:
//MyButton.mm
- (void)awakeFromNib
NSArray *a = [self trackingAreas];
NSTrackingArea * t = [[NSTrackingArea alloc] initWithRect:(NSRect){0, 0, 100, 50}
options:NSTrackingMouseEnteredAndExited|NSTrackingActiveAlways|NSTrackingInVisi bleRect
owner:self
userInfo:nil];
[self removeTrackingArea:[a objectAtIndex:0]];
[self addTrackingArea:t];
[t release];
- (void)drawRect:(NSRect)aRect
NSArray *a = [self trackingAreas];
NSTrackingArea *t1 = [a objectAtIndex:0]; //always first value !!!
[super drawRect: aRect];
Any idea how to do that ?
Message was edited by: pavelmagur

Similar Messages

  • Help with Keyboard Event

    Hi, I am designing a drum machine in flash pro Cs6 actionscript 3.0  and I am trying to add a keyboard event that will trigger a button event that I have all ready created, I can create the event to play the sound but this is not what I want, can I call the click event so the button will move on the key event triggering the sound, here is an example of one of my buttons code... btn, thank you if anyone can help.
    import flash.events.KeyboardEvent;
    playsound2.fla
    playsound with extra functionality:
    textbox added.
    Displays ID3 info of the sound
    btn.addEventListener(MouseEvent.CLICK, playSomeSound);
    function playSomeSound(e:MouseEvent)
              var req:URLRequest = new URLRequest("Savage.mp3");
              var s:Sound = new Sound(req);
              s.addEventListener(Event.COMPLETE, onSoundLoaded);
              s.addEventListener(Event.ID3, onID3Info);
    function onSoundLoaded(event:Event):void
              var localSound:Sound = event.target as Sound;
              localSound.play();
    function onID3Info(e:Event):void
              var id3Props:ID3Info = e.target.id3;
              var sOut:String = txt.text = "";
              for (var propName:String in id3Props)
                        sOut = propName + "=" + id3Props[propName] + "\n";
                        trace(sOut);
                        txt.appendText(sOut);
              txt.text = id3Props.comment;
    var ba:ByteArray = new ByteArray();
    var gr:Sprite = new Sprite();
    gr.x = 5;
    gr.y = 50;
    addChild(gr);
    var time:Timer = new Timer(50);
    time.addEventListener(TimerEvent.TIMER, timerHandler);
    time.start();
    function timerHandler(event:TimerEvent):void
              SoundMixer.computeSpectrum(ba, false);
              var i:int;
              gr.graphics.clear();
              gr.graphics.lineStyle(2, 0xFF0000);
              gr.graphics.beginFill(0x00ff00);
              gr.graphics.moveTo(10, 10);
              //  draw a circle.;
              var w:uint = 15;
              for (i=0; i<512; i+=w)
                        var t:Number = ba.readFloat();
                        var n:Number = (t * 200);
                        gr.graphics.drawCircle(i, 0, -n);

    Thanks, this was the code I added in the end and it works nicely, It covers my sound and id3 aswell as Im displaying lcd text in a dynamic text box.
    stage.addEventListener(KeyboardEvent.KEY_DOWN, btndownKey);
    function btndownKey(event:KeyboardEvent)
              if (event.keyCode == 83)
                        var url:String = "Savage.mp3";
                        var request:URLRequest = new URLRequest(url);
                        var s:Sound = new Sound();
                        s.addEventListener(Event.COMPLETE, completeHandler);
                        s.addEventListener(Event.ID3, onID3Info);
                        s.load(request);

  • Help with combobox event handling

    hey techies
    does knw any1 tutorial or where any URL which helps me adding event handling to combobox
    iam new at event handling
    i tried
    jc1.addItemListener(this);
    public void itemStateChanged(ItemEvent event)
              if(event.getSource()==jc1)
              System.out.println("hello");
         }is this way correct to specify event handling in combobox
    i tired this iam getting NPE like this
    Exception in thread "main" java.lang.NullPointerException
    at FinalMobile.<init>(FinalMobile.java:213)
    at FinalMobile.main(FinalMobile.java:740)
    plz jst let me knw and dnt tell me to refer swing tutorial i have been reffering it
    any help is appreciated

    does knw any1 tutorial or where any URL which helps me adding event handling to comboboxExcuse me, I've told you at least 4 times now to download and read the Swing tutorial which has all this information with working examples. I even provided you with the download link.
    How do you have the nerve to say you can't find any tutorial?

  • First Mac-need help with an "event"

    Hi:
       After 3 days of busy activity with no freeze ups, I was feeling pretty confident.  However, late last night I ran into an "event" that eventually required me to reload Tiger.
       (1) I was working along and for some reason, clicking my mouse did not have any effect on any of the programs--either those running or attempting to start new ones.  
       (2) I was able to tab through those programs running and with a command-Q quit out of those running...still no effect on any mouse clicks....no problem moving the mouse and it would highlight top left corner buttons, but no effect if I attempted to minimize or exit.
       (3) I shut the computer off and restarted a number of times....came up to the same screen each time.    Held the off button both in shutting down and starting up and this time it would go to the log on screen where I was able to type in my password.  Would come up to the same screen as I left it.
       (4) Was able to use the remote control just fine to look at pictures, etc.
       (5) After some reading, did a PRAM reset....same story as above.
       (6) Finally reloaded a new copy of Tiger and was back in business.
    Questions:
      (1) Is this the typical freeze people are getting....with PCs, when it freezes, nothing moves and when you reboot, you have a fresh start?
      (2) Short of reloading Tiger, if this happens again, what remedy (other than sending my new iMac back!) would you suggest?
    Thanks for your help!

    Many thanks for the suggestion and the giving me some hope that this is not the dreaded freeze issue!
    I forgot to mention perhaps one important bit of information: There were two Finder "windows" that were present when my "event" occurred and each time I rebooted, these same two Finder windows reappeared and my mouse was unable to move them or close them or execute any command line operations.
    Not sure if this changes the story about it being a mouse software related error or not, but I found it strange that on hard reboots the machine came back with the same two windows of information.

  • Need help with Buttons/Events

    HI
    Here is what I am doing. I am creating an "operations"
    calendar for my workplace. So far I have been successful with
    creating the page, inserting links, tags, images etc.....
    But now I want to add an Event button - where once the button
    is clicked - it will launch a script on my UNIX server.
    Cant quite figure this one out
    Any help would be greatly appreciated

    Hey man, I 've done some correction, and it seems work, why don't you try the code to see if it is what you want.
    import java.awt.*;
    import java.applet.*;
    import java.awt.event.*;
    public class ComplexMenu11 extends Applet implements ActionListener {
    Button open, close;
    MenuFrame f;
    public void init() {
    open = new Button("Open");
    add(open);
    open.addActionListener(this);
    close = new Button("Close");
    add(close);
    close.addActionListener(this);
    f = new MenuFrame("A Complex menu");
    f.setSize(200, 200);
    f.show();
    public void actionPerformed(ActionEvent evt) {
    if(evt.getSource() == open) {
    if(f.isShowing())
    f.show();
    }else{
    if(!f.isShowing())
    f.hide();
    class MenuFrame extends Frame implements ActionListener{  //and implements here too
    Font font;
    Label l;
    int fontsize;
    //MessageDialog md;
    MenuBar mb = new MenuBar();
    Menu m1 = new Menu("Colours");
    MenuFrame(String name) {
    super(name);
    m1.add(new MenuItem("White"));
    m1.add(new MenuItem("Light grey"));
    m1.add(new MenuItem("Yellow"));
    Menu m2 = new Menu("Font");
    m2.add(new MenuItem("10"));
    m2.add(new MenuItem("12"));
    m2.add(new MenuItem("14"));
    m2.add(new MenuItem("16"));
    m2.add(new MenuItem("18"));
    m2.add(new MenuItem("Message"));
    mb.add(m1);
    mb.add(m2);
    setMenuBar(mb);
    m1.addActionListener(this); //Add listener here
    l = new Label("A frame demonstration", Label.CENTER);
    add("South", l);
    //md = new MessageDialog(this,"Name",true);
    public void actionPerformed(ActionEvent evt) {
    if(evt.getSource() instanceof MenuItem) {
    //fontsize = 18;
    String label = evt.getActionCommand();
    if(label.equals("White")) {
    //setBackground(Color.white);
    System.out.println("This is the white point");
    }

  • Need help with custom event from Main class to an unrelated class.

    Hey guys,
    I'm new to Flash and not great with OOP.  I've made it pretty far with google and lurking, but I've been pulling my hair out on this problem for a day and everything I try throws an error or simply doesn't hit the listener.
    I'm trying to get my Main class to send a custom event to an unrelated class called BigIcon.  The rest of the code works fine, it's just the addEventListener and dispatchEvent that isn't working.
    I've put in the relevant code in below.  Let me know if anything else is needed to troubleshoot.  Thank you!
    Main.as
    package
        import flash.display.MovieClip;
        import flash.events.MouseEvent;
        public class Main extends MovieClip
            var iconLayer_mc:MovieClip = new MovieClip();
            public function Main()
                Spin_btn.addEventListener(MouseEvent.CLICK,fl_MouseClickHandler);
                addChildAt(iconLayer_mc,0);
                placeIcons();
            function placeIcons():void
                var i:int;
                var j:int;
                for (i = 0; i < 4; i++)
                    for (j = 0; j < 5; j++)
                        //iconString_array has the names of illustrator objects that have been converted to MovieClips and are in the library.
                        var placedIcon_mc:BigIcon = new BigIcon(iconString_array[i][j],i,j);
                        iconLayer_mc.addChild(placedIcon_mc);
            function fl_MouseClickHandler(event:MouseEvent):void
                dispatchEvent(new Event("twitchupEvent",true));
    BigIcon.as
    package
        import flash.display.MovieClip;
        import flash.events.Event;
        import flash.utils.getDefinitionByName;
        public class BigIcon extends MovieClip
            private var iconImage_str:String;
            private var iconRow_int:int;
            private var iconColumn_int:int;
            public function BigIcon(iconImage_arg:String, iconRow_arg:int, iconColumn_arg:int)
                iconImage_str = iconImage_arg;
                iconRow_int = iconRow_arg;
                iconColumn_int = iconColumn_arg;
                this.addEventListener(Event.ADDED_TO_STAGE, Setup);
            function Setup(e:Event)
                this.y = iconRow_int;
                this.x = iconColumn_int;
                var ClassReference:Class = getDefinitionByName(iconImage_str) as Class;
                var thisIcon_mc:MovieClip = new ClassReference;
                this.addChild(thisIcon_mc);
                addEventListener("twitchupEvent", twitchUp);
            function twitchUp(e:Event)
                this.y +=  10;

    Ned Murphy wrote:
    You should be getting an error for the Main.as class due to missing a line to import the Event class...
    import flash.events.Event;
    My apologies, I should attempt to compile my example code before I ask for help...
    Alright, this compiles, gives me no errors, shows my 'book' and 'flowers' icons perfectly when ran, and prints 'addEventListener' to the output window as expected.  I get no errors when I press the button, 'dispatchEvent' is output (good), but the 'twitchUp' function is never called and 'EventTriggered' is never output. 
    How do I get the 'twitchUp' event to trigger?
    Main.as
    package
        import flash.display.MovieClip;
        import flash.events.MouseEvent;
        import flash.events.*;
        public class Main extends MovieClip
            var iconLayer_mc:MovieClip = new MovieClip();
            var iconString_array:Array = new Array(2);
            public function Main()
                Spin_btn.addEventListener(MouseEvent.CLICK,fl_MouseClickHandler);
                addChildAt(iconLayer_mc,0);
                buildStringArray();
                placeIcons();
            function buildStringArray():void
                var i:int;
                var j:int;
                for (i = 0; i < 2; i++)
                    iconString_array[i] = new Array(3);
                    for (j = 0; j < 3; j++)
                        if (Math.random() > .5)
                            //'flowers' is the name of an illustrator object that has been converted to a MovieClip and is in the library
                            iconString_array[i][j] = "flowers";
                        else
                            //'book' is the name of an illustrator object that has been converted to a MovieClip and is in the library
                            iconString_array[i][j] = "book";
            function placeIcons():void
                var i:int;
                var j:int;
                for (i = 0; i < 2; i++)
                    for (j = 0; j < 3; j++)
                        //iconString_array has the names of illustrator objects that have been converted to MovieClips and are in the library.
                        var placedIcon_mc:BigIcon = new BigIcon(iconString_array[i][j],i*50,j*50);
                        iconLayer_mc.addChild(placedIcon_mc);
            function fl_MouseClickHandler(event:MouseEvent):void
                dispatchEvent(new Event("twitchupEvent",true));
                trace("dispatchEvent");
    BigIcon.as
    package
        import flash.display.MovieClip;
        import flash.events.*;
        import flash.utils.getDefinitionByName;
        public class BigIcon extends MovieClip
            private var iconImage_str:String;
            private var iconRow_int:int;
            private var iconColumn_int:int;
            public function BigIcon(iconImage_arg:String, iconRow_arg:int, iconColumn_arg:int)
                iconImage_str = iconImage_arg;
                iconRow_int = iconRow_arg;
                iconColumn_int = iconColumn_arg;
                this.addEventListener(Event.ADDED_TO_STAGE, Setup);
            function Setup(e:Event)
                this.y = iconRow_int;
                this.x = iconColumn_int;
                var ClassReference:Class = getDefinitionByName(iconImage_str) as Class;
                var thisIcon_mc:MovieClip = new ClassReference;
                this.addChild(thisIcon_mc);
                addEventListener("twitchupEvent", twitchUp);
                trace("addEventListener");
            function twitchUp(e:Event)
                this.y +=  10;
                trace("EventTriggered");
    Output:
    [SWF] Untitled-1.swf - 40457 bytes after decompression
    addEventListener
    addEventListener
    addEventListener
    addEventListener
    addEventListener
    addEventListener
    dispatchEvent
    [UnloadSWF] Untitled-1.swf
    Test Movie terminated.

  • Help with the event log in the type B hub

    I have  probs with broadband slowing down and also with link going down a number of times again (it recovers quickly)
    I just wanted to confirm that the message in trhe event log in the type B hub:-
    (134558.700000) RTNL: Received ERROR reply 'No such process' for message type 0x19
    was the link dropping.
    Can anybody confirm this and does anyone know if/where the messages are documented?
    Thanks in advance
    Banz

    does nobody have any comments on this
    Mods - please help
    banz
    ps this is my last bump - I will give up after this

  • Help with key event

    hi everyone i need some help. i have to write an java application thatcreates a panel with three labels and three key events to call upon different methods. i try to creat a JFrame but have problems. anyone can help?
    Thanks

    public class MyClass extends JFrame{
    public MyClass(){
    getContentPane().add( new Label("One") );
    getContentPane().add( new Label("Two") );
    getContentPane().add( new Label("Three") );
    setSize(400,400);
    setVisible(true);
    public static void main(String[] args){
    MyClass myclass = new MyClass();
    public static void main is the starting point of a program.
    When the frame is created using
    MyClass myclass = new MyClass();
    The control goes to the constructor where you can add three labels.
    You can add three methods to MyClass and implement KeyListener in MyClass to build upon it.

  • Help with the event of closing of fill-out form

    Hi:
    I am in need of his help, I want to grab SAP's event of impression BO, but specifically upon the assignment of folio, this since I want to create a small routine that you not leave behind to enter null values or zero, however when I press the button to close [X] in the fill-out form, this just the same assigns a value zero or void within the data base.
    That way than that you may help oneself with this I will be very grateful
    Greetings Luis

    Luis,
    The forum that you have posted your question in is for questions related to the SAP Business One Integration for SAP NetWeaver.  Is your question related to this product?
    Eddy

  • Help with getting Events into a Project please

    I apologize if this topics been covered here or somewhere else on the Apple website(s), but I cannot get my Events into a Project in iMovie. I've read the directions, watched the videos, and looked at these pages but can't seem to find an answer. At this point, all I want to do is download video from my camcorder to save it and edit later (when I have more time). I managed to download video from several events from the flash drive on my Canon Vixia HF11 and it appears in the Events library. I can play it and select clips without difficulty. I tried to select all the Events (all together and separately) to move to a project (after opening a new project), but the cursor bounces back. It will allow me to select clips but this is very cumbersome and time consuming and I don't want to edit now - I want to save all the video. The "add to project" button doesn't work. Am I missing something? There must be some way to select ALL the video in all the Events I've downloaded to put into one project. BTW, we're only talking about 40 minutes of video. If possible, please post screen shots so that I can see exactly what to do. Any help is much appreciated.

    DocRock54 wrote:
    .. to select ALL the video in all the Events I've downloaded to put into one project. ..
    no, not avail.
    and 'off'-concept of that tiny edit-app:
    when you import, you create a Library of all footage.
    iM will split these videos (by date) into seperate 'Folders' = Events.
    the idea of iM is, to offer you this Library to create a SELECTION of it for any given Project. there are very rare cases I can imagine, you add ALL material of one Event into one Project (in the Event Window hit apple-a), even a Lecture allows to edit here&there.
    but adding all material from any imports into one Project? no. no need = no feature.

  • I need help with my event-based cue points with audio

    Im having trouble with my video game project for my action script 3 class at school. Here is what i did, i made a game called Tailgate toss up. I filmed my character and rendered it in Adobe Premiere. I than brought my .mov file into After Effects and I put event-based cue points-
    my first cue point at 0:00:03:13 called "loop"
    my second cue point at 00:00:03:27 called "draw"
    my third cue point at 00:00:05:24 called "bang"
    my fourth cue point at 00:00:13:29 called "dead"
    my fifth cue point at 00:00:14:29 called "You Lose"
    my last cue point at 00:00:19:14 called "End"
    Here is my action script 3 code
    ///first frame:
    start_btn.addEventListener(MouseEvent.CLICK, startGame);
    function startGame(event:MouseEvent){
    gotoAndStop(2);
    SoundMixer.stopAll()
    stop();
    ///second frame:
    stop();
    var loopTime
    var hitHim:Boolean = false;
    var vConnection:NetConnection = new NetConnection();
    vConnection.connect(null);
    var vStream:NetStream = new NetStream(vConnection);
    var client:Object = new Object();
    client.onCuePoint = onCuePoint;
    vStream.client = client;
    var myVideo:Video = new Video(418, 480);
    myVideo.y = 0;  ///this adjusts where the video is, right now it is the size of the canvas which is 418,480
    addChild(myVideo);
    myVideo.attachNetStream(vStream);
    vStream.play("michelle.flv");
    var throw_bottle:Sound
    throw_bottle = new Sound(new URLRequest("audio/throw_bottle.mp3")); //change to button noise, will add sound into ae file
    target_mc.addEventListener(MouseEvent.CLICK, shoot);
    target_mc.buttonMode = true;
    target_mc.visible = false;
    draw_mc.visible = false;
    function onCuePoint(cuePoint:Object):void {
       if(cuePoint.name == "loop"){
    loopTime = cuePoint.time;
        if(cuePoint.name == "draw"){
    var randomLoop:Number = Math.random()*10;
    if(randomLoop > 2){
    vStream.seek(loopTime);
    }else{
    setChildIndex(target_mc, numChildren - 1);  
    setChildIndex(draw_mc, numChildren - 1);    
    target_mc.visible = true;
    draw_mc.visible = true;
    if(cuePoint.time == "5:24"){
    draw_mc.visible = false;
    target_mc.visible = false;
    if(!hitHim){
    vStream.seek(15);    
    if(cuePoint.name == "dead"){
    vStream.close();
    myVideo.clear();
    gotoAndStop(3);
    if(cuePoint.name == "end"){
    gotoAndStop(3);
    function shoot(event:MouseEvent){
    throw_bottle.play();
    hitHim = true;
    ///my third and last frame
    playAgain_btn.addEventListener(MouseEvent.CLICK, playAgain);
    function playAgain(event:MouseEvent){
    gotoAndStop(2);
    SoundMixer.stopAll()
    stop();
    When I have no audio it works perfectly, no problems. When I bring audio in i re-render it as a .mov file and bring it back into After Effects and add the cue points to it. Than i re-render it out again as a flv file. When i bring it into my flash project it will work when the looping variable does just one loop and my target will appear so you can click on it or not. But when the looping variable makes it loop 2 to 10 times it skips over the catching (the part of the clip if you clip the button) and goes directly to the dropping of the can, not giving you the option of clicking the button. So basically it skips the "draw" or second cue point of my game and goes to "You Lose" cue point.
    Any suggestions?

    Hi,
    The latest audio driver for your machine is on the following link.
    http://ftp.hp.com/pub/softpaq/sp59501-60000/sp59649.exe
    Regards,
    DP-K
    ****Click the White thumb to say thanks****
    ****Please mark Accept As Solution if it solves your problem****
    ****I don't work for HP****
    Microsoft MVP - Windows Experience

  • Help with organizing events in iPhoto

    I'd like to create individual, personalized events in my iPhoto but I cannot figure out how to do this. create.  It seems that the events are currently organized by way of when they were downloaded.  I'd like to essentially pick these disorganized events apart and make my own folders.  It's probably a simple fix but I can not seem to figure it out.   

    Are you wanting to create Albums instead? Events are created by options you have set up in your Preferences. You can rename them, but I'm thinking that what you are describing are Albums. If so then this link should help:
    iPhoto 9.5: Create or change a standard photo album
    Cheers,
    GB

  • Help with windowClosing event

    I'm getting an error and I'm not sure how to fix it. When I compile, I get this:
    C:\Program Files\Xinox Software\JCreator LE\MyProjects\OctagonDrag\OctagonDrag.java:54: OctagonDrag.CloseWindow is not abstract and does not override abstract method windowOpened(java.awt.event.WindowEvent) in java.awt.event.WindowListener
         class CloseWindow implements WindowListener {
    Here's my code. If anyone can help, I'd be grateful.
    import java.awt.*;
    import java.awt.event.*;
    import java.applet.Applet;
    public class OctagonDrag extends Frame
         implements MouseMotionListener {
         private int [] x = {150,175,175,150,100,75,75,100};
         private int [] y = {150,175,175,150,100,75,75,100};
         private Polygon p = new Polygon(x,y,8);
         private int oldx; //Saves previous Polygon position
         private int oldy;
         private Label displayCountLabel = new Label("Number of valid mouse drags");
         private TextField displayCount = new TextField(5);
         public void init() {
              addMouseListener(new MousePressListener());
              addMouseMotionListener(this);
              Panel bar = new Panel();
              bar.add(displayCountLabel);
              bar.add(displayCount);
              add(bar,"North");
         public void paint(Graphics g) {
              g.fillPolygon(p);
         public void mouseMoved(MouseEvent event) { }
         public void mouseDragged(MouseEvent event) {
              int x = event.getX();
              int y = event.getY();
              if (p.contains(x,y)) {
                   p.translate(x - oldx, y - oldy);
                   oldx = x;
                   oldy = y;
                   repaint();
         class MousePressListener extends MouseAdapter {
              public void mousePressed(MouseEvent event) {
                   int x = event.getX();
                   int y = event.getY();
                   if (p.contains(x,y)) {
                        oldx = x;
                        oldy = y;
         class CloseWindow implements WindowListener {
              public void windowClosing(WindowEvent event) {
                   System.exit(0);
         public static void main(String [] args) {
    }

    Instead of implementing WindowListener, you can extend WindowAdapter
    so I need to implement method you need and don't have to implement all other method
    in the WindowListener
    here is the sample of extending WindowAdapter
    good luck
    background:
    WindowListener interface has 7 methods, so if you implements WIndoListener you have to implement
    all 7 methods otherwise, the compiler will complains
    class CloseWindow extends WindowAdapter
              public void windowClosing(WindowEvent event)
                   System.exit(0);
         }

  • Need Help with Random Events in Actionscript 2

    I'm working on a game in flash right now, written in actionscript 2, where bottles fall from above at random speeds, and the object is to shoot the bottles as they fall, and every time you hit a bottle a different message appears on the screen for a brief period of time before disappearing.  So far I'm able to make the bottles fall and I'm able to shoot and break them, but I don't know how to work it so a different message appears each time you shoot a bottle. 
    Can anyone help me with this problem?  I'm attaching the file of what I have so far.

    My first question would be, when you say "different message appears" each time you hit a bottle.
    What are the messages and do you want them to be random, and where will they appear.
    After looking at your code, the best place I can see to place your message trigger is within the hit test. From there its a somple case of calling a function to display your message.

  • Help with removing event from calendar

    Hello everyone I'm adding a simple feature in my xcode ios app that has a UISwitch. When the UISwitch is on an event is created (this part works fine). But when I turn the UISwitch off I cannot find a way to remove the event. If I use code in the second if statement to remove the event, the event identifier is undeclared because it is in a separate if statement. Can someone please tell me what code I need to remove the event.
    Code:
    - (IBAction)switchon:(id)sender {
        if (switchoutlet.on) {
            EKEventStore *store = [[EKEventStore alloc] init];
            [store requestAccessToEntityType:EKEntityTypeEvent completion:^(BOOL granted, NSError *error) {
                if (!granted) { return; }
                EKEvent *event = [EKEvent eventWithEventStore:store];
                event.title = @"Event A";
                event.startDate = [NSDate dateWithTimeIntervalSince1970:1406948400]; //today
                event.endDate = [event.startDate dateByAddingTimeInterval:60*60];  //set 1 hour meeting
                EKAlarm *alarm = [EKAlarm alarmWithRelativeOffset:-60*10];
                event.alarms = [NSArray arrayWithObject:alarm];
                [event setCalendar:[store defaultCalendarForNewEvents]];
                NSError *err = nil;
                [store saveEvent:event span:EKSpanThisEvent commit:YES error:&err];
                NSString *savedEventId = event.eventIdentifier;  //this is so you can access this event later
        if (!switchoutlet.on) {
            //remove event

    Ben Pleysier wrote:
    Be patient!
    For about 7 years!!!!!!!!!!!
    Once something is on the Internet, it remains so.  That is why people (mainly children) are always advised not to post anything that they may come to regret in a few years time when you are looking for jobs and your potential employer does a background search on you.

Maybe you are looking for

  • How do you get your iphone not to restart

    i kinda messed up. i wanted to downlod the new update the ios 7.0.2 and it went to conect to itune mode and i dont want to restart because i have very important stuff from work that i did not write down.. i need help.

  • Query task based on payload (urgent and not getting any solution)

    Hi, I m creating a task in BPEL process with following payload. <?xml version="1.0" encoding="UTF-8"?> <schema attributeFormDefault="unqualified" elementFormDefault="qualified" targetNamespace="http://xmlns.oracle.com/RegistrationUpload_jws/Registrat

  • Tell me if my idea is wrong

    Hi ; I'm work in simple web application and MySQL DB, and create managed-bean that hold data from DB (session and request) and I need some ideas my first idea : I make class and all method in this class public static that method check if the array em

  • Raw file thumbnail and preview problem in Bridge

    When downloading raw files from my new Nikon D3, Bridge generates thumbnails that are a fixed size and the preview panel only shows a thumbnail as opposed to enlarging the image to fit the preview panel. Thumbnails and Preview still work fine with jp

  • Why can't ID "verify the serial number"?

    Adobe InDesign CS. Mac G5. Tiger final version. Just got the message that my serial number needs to be verified and to reinstall. I've opened this copy countless times. I recall very vaguely that this happened once befroe and I had to trash a p-list