So, this is what a formatter method that successfully works for floating point 
looks like in this case:

                                control = [[NSTextField alloc] 
initWithFrame:NSMakeRect(0, kVOffset + totalHeight - 3, kDefaultWidth, 19)];
                                [[control cell] setWraps:NO];
                                [[control cell] setScrollable:YES];
                                [[control cell] setFont:[NSFont 
systemFontOfSize:[NSFont smallSystemFontSize]]];
                                
                                formatter = [NSNumberFormatter new];
                                
                                [formatter 
setFormatterBehavior:NSNumberFormatterBehavior10_4];
                                [formatter setMinimumFractionDigits:0];
                                [formatter setMaximumFractionDigits:20];

                                [formatter 
setNumberStyle:kCFNumberFormatterDecimalStyle];

                                [formatter setMinimum:minNumber];
                                [formatter setMaximum:maxNumber];
                                [[control cell] setFormatter:formatter];
                                [formatter release];
                                [[control cell] setSendsActionOnEndEditing:YES];



Where maximum fraction digits helps control... the maximum fraction digits 
obviously :-)  (In some cases QC truncates this in weird lengths for the 
purpose of display, so this was a little interesting find). What's crucial is 
setting the formatter behavior and decimal style.

BTW, I noticed that the version of the QCTV project that's on the ADC seems to 
be older than the one that was in the 10.5 Developer Examples folder. The one 
at the ADC seems to be from the WWDC from back then.

-gt

On Apr 14, 2012, at 12:11 AM, Achim Breidenbach wrote:

> Hello George,
> 
> maybe you can debug and check with -(NSUInteger)maximumFractionDigits what 
> the current value of your "formatter" is, and set it with 
> -(void)setMaximumFractionDigits:(NSUInteger)number to a certain number?
> 
> Just a guess, I am no expert in UI programming.
> 
> best,
> 
> Achim Breidenbach
> Boinx Software
> 
> On 13.04.2012, at 23:19, George Toledo wrote:
> 
>> The Apple QCTV example has some code like this in Composition Parameters 
>> View.m
>> 
>> else if([type isEqualToString:QCPortTypeNumber]) {
>>                      minNumber = [inputAttributes 
>> objectForKey:QCPortAttributeMinimumValueKey];
>>                      maxNumber = [inputAttributes 
>> objectForKey:QCPortAttributeMaximumValueKey];
>>                      if(minNumber && maxNumber) {
>>                              control = [[NSSlider alloc] 
>> initWithFrame:NSMakeRect(0, kVOffset + totalHeight, kDefaultWidth, 15)];
>>                              [[control cell] 
>> setControlSize:NSSmallControlSize];
>>                              [(NSSlider*)control setMinValue:[minNumber 
>> doubleValue]];
>>                              [(NSSlider*)control setMaxValue:[maxNumber 
>> doubleValue]];
>>                      }
>>                      else {
>>                              control = [[NSTextField alloc] 
>> initWithFrame:NSMakeRect(0, kVOffset + totalHeight - 3, kDefaultWidth, 19)];
>>                              [[control cell] setWraps:NO];
>>                              [[control cell] setScrollable:YES];
>>                              [[control cell] setFont:[NSFont 
>> systemFontOfSize:[NSFont smallSystemFontSize]]];
>>                              formatter = [NSNumberFormatter new];
>>                              [formatter setMinimum:minNumber];
>>                              [formatter setMaximum:maxNumber];
>>                              [[control cell] setFormatter:formatter];
>>                              [formatter release];
>>                              [[control cell] setSendsActionOnEndEditing:YES];
>>                      }
>>                      [control setAutoresizingMask:NSViewWidthSizable];
>>                      totalHeight += 25;
>>              }
>> 
>> 
>> My "problem" is, that the created "Inspector" turns floating point values 
>> that are entered in, into Integer. I've tried fiddling with a few things 
>> with no success, I think just because I've gotten some syntax wrong 
>> somewhere.
>> 
>> Does anyone know how to fix it so that I can get floating point values 
>> working?
>> 
>> Thanks,
>> gt
>> _______________________________________________
>> Do not post admin requests to the list. They will be ignored.
>> Quartzcomposer-dev mailing list      ([email protected])
>> Help/Unsubscribe/Update your Subscription:
>> https://lists.apple.com/mailman/options/quartzcomposer-dev/achim%40boinx.com
>> 
>> This email sent to [email protected]
> 


 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Quartzcomposer-dev mailing list      ([email protected])
Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/quartzcomposer-dev/archive%40mail-archive.com

This email sent to [email protected]

Reply via email to