Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / lazarus / 2003-11

Silly code message handling question

9 messages · 2 people ·

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Tony Maro
to Tony Maro: I'm handling a: procedure WMKeyUp(var Message: TLMKeyUp); message LM_KEYUP; How can I…
Mattias Gaertner wrote 7 lines
>How can I only make use of the keys that I want, and pass the remaining >on to the parent component(s)? > 1. You can override DoKeyUp instead. 2. Did you add an 'inherited'?

1) - When I try that I get "There is no method in an ancester class to be overridden". (it's not virtual...?)

2) - Tried that with my current message handling code and nothing happens.

My object is:

TWinControl -> TMScrollingWinControl -> TCheckBook

I'm trying to make sure that menu shortcuts happen even when my control has focus.

I can't seem to override the DoKeyUp on the TWinControl. I looked in the LCL and it's not listed as virtual. If I don't use "override" the routine is never called. If I do, it gives me the error listed above by 1).

I also tried handling the message as before, and adding "DoKeyUp(Message)" at the end if I haven't handled it, but nothing happens.

I tried handling the message, leaving result zero and calling inherited in the message handler to no avail.

Can someone point me to a sample component in the LCL that implements something like this?

Thanks,
Tony

Reply by email

Mattias Gaertner
to Tony Maro: I'm handling a: procedure WMKeyUp(var Message: TLMKeyUp); message LM_KEYUP; How can I…
Show quoted text 19 lines
I'm handling a: procedure WMKeyUp(var Message: TLMKeyUp); message LM_KEYUP; How can I only make use of the keys that I want, and pass the remaining on to the parent component(s)? I just want to grab arrows, without interfering with menu keyboard shortcuts. Currently I have the following within the procedure: if Message.CharCode = VK_UP then begin ... do my stuff ... exit; end; Which works great for handling the VK_UP, but it's not passing on the ones I don't handle.

1. You can override DoKeyUp instead.
2. Did you add an 'inherited'?

Mattias

Reply by email

Tony Maro

I'm handling a:

procedure WMKeyUp(var Message: TLMKeyUp); message LM_KEYUP;

How can I only make use of the keys that I want, and pass the remaining on to the parent component(s)?

I just want to grab arrows, without interfering with menu keyboard shortcuts.

Currently I have the following within the procedure:

if Message.CharCode = VK_UP then begin
   ... do my stuff ...
    exit;
end;

Which works great for handling the VK_UP, but it's not passing on the ones I don't handle.

Thanks,

Tony

Reply by email

