Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
?
Solved

Extracting highlighted text from TStringGrid Inplace Editor

Posted on 2005-04-14
3
Medium Priority
?
585 Views
Last Modified: 2010-04-05
When you activate the inplace text editor for a string grid you are able to do use the mouse to highlight all or part of the character string. I want to be able to retrieve just the highlighted portion of the inplace editor text  string.
0
Comment
Question by:rfedyk
  • 2
3 Comments
 
LVL 1

Accepted Solution

by:
JustinWillis earned 2000 total points
ID: 13784284
In the absence of a better solution you may want to consider the following, yes it is very sloppy way of doing it, but I am open to a better one??

example uses TStringGrid or whatever grid you wish I guess and puts the selected cell text into a TEdit...

        StringGrid1.SetFocus;
        windows.keybd_event(VK_CONTROL, VK_CONTROL,0,0);
        windows.keybd_event(ord('C'), ord('C'),0,0); //C
        windows.keybd_event(ord('C'), ord('C'),KEYEVENTF_KEYUP,0); //C
        windows.keybd_event(VK_CONTROL, VK_CONTROL,KEYEVENTF_KEYUP,0);
        application.ProcessMessages;
        edit1.text := '';
        edit1.PasteFromClipboard;

Hope this helps! was a tricky one.
Justin Willis.
0
 
LVL 1

Author Comment

by:rfedyk
ID: 13787586
Justin,

Many thanks. That works just fine except for the StringGrid1.SetFocus. That actually removes the focus from the inplace editor.

Roger Fedyk
0
 
LVL 1

Expert Comment

by:JustinWillis
ID: 13788532
Strange, must be becuase I was using a TButton to trigger the code, which of coarse gives the button focus when the code runs.  Keep in mind though that although the code executes very quickly there may be a small window in which another application does something with the clipboard to mess things up, but I can't think of a better way, should be fine..

Just.
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

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

The uses clause is one of those things that just tends to grow and grow. Most of the time this is in the main form, as it's from this form that all others are called. If you have a big application (including many forms), the uses clause in the in…
Introduction I have seen many questions in this Delphi topic area where queries in threads are needed or suggested. I know bumped into a similar need. This article will address some of the concepts when dealing with a multithreaded delphi database…
Screencast - Getting to Know the Pipeline
Enter Foreign and Special Characters Enter characters you can't find on a keyboard using its ASCII code ... and learn how to make a handy reference for yourself using Excel ~ Use these codes in any Windows application! ... whether it is a Micr…
Suggested Courses

579 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