Hi, How can i change a normal font to bold font, Here the text should be selected and say by clicking the button(Bold) button. the selected text should become bold.
The Cocoa text system already provides a wide array of subsystems for modifying attributed strings and text. You should probably look into using NSTextView before you go rolling your own systems.
However: You might want to look into the NSAttributedString
API. You should find it enlightening.
Did you look at the "Format" menu in your main menu? There's one called "Bold". You should look at the method that is hooked to that menu item. It's probably some method that's part of "First Responder". If so then hook your button up to "First Responder" and then select that method for the button.
bold menu hook to font manager not to first responder. just create a button and set the tag as 2, then hook the button to font manager and select addFontTrait: action.