[Mono-osx] [MonoMac] NSPredicateEditor Control and Sample

Miguel de Icaza miguel at novell.com
Tue Nov 30 10:50:48 EST 2010


The sample shows how to use the NSPredicateEditor within a program and uses
> the NSMetadataQuery to query SpotLight for a list of names corresponding to
> the Predicates from your Address Book.

A reminder: we never expose the underlying arrays as NSArray, instead we
expose them as NSObject [] in the weak cases, and as NSMostDerived [] most
of the time to get the advantage of strong typing.

In particular in the NSPredicate code, you need to fix:

TemplateViews return value - Also, it needs to become a property
PredicateWithSubpredicates - with the proper strong type parameter
DisplaableSubpredicatesOfPredicate - Strongly type return
Constructors - arguments are weakly typed NSArrays
LeftExpressions, Rightexpressions - array types and must be properties,
RighExpressionAttributeType - must become a property
Modifier - must become a property
Operators - must become a property and become strongly typed
Options - strongly type and become a property, and explore whether ti can be
turned into an int [1]
CompoundTypes - array type
TemplatesWithAttributeKeyPathsInEntityDescription - both the array type
issue and the name should be C#-ified

CriteriaForRow - array type
InsertRowAtIndexeWithTypeasBlaBlaBla - Shorten to be C#-like, not be a clone
of the ObjC aapi


The lesson here is that the signature of the methods is required in
Objective-C as people mix a lot of responders in the same file so they need
to be unique, and they kind of become unique by using the prefix of the
class, but this is not necessary in MonoMac.   You would use these as
events, so the name must make sense as an event.   For example:

RuleEditorNumberOfChildrenForCriteriorWithRowType really is merely a
compressed name of 3 parameters in ObjC: the first which is the prefix and
we do not care about, the second is the actual oepration, and the third is
the paramter.   So this really should become

int NumberOfChildren (NSRuleEditor ruleEditor, NSObject forCriterion,
NSRuleEditorRowType withRowType)

[1] In general, uints are not CLS-compliant, which means that some languages
have trouble accessing those APIs, we need to explore whether a Flags or int
is sufficient in those cases.

RowTemplates - array type
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.ximian.com/pipermail/mono-osx/attachments/20101130/7cd348b8/attachment.html 

More information about the Mono-osx mailing list