Recent

Author Topic: Activate the find panel of NSTextView  (Read 171 times)

maxnd

  • Jr. Member
  • **
  • Posts: 73
Activate the find panel of NSTextView
« on: June 02, 2026, 05:26:30 pm »
Hi, so I'm improving a Markdown editor for Mac using Lazarus 4.5 and Cocoa framework. I've a TMemo component on a form, called dbText, and I set all its properties in this way:

Code: Pascal  [Select][+][-]
  1. TCocoaTextView(NSScrollView(dbText.Handle).documentView).
  2.   setRichText(True);
  3. TCocoaTextView(NSScrollView(dbText.Handle).documentView).textContainer.
  4.   setLineFragmentPadding(50);
...and so on. Now I want to activate the find panel or the find bar of the dbText component, but if I call

Code: Pascal  [Select][+][-]
  1. TCocoaTextView(NSScrollView(dbText.Handle).documentView).
  2.   setUsesFindPanel(True);

or

Code: Pascal  [Select][+][-]
  1. TCocoaTextView(NSScrollView(dbText.Handle).documentView).
  2.   performFindPanelAction(nil);

nothing happens. Any idea on how to make it work? Thanks!

maxnd

  • Jr. Member
  • **
  • Posts: 73
Re: Activate the find panel of NSTextView
« Reply #1 on: June 04, 2026, 05:31:28 pm »
Google Gemini has found the solution in few seconds:

Code: Pascal  [Select][+][-]
  1. TCocoaTextView(NSScrollView(dbText.Handle).documentView).
  2.   setUsesFindBar(True);
  3. NSMenuItem(FindMenuItem.Handle).setTag(1);
  4. TCocoaTextView(NSScrollView(dbText.Handle).documentView).
  5.   performFindPanelAction(NSMenuItem(FindMenuItem.Handle));

 :)

 

TinyPortal © 2005-2018