Alan Colburn wrote:
> I've got a Memo box and what I'm trying to do is have users be able
> to highlight some text within the memo, press CTRL+SHIFT+S, and then
> do something with the highlighted text. I've got two quick questions
> related to this. First, how does one capture the CTRL-SHIFT-S
> keystroke combination in something like a KeyDown or KeyUp event?

You don't. Use a TAction with Ctrl+Shift+S as its Shortcut property, and 
then associate that action with a menu, a button, a tool-bar button, or 
whatever else you have. Handle the OnUpdate event, and in it, set the 
Enabled property based on whether the currently active control is the memo.

> For now I've simply been using the Escape key as a substitute. So, if
> ESC is pressed then a begin/end block that works with Memo.SelText
> executes. After the block executes (and the event handler ends), the
> Memo is cleared ... any text that was previously in it, whether
> highlighted or not, goes away. Although I'm not including the method,
> I can step through the code and see that the memo's text is *not*
> cleared because of any sub-routines that I've added.

Then continue stepping through until you find the line that does clear 
the text. Turn on the "debug DCUs" option to let you step through the 
VCL code as well as your own.

> Do you know why
> the memo is cleared? And, more importantly, the alternate line(s) I
> should write to simply work with the selected text and then return
> the focus back to the otherwise untouched Memo?

Since you haven't shown your code, how can anyone hope to show an 
alternative to your code?

-- 
Rob
_______________________________________________
Delphi mailing list -> Delphi@elists.org
http://www.elists.org/mailman/listinfo/delphi

Reply via email to