Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Which component to use for formatted search results?

Posted on 2006-10-21
2
Medium Priority
?
253 Views
Last Modified: 2013-11-17
I'm working on an application which will search a database of English sentences and return the matching sentences. I want to display the results in a way that would enable me to easily copy individual sentences to clipboard. I also want to highlight the search terms in the sentences (in a way similar to Google search results). Which component should I use for that? (I'm using Borland C++ Builder 2006.)

I tried using TRichEdit, but I'm not sure how to output formatted text to it. And I guess it would be cumbersome to output the text first and then highlight the search terms by selecting the corresponding fragments of text and changing the font properties of the selection.
0
Comment
Question by:pakonet
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 25

Accepted Solution

by:
kode99 earned 820 total points
ID: 17782153
Check out the TAdvMemo component from TMS Software,  it may allow you do what you want easily.  Since it does syntax highlighting you can probably just adjust the syntax to match the search terms.
http://www.tmssoftware.com/

To use the TRichEdit you need to do some RTF formating which can be a problem when you are switching between RTF and plain text. Here is a link to the RTF specs,

http://www.biblioscape.com/rtf15_spec.htm

So you can bold and do other types of RTF formatting by editing the TRichEdit contents.  I have found the easiest way to 'figure out' what you need to do for formatting was to create a doc in a word processor with examples of the formatting I wanted to use.  Then save to a RTF format file and then look at the file in a text editor to see the RFT formatting info.  Then you can just duplicate it in your program by inserting the formatting coding as needed.

Overall the TMS components are pretty good and up to date.  They also have some HTML components that might work well for what you want.  You can use HTML formatting,  probably allow you to duplicate the google results almost exactly.
0
 
LVL 1

Author Comment

by:pakonet
ID: 17787500
I read the RTF specification you provided and figured out how to do the necessary formatting. Thanks!
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Programmer's Notepad is, one of the best free text editing tools available, simply because the developers appear to have second-guessed every weird problem or issue a programmer is likely to run into. One of these problems is selecting and deleti…
Update (December 2011): Since this article was published, the things have changed for good for Android native developers. The Sequoyah Project (http://www.eclipse.org/sequoyah/) automates most of the tasks discussed in this article. You can even fin…
The viewer will learn how to use NetBeans IDE 8.0 for Windows to connect to a MySQL database. Open Services Panel: Create a new connection using New Connection Wizard: Create a test database called eetutorial: Create a new test tabel called ee…
The viewer will learn how to use and create keystrokes in Netbeans IDE 8.0 for Windows.

618 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question