Tony Maro
to Mattias Gaertner: Sorry. I ment KeyDown, KeyUp and KeyPress. To mark the "key" as used, set it to…
Show quoted text 23 lines
-----Original Message----- From: Mattias Gaertner On Mon, 10 Nov 2003 19:00:20 -0600 Tony Maro wrote: > Mattias Gaertner wrote: > > >>How can I only make use of the keys that I want, and pass the > >>remaining > >>on to the parent component(s)? > >> > >1. You can override DoKeyUp instead. > >2. Did you add an 'inherited'? > > > > 1) - When I try that I get "There is no method in an ancester class to > be overridden". (it's not virtual...?) Sorry. I ment KeyDown, KeyUp and KeyPress. To mark the "key" as used, set it to VK_UNKNOWN. What do you mean with "on to the parent component(s)"?

Meaning, if my custom control doesn't handle it the form gets a chance and the app finally. My real problem is that menu hotkeys don't function if my custom controls have focus and grab the key message.

I'll try to override the KeyPress and see what happens. Thanks.

-Tony

Reply by email

Mattias Gaertner
to Tony Maro: I'm handling a: procedure WMKeyUp(var Message: TLMKeyUp); message LM_KEYUP; How can I…
Show quoted text 12 lines
Mattias Gaertner wrote: >>How can I only make use of the keys that I want, and pass the remaining >>on to the parent component(s)? >> >1. You can override DoKeyUp instead. >2. Did you add an 'inherited'? > > 1) - When I try that I get "There is no method in an ancester class to be overridden". (it's not virtual...?)

Sorry. I ment KeyDown, KeyUp and KeyPress.
To mark the "key" as used, set it to VK_UNKNOWN.

What do you mean with "on to the parent component(s)"?

Mattias

Reply by email

Tony Maro
to Tony Maro: Meaning, if my custom control doesn't handle it the form gets a chance and the app…
Mattias Gaertner wrote 20 lines
On Mon, 24 Nov 2003 01:19:00 -0600 Tony Maro wrote: >Still no luck... I can see it pass the virtual keycode to inherited, but >menu shortcuts still don't work, which was the goal with this. > >What triggers a menu shortcut to occur in the LCL? I can't find >anything on it... > > It's not the LCL. The WM+gtk does. It should be possible to get the key event, before the gtk accelerators process it. But this needs to be implemented in the gtk intf. Mattias

Mmm... okay then let me rephrase.

I have a custom control that when selected doesn't allow the accelerators to work. It's a TWinControl descendant.

I've removed all references to grabbing key events, etc from my component and it _still_ doesn't let menu shortcuts work. (This, I didn't know until just now.)

Is there a flag when the component is created that tells it to disable this, kind of like csAcceptsControls triggers if you can drop in another control?

I suppose it's possible I changed a setting somewhere that affected accelerators and never realized it.

Thanks,

-Tony

Reply by email

Mattias Gaertner
to Tony Maro: Meaning, if my custom control doesn't handle it the form gets a chance and the app…
Show quoted text 50 lines
Tony Maro wrote: >>----Original Message----- >>From: Mattias Gaertner >> >>On Mon, 10 Nov 2003 19:00:20 -0600 Tony Maro wrote: >> >>>Mattias Gaertner wrote: >>> >>> >>> >>>>>How can I only make use of the keys that I want, and pass the >>>>>remaining >>>>>on to the parent component(s)? >>>>> >>>>> >>>>> >>>>1. You can override DoKeyUp instead. >>>>2. Did you add an 'inherited'? >>>> >>>> >>>> >>>1) - When I try that I get "There is no method in an >>> >>> >>ancester class to >> >> >>>be overridden". (it's not virtual...?) >>> >>> >>Sorry. I ment KeyDown, KeyUp and KeyPress. >>To mark the "key" as used, set it to VK_UNKNOWN. >> >>What do you mean with "on to the parent component(s)"? >> >> > >Meaning, if my custom control doesn't handle it the form gets a chance >and the app finally. My real problem is that menu hotkeys don't >function if my custom controls have focus and grab the key message. > >I'll try to override the KeyPress and see what happens. Thanks. > > Still no luck... I can see it pass the virtual keycode to inherited, but menu shortcuts still don't work, which was the goal with this. What triggers a menu shortcut to occur in the LCL? I can't find anything on it...

It's not the LCL. The WM+gtk does.
It should be possible to get the key event, before the gtk accelerators process it. But this needs to be implemented in the gtk intf.

Mattias

Reply by email

Tony Maro
to Tony Maro: Meaning, if my custom control doesn't handle it the form gets a chance and the app…
Tony Maro wrote 43 lines
>----Original Message----- >From: Mattias Gaertner > >On Mon, 10 Nov 2003 19:00:20 -0600 Tony Maro wrote: > >>Mattias Gaertner wrote: >> >> >> >>>>How can I only make use of the keys that I want, and pass the >>>>remaining >>>>on to the parent component(s)? >>>> >>>> >>>> >>>1. You can override DoKeyUp instead. >>>2. Did you add an 'inherited'? >>> >>> >>> >>1) - When I try that I get "There is no method in an >> >> >ancester class to > > >>be overridden". (it's not virtual...?) >> >> >Sorry. I ment KeyDown, KeyUp and KeyPress. >To mark the "key" as used, set it to VK_UNKNOWN. > >What do you mean with "on to the parent component(s)"? > > Meaning, if my custom control doesn't handle it the form gets a chance and the app finally. My real problem is that menu hotkeys don't function if my custom controls have focus and grab the key message. I'll try to override the KeyPress and see what happens. Thanks.

Still no luck... I can see it pass the virtual keycode to inherited, but menu shortcuts still don't work, which was the goal with this.

What triggers a menu shortcut to occur in the LCL? I can't find anything on it...

Thanks,

Tony

Reply by email

Mattias Gaertner
to Tony Maro: Meaning, if my custom control doesn't handle it the form gets a chance and the app…
Show quoted text 27 lines
Mattias Gaertner wrote: >On Mon, 24 Nov 2003 01:19:00 -0600 Tony Maro wrote: > > > >>Still no luck... I can see it pass the virtual keycode to inherited, but > >>menu shortcuts still don't work, which was the goal with this. >> >>What triggers a menu shortcut to occur in the LCL? I can't find >>anything on it... >> >> > >It's not the LCL. The WM+gtk does. >It should be possible to get the key event, before the gtk accelerators >process it. But this needs to be implemented in the gtk intf. > > >Mattias > > Mmm... okay then let me rephrase. I have a custom control that when selected doesn't allow the accelerators to work. It's a TWinControl descendant.

Can you send me the example?

Mattias

Show quoted text 22 lines
I've removed all references to grabbing key events, etc from my component and it _still_ doesn't let menu shortcuts work. (This, I didn't know until just now.) Is there a flag when the component is created that tells it to disable this, kind of like csAcceptsControls triggers if you can drop in another control? I suppose it's possible I changed a setting somewhere that affected accelerators and never realized it. Thanks, -Tony _________________________________________________________________ To unsubscribe: mail with "unsubscribe" as the Subject archives at http://www.lazarus.freepascal.org/mailarchives

Reply by email