Re: display int in cocoa
Re: display int in cocoa
- Subject: Re: display int in cocoa
- From: John Stiles <email@hidden>
- Date: Wed, 10 Oct 2007 11:15:11 -0700
Try an NSTextField. An NSTextView is a little more complicated than
what you need in this case.
FWIW your casting code is completely broken, don't even try to go
down that route. initWithFormat is more on the right track.
On Oct 10, 2007, at 11:10 AM, Erfan Aleemullah wrote:
Hi,
I am trying to display an int as a page number in cocoa so the user
knows
which page he is currently on.
the page number automatically increments itself.
I looked into NSTextview but could not get it to work. Most
methods accept
type NSString in their setTitle or similar function- so is there a
way to
cast an int to NSString?
What would be the best way to display the int in cocoa ?
Error casting code:
int x = 0;
char *a =(char *)x;
NSString* temp2 = [[NSString alloc] initWithCString: a];
I am currently achieving this effect using setTitle of NSButton
class and
using a disabled NSButton as the output for the page number.
current = [[NSString alloc] initWithFormat:@"%d",page];
[CurrentPage setTitle:current];
[current release];
Thanks.
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
40blizzard.com
This email sent to email@hidden
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden