Hello,

Is this a copy/paste effect or your datasource methods are not public
? In order to be exported, the methods tagged with "ObjectiveCMessage"
must be public.

Moreover, by setting the environment variable MONOBJC_DEBUG to 3, you
can see what the bridge exports for each classes; see
http://www.monobjc.net/index.php?page=advanced-debugging for more
information.

Regards, Laurent Etiemble.

2009/8/27 ROUTE 66 - Marius Golea <mgo...@route66.ro>:
> Hi
>
>
>
> I want to set a data source for a combo box, but when I run the application
> I receive the following error.
>
>
>
> $ ../../dist/ComboBoxSample.app/Contents/MacOS/ComboBoxSample
>
> 2009-08-27 11:58:11.279 ComboBoxSample[702:613] *** Illegal NSComboBox data
> source (<Controller: 0x996960>).  Must implement numberOfItemsInComboBox:
> and comboBox:objectValueForItemAtIndex:
>
>
>
> In IB I checked “use data source” checkbox and I set the dataSource and
> delegate outlets of the NSComboBox to Controller (I saw this in a simple
> cocoa example). I’ve implemented numberOfItemsInComboBox: and
> comboBox:objectValueForItemAtIndex:  in controller class.
>
>
>
>
>
> Controller class looks like:
>
>
>
>     [ObjectiveCClass]
>
>     public class Controller : NSObject
>
>     {
>
>         private static readonly Class ControllerClass =
> Class.GetClassFromType(typeof (Controller));
>
>
>
>         public Controller() {}
>
>
>
>         public Controller(IntPtr nativePointer)
>
>             : base(nativePointer) {}
>
>
>
>         [ObjectiveCMessage("awakeFromNib")]
>
>         public void AwakeFromNib()
>
>         {
>
>         }
>
>
>
>         [ObjectiveCMessage("dealloc", SynchronizeFields = false)]
>
>         public override void Dealloc()
>
>         {
>
>             this.SendMessageSuper(ControllerClass, "dealloc");
>
>         }
>
>
>
>         [ObjectiveCMessage("comboBox:completedString:")]
>
>         NSString ComboBoxCompletedString(NSComboBox aComboBox, NSString
> uncompletedString)
>
>         {
>
>             Console.WriteLine("* comboBox:completedString:");
>
>             return null;
>
>         }
>
>
>
>         [ObjectiveCMessage("comboBox:indexOfItemWithStringValue:")]
>
>         uint ComboBoxIndexOfItemWithStringValue(NSComboBox aComboBox,
> NSString aString)
>
>         {
>
>             Console.WriteLine("* comboBox:indexOfItemWithStringValue:");
>
>             switch (aString)
>
>             {
>
>                 case "0":
>
>                     return 0;
>
>                 case "1":
>
>                     return 1;
>
>                 case "2":
>
>                     return 2;
>
>                 case "3":
>
>                     return 3;
>
>                 default:
>
>                     return 0;
>
>             }
>
>         }
>
>
>
>         [ObjectiveCMessage("comboBox:objectValueForItemAtIndex:")]
>
>         Id ComboBoxObjectValueForItemAtIndex(NSComboBox aComboBox, int
> index)
>
>         {
>
>             Console.WriteLine("* comboBox:objectValueForItemAtIndex:");
>
>             switch (index)
>
>             {
>
>                 case 0:
>
>                     return new NSString("0");
>
>                 case 1:
>
>                     return new NSString("1");
>
>                 case 2:
>
>                     return new NSString("2");
>
>                 case 3:
>
>                     return new NSString("3");
>
>                 default:
>
>                     return null;
>
>             }
>
>         }
>
>
>
>         [ObjectiveCMessage("numberOfItemsInComboBox:")]
>
>         int NumberOfItemsInComboBox(NSComboBox aComboBox)
>
>         {
>
>             Console.WriteLine("* numberOfItemsInComboBox:");
>
>             return 4;
>
>         }
>
>     }
>
>
>
>
>
> Sample project can be downloaded from
> http://rapidshare.com/files/271979164/ComboBoxSample.zip.html
>
>
>
> Can someone tell me what is wrong or how can I set a data source to work?
>
> I’ve also tried to set data source to NSOutlineView but I had the same
> problem.
>
>
>
> Thanks in advance.
>
>
>
> Best regards,
>
>                 Marius

Reply via email to