Just a quick follow-up. I used the code line below to trap the CTL-SHIFT-S 
combo and, somehow, everything seems to be working fine now. I don't 
understand what's different. Perhaps the moon changed its phases :-)

As a side point, I also tried setting the method up as an Action, although 
it doesn't look like CTL-SHIFT-S is one of the shortcut keystrokes available 
(...not that there aren't plenty of others from which to choose).

Anyway, my thanks -- as always. It's great having a group like this 
available. I've never actually spoken face to face with someone who knows 
Delphi. All my communication about the topic has been via e-mail and 
newsgroups.

Later -- Al


----- Original Message ----- 
From: "Stephen Posey" <[EMAIL PROTECTED]>
To: "Borland's Delphi Discussion List" <[email protected]>
Sent: Tuesday, July 18, 2006 9:03 AM
Subject: Re: Shortcuts in Memo Boxes


> 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 CAN use the "OnKey*" events for this, trapping a complex keystroke
> looks something like:
>
> procedure TForm1.Memo1Keydown(Sender: TObject;
>   var Key: Word; Shift: TShiftState);
> begin
>   if (Key = Ord('S')) and (Shift = [ssCTRL, ssShift]) then...
> end;
>
> But as another poster pointed out, it's much easier to work with Actions.
>
>> 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.
>>
>> 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?
>
> If you're 100% sure you're not setting SelText somewhere then my first
> guess is that something is "typing" into the Memo, which serves to clear
> the selected text.
>
> Post your current key handling code, it will probably show up there.
>
> Stephen Posey
> [EMAIL PROTECTED]
>
>
>
>
> This message and its attachments are for the sole use of the intended 
> recipient(s) and may contain confidential,
> proprietary and privileged information. Any unauthorized review, copying, 
> use, disclosure or distribution is prohibited. If
> you are not the intended recipient, please notify the sender immediately 
> by replying to the address listed in the From:
> field and destroy all copies of the original message and its attachments.
> _______________________________________________
> Delphi mailing list -> [email protected]
> http://www.elists.org/mailman/listinfo/delphi
> 
_______________________________________________
Delphi mailing list -> [email protected]
http://www.elists.org/mailman/listinfo/delphi

Reply via email to