Well, honestly I don't know what happened to a similar thread I posted yesterday. I searched and searched for it but I couldn't find it anywhere. This is a better section for me to post it under anyway, I guess. My apologies to Arn if my old post is stil present. It certanly may be deleted. Ok, on to the question:
I have just started programming in objective c after a couple of years in procedural c in mac os 9. I have been following Learning Cocoa by O'Reilly but decided that I wanted to try writing my own type of program. I have learned a lot in this exploit but have one main problem which is probably very easily solved:
I am writing a text-based rpg having a gui which consists of a text view to display all of the games text, a text field where the player types and a button that runs everything. I have gotten everything to work except some minor issues with the text view. My first problem was that I couldn't figure out how to "insert" text into the text view but I solved it with this code which I figured out:
- (void)addtexttodisplayNSString *)textToAdd
{
originaltext = [displayText string];
totaltext = [NSString stringWithFormat: @"%@%@",originaltext,textToAdd];
[displayText setString:totaltext];
}
displayText is the name of the text view. My only problem with this code is that once enough text is displayed to fill the text view, the new text is hidden and the player is required to scroll down to view it. I find this really annoying and am sure that there must be a better way of doing things. If you have any experience in cocoa, please help me . Thanks.
Over all I think that cocoa is a pretty neat language even though it is completely different that the languages that I am used to. I do think that it will cut down a lot on the tediousness which will be awesome. I just wish it were a little more like procedural c.....
Well anyway, thanks in advance for answering my question and sorry if my old one turns up
I have just started programming in objective c after a couple of years in procedural c in mac os 9. I have been following Learning Cocoa by O'Reilly but decided that I wanted to try writing my own type of program. I have learned a lot in this exploit but have one main problem which is probably very easily solved:
I am writing a text-based rpg having a gui which consists of a text view to display all of the games text, a text field where the player types and a button that runs everything. I have gotten everything to work except some minor issues with the text view. My first problem was that I couldn't figure out how to "insert" text into the text view but I solved it with this code which I figured out:
- (void)addtexttodisplayNSString *)textToAdd
{
originaltext = [displayText string];
totaltext = [NSString stringWithFormat: @"%@%@",originaltext,textToAdd];
[displayText setString:totaltext];
}
displayText is the name of the text view. My only problem with this code is that once enough text is displayed to fill the text view, the new text is hidden and the player is required to scroll down to view it. I find this really annoying and am sure that there must be a better way of doing things. If you have any experience in cocoa, please help me . Thanks.
Over all I think that cocoa is a pretty neat language even though it is completely different that the languages that I am used to. I do think that it will cut down a lot on the tediousness which will be awesome. I just wish it were a little more like procedural c.....
Well anyway, thanks in advance for answering my question and sorry if my old one turns up