2 NSRuleEditor questions?
-
Hi
Hi I have 2 questions related to NSRuleditor (not NSPRedicateEditor);
- On one side, I can not find the format of a formattingDictionary for
a NSRuleEditor. If I look at the doc the only thing I find is
" The formatting dictionary should have NSString keys and NSString
values. The syntax of the keys and values is the same as the syntax
for strings files."
But I admit I find this more confusing than helpful.
- On the second side I never see the delegate method being called like
for numberOfChildrenForCriterion. Could it be related that the
formattingDictionary of the NSRuleEditor is nil (my first question)?
I also looked at the PDF from WWDC 2007 which mentions NSRuleEditor
("Beyond BUttons and slider..."), but without success
Thanks
laurent -
On Jun 19, 2008, at 2:19 PM, Laurent Cerveau wrote:
> Hi
>
> Hi I have 2 questions related to NSRuleditor (not NSPRedicateEditor);
> - On one side, I can not find the format of a formattingDictionary
> for a NSRuleEditor. If I look at the doc the only thing I find is
> " The formatting dictionary should have NSString keys and NSString
> values. The syntax of the keys and values is the same as the syntax
> for strings files."
> But I admit I find this more confusing than helpful.
> - On the second side I never see the delegate method being called
> like for numberOfChildrenForCriterion. Could it be related that the
> formattingDictionary of the NSRuleEditor is nil (my first question)?
>
> I also looked at the PDF from WWDC 2007 which mentions NSRuleEditor
> ("Beyond BUttons and slider..."), but without success
>
> Thanks
>
> laurent
Hi Laurent,
The formatting dictionary is used for localization. You can see a
sample at http://homepage.mac.com/gershwin/NibBasedSpotlightSearcher.zip
A nil formatting dictionary should be fine. The delegate methods are
probably not being called because the rule editor has no rows in it.
Try hooking up a button to its addRow: method.
-Peter -
Hi Peter
>
> The formatting dictionary is used for localization. You can see a
> sample at http://homepage.mac.com/gershwin/NibBasedSpotlightSearcher.zip
Nice! Thanks for the pointer.
>
> A nil formatting dictionary should be fine. The delegate methods
> are probably not being called because the rule editor has no rows in
> it. Try hooking up a button to its addRow: method.
This helps! However this brings me one question. I donot get exactly
what is the exact purpose of "- (NSInteger)ruleEditor:(NSRuleEditor
*)editor numberOfChildrenForCriterion:(id)criterion withRowType:
(NSRuleEditorRowType)rowType" if rows needs to be added with addRow? I
have more in mind on the NSTableView paradigm where data reloading is
the "main trigger", and here obviously this is not the case. Where is
my mistale in "comparing" with an NSTableView datasource?
Thanks
laurent -
Hi, Laurent. I realize this is quite old, but I have been wrestling with
NSRuleEditor myself for a while. The main difference between NSTableView and
NSRuleEditor is that NSRuleEditor is more accurately understood as a tree or
network whereas NSTableView is a multi-dimensional array, [rows][columns].
As you change the selections in the NSRuleEditor it re-queries the delegate
for the display values for the children. When I diagramed the architecture
of my NSRuleEditor as a tree/network, it made a lot more sense. Start with
the root as nil.
Hope this helps.
On Thu, Jun 19, 2008 at 5:42 PM, Laurent Cerveau <lcerveau...> wrote:
> Hi Peter
>
>
>> The formatting dictionary is used for localization. You can see a sample
>> at http://homepage.mac.com/gershwin/NibBasedSpotlightSearcher.zip
>>
>
> Nice! Thanks for the pointer.
>
>
>> A nil formatting dictionary should be fine. The delegate methods are
>> probably not being called because the rule editor has no rows in it. Try
>> hooking up a button to its addRow: method.
>>
>
> This helps! However this brings me one question. I donot get exactly what
> is the exact purpose of "- (NSInteger)ruleEditor:(NSRuleEditor *)editor
> numberOfChildrenForCriterion:(id)criterion
> withRowType:(NSRuleEditorRowType)rowType" if rows needs to be added with
> addRow? I have more in mind on the NSTableView paradigm where data reloading
> is the "main trigger", and here obviously this is not the case. Where is my
> mistale in "comparing" with an NSTableView datasource?
>
> Thanks
>
> laurent
>
--
::::::::::::::::::::::::::::::::::::::::::::::::::::::
Jamie Phelps
PO Box 12564
Fort Worth, TX 76110
(817) 673-0036
http://www.jamiephelps.com



