Re: [us...@lists.monobjc.net] NSStatusbar code doesn't work

2010-01-31 Thread Laurent Etiemble
Hello,

It seems that you have forgotten to retain the status item right after
its creation. Moreover, some code seems redundant (the first line is
not necessary).

I suggest you to read this tutorial about NSStatusItem:
http://www.mactech.com/articles/mactech/Vol.24/24.07/NSStatusitem/index.html
. It can help you in case of trouble.

Regards, Laurent Etiemble.

2010/1/29 Yvan Janssens y...@yvansoftware.be:
 Hi,

 I'm calling the following code in a AwakeFromNib:

                        _statusItem = new NSStatusItem();
                        NSMenu menu = new NSMenu();
                        _statusItem = 
 NSStatusBar.SystemStatusBar.StatusItemWithLength(32);
                        _statusItem.Image = NSImage.ImageNamed(twitter);
                        NSMenuItem menuItem = new NSMenuItem(Send tweet!,new 
 IntPtr(),);
                        menuItem.ActionEvent += new 
 ActionEventHandler(showTweetWindow);
                        menu.AddItem(menuItem);
                        _statusItem.Menu = menu;

 What am I doing wrong to get my NSStatusItem? I translated this code
 from an Objective-C sample...

 Yvan



[us...@lists.monobjc.net] Overided KeyUp doesn't get called

2010-01-31 Thread Yvan Janssens
Hi,

In the following source file, I get the following unexpected behavior:


using System;
using Monobjc;
using Monobjc.Cocoa;
namespace YvanSoftware.TwitMenu
{

[ObjectiveCClass(LengthField)]
public class NSTextField_Length : NSTextField
{
const int maxLength = 160;

[ObjectiveCField(lblNumOfChars)]
public NSTextField lblNumOfChars;

public NSTextField_Length () : base()
{
}

public NSTextField_Length (IntPtr i)
:base(i)
{
}


public override void KeyUp (NSEvent theEvent)
{
base.KeyUp (theEvent);
keyUpHandler();
}



void keyUpHandler() {

Console.WriteLine(*** keyUp ***); // Never shows up...
if (this.StringValue.Length = maxLength) {
this.StringValue = 
this.StringValue.SubstringToIndex(maxLength);
}
lblNumOfChars.StringValue = Chars:  +
this.StringValue.Length.ToString() + / + maxLength.ToString();
}
}
}

I commented where the error takes place: the line ***keyUp*** never
shows up, but if I put it in the constructors such a statement, it
gets properly executed.

What do I need to do?

Thanks,

Yvan


Re: [us...@lists.monobjc.net] Monobjc Growl Bridge

2010-01-31 Thread Laurent Etiemble
Hello,

Tthe notification name used for posting the notification in your
controller does not match any of the notification names declared in
your Growl Registration Ticket.growlRegDict file; in your code, you
are using iSystemState but it is not defined in the registration
file. Change it to match one of the notification names (Refresh OK,
Refresh Failed or Beginning Refresh).

Regards, Laurent Etiemble.

2010/1/31 Yvan Janssens y...@yvansoftware.be:
 Hi,

 If I compile and run the sample, it works. But when I translate the
 code to my app, I don't get the notifications.

 Here's my project:
 http://cid-322d817c77cdfa83.skydrive.live.com/self.aspx/.Public/iSystemState.zip?authkey=P!1Ml5gIxYk%24

 Thanks!!



Re: [us...@lists.monobjc.net] Overided KeyUp doesn't get called

2010-01-31 Thread Laurent Etiemble
Hello,

You have forgotten to export the method override with the
ObjectiveCMessage attribute. Without this attribute, the method is not
exposed in the Objective-C runtime.

[ObjectiveCMessage(keyUp:)] // -- Mandatory attribute
                public override void KeyUp (NSEvent theEvent)
                {
                        base.KeyUp (theEvent); // -- Don't call base.
Use this.SendMessageSuper()
                        keyUpHandler();
                }

Note that you cannot make calls with the base specifier, as you are
using wrappers. Please use this.SendMessageSuper() as stated in the
documentation (http://www.monobjc.net/index.php?page=messaging).

Regards, Laurent Etiemble.

2010/1/31 Yvan Janssens y...@yvansoftware.be:
 Hi,

 In the following source file, I get the following unexpected behavior:


 using System;
 using Monobjc;
 using Monobjc.Cocoa;
 namespace YvanSoftware.TwitMenu
 {

        [ObjectiveCClass(LengthField)]
        public class NSTextField_Length : NSTextField
        {
                const int maxLength = 160;

                [ObjectiveCField(lblNumOfChars)]
                public NSTextField lblNumOfChars;

                public NSTextField_Length () : base()
                {
                }

                public NSTextField_Length (IntPtr i)
                        :base(i)
                {
                }


                public override void KeyUp (NSEvent theEvent)
                {
                        base.KeyUp (theEvent);
                        keyUpHandler();
                }



                void keyUpHandler() {

                        Console.WriteLine(*** keyUp ***); // Never shows 
 up...
                        if (this.StringValue.Length = maxLength) {
                                this.StringValue = 
 this.StringValue.SubstringToIndex(maxLength);
                        }
                        lblNumOfChars.StringValue = Chars:  +
 this.StringValue.Length.ToString() + / + maxLength.ToString();
                }
        }
 }

 I commented where the error takes place: the line ***keyUp*** never
 shows up, but if I put it in the constructors such a statement, it
 gets properly executed.

 What do I need to do?

 Thanks,

 Yvan