• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Problems
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Problems


  • Subject: Re: Problems
  • From: Brian Webster <email@hidden>
  • Date: Mon, 8 Jul 2002 13:55:40 -0500

On Monday, July 8, 2002, at 11:58 AM, cocoa-dev-
email@hidden wrote:

1)
My first app is an HTML Editor. I've created a palette to where there are
several buttons. For example clicking the "Bold" one the app should insert
<b> and </b>.

I've used this method:

- (void)tagBold:(id)sender
{
[VisoreTesto insertText:@"<b></b>"];
}

but first I want that the cursor go between the two tags. Second with this
method when I click a button of the palette then I must bring to front the
editor before typing again.

Look at selectedRange and setSelectedRange: in NSTextView. You can get the location of the current selection, insert your text, and then set a new selection so that the cursor is between the two tags (e.g. for bold, the old selected range location + 3, with a selection length of 0). To bring the window to the front, send a makeKeyAndOrderFront: message to it.


2)
I used this method to create a preview of the file. It's all right, but if
the file isn't saved yet it doesn't run properly. I want that, if the path
is empty, the app show a Message Box (better if it's a sheet) with only the
button "Ok" saying "Save file before making a preview".

Try NSBeginAlertSheet(). Lots of arguments, but you can pass NULL for a bunch of them. Look at the docs for functions at the bottom of the main AppKit docs page to see what to pass in.

--
Brian Webster
email@hidden
http://homepage.mac.com/bwebster
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.

  • Prev by Date: Re: fill tableview exactly with tablecolumns
  • Next by Date: Re: How to support clicks in a non-selectable NSTextView?
  • Previous by thread: Problems
  • Next by thread: Developer Coy of jaguar
  • Index(es):
    • Date
    • Thread