From: atanas.desev on

I want to make Ctrl+C in a dialog window. Not in a control, that I
make easy. But without a focus control, or focus button, I want to
make Ctrl+C on a text in a multiline edit control.
I tried several things, but in my dispatch I can't take the event
Ctrl+C. Also in the dispatch I can't even take the event WM_KEYDOWN.
That's my Dispatch.
/*
method Dispatch( oEvent ) class MessageDialog
local lCtrlOn:=false as logic

do case
case( oEvent:Message == WM_KEYDOWN )
lCtrlOn := logic(_cast,
_and(GetKeyState(VK_CONTROL),short(_cast, 0x8000)))
if( lCtrlOn )
if( oEvent:wParam == 03 )
//Copy text
return ( 1L )
endif
endif
case( oEvent:Message==WM_COMMAND )
if( !self:OnCommand(oEvent) )
return( 1L )
endif


endcase
return( super:Dispatch( oEvent ) )
*/
So if someone can help me I will be pleased. Thank in advance.
From: Urs Eggmann on
Hi Atanas,

in a very old news thread I fund something kow tu trap keys without focus on
a control. With accelerators. It helped to trap the ESC to close the window,
perhaps you can modify it:

http://groups.google.ch/group/comp.lang.clipper.visual-objects/browse_thread/thread/df76931183b324f8/217d487f6c6f5fe3?hl=de&lnk=gst&q=trap+escape#217d487f6c6f5fe3

HTH
Urs


<atanas.desev(a)gmail.com> schrieb im Newsbeitrag
news:5e48b601-279c-4d31-817c-30d4727b7f8f(a)56g2000hsm.googlegroups.com...
>
> I want to make Ctrl+C in a dialog window. Not in a control, that I
> make easy. But without a focus control, or focus button, I want to
> make Ctrl+C on a text in a multiline edit control.
> I tried several things, but in my dispatch I can't take the event
> Ctrl+C. Also in the dispatch I can't even take the event WM_KEYDOWN.
> That's my Dispatch.
> /*
> method Dispatch( oEvent ) class MessageDialog
> local lCtrlOn:=false as logic
>
> do case
> case( oEvent:Message == WM_KEYDOWN )
> lCtrlOn := logic(_cast,
> _and(GetKeyState(VK_CONTROL),short(_cast, 0x8000)))
> if( lCtrlOn )
> if( oEvent:wParam == 03 )
> //Copy text
> return ( 1L )
> endif
> endif
> case( oEvent:Message==WM_COMMAND )
> if( !self:OnCommand(oEvent) )
> return( 1L )
> endif
>
>
> endcase
> return( super:Dispatch( oEvent ) )
> */
> So if someone can help me I will be pleased. Thank in advance.
>

From: atanas.desev on
Thank you for the help, but is not working. Now i think to try with
overwriting the winproc function. If you have any ideas i will be
pleased to check them out.
From: Geoff Schaller on
Hello Nameless.

You need to use the BeforeDispatch. If no control has focus then the
Window itself can usually do nothing. Windows themselves don't really
have 'focus' and aren't designed that way. However, BeforeDispatch will
often solve this problem. I have some example code on my website.

Geoff

www.softwareobjectives.com.au/voconversion



"atanas.desev(a)gmail.com" <atanas.desev(a)gmail.com> wrote in message
news:5e48b601-279c-4d31-817c-30d4727b7f8f(a)56g2000hsm.googlegroups.com:

> I want to make Ctrl+C in a dialog window. Not in a control, that I
> make easy. But without a focus control, or focus button, I want to
> make Ctrl+C on a text in a multiline edit control.
> I tried several things, but in my dispatch I can't take the event
> Ctrl+C. Also in the dispatch I can't even take the event WM_KEYDOWN.
> That's my Dispatch.
> /*
> method Dispatch( oEvent ) class MessageDialog
> local lCtrlOn:=false as logic
>
> do case
> case( oEvent:Message == WM_KEYDOWN )
> lCtrlOn := logic(_cast,
> _and(GetKeyState(VK_CONTROL),short(_cast, 0x8000)))
> if( lCtrlOn )
> if( oEvent:wParam == 03 )
> //Copy text
> return ( 1L )
> endif
> endif
> case( oEvent:Message==WM_COMMAND )
> if( !self:OnCommand(oEvent) )
> return( 1L )
> endif
>
>
> endcase
> return( super:Dispatch( oEvent ) )
> */
> So if someone can help me I will be pleased. Thank in advance.

From: Chris Pyrgas on

Hi,

> I tried several things, but in my dispatch I can't take the event
> Ctrl+C. Also in the dispatch I can't even take the event WM_KEYDOWN.

> case( oEvent:Message == WM_KEYDOWN )
> lCtrlOn := logic(_cast,
> _and(GetKeyState(VK_CONTROL),short(_cast, 0x8000)))
> if( lCtrlOn )
> if( oEvent:wParam == 03 )

Change the last IF statement to oEvent:wParam == 67 (the ascii value of
"A"), that should work.

hth,
Chris