Recent

Author Topic: [SOLVED] How to define child form such that parent still recvs key events  (Read 4043 times)

4nlegion

  • New Member
  • *
  • Posts: 11
The parent form could use KeyPreview - but is there a way to define and/or show the child form such that the message pump keeps sending key events to the parent.

For example: in the case of a parent with several shown child forms.
Moving/resizing such, causes each child to recv key focus, irrespective the child's purpose.

It would be 'nice' if the child were able to indicate to the message pump it's ability/purpose to handle key events.


« Last Edit: August 27, 2021, 01:07:15 am by 4nlegion »

4nlegion

  • New Member
  • *
  • Posts: 11
Re: How to define child form such that parent still recvs key events
« Reply #1 on: August 22, 2021, 12:25:21 am »
An example situation is an application's debug tool, where a child form can 'pop up', display some internal diagnostic and (after a few seconds) go away. Currently, while it is visible, it is (annoyingly) taking key focus away from the parent. Another example would be some database with child forms of varying size showing statistics, images etc. When these child forms are resized / moved they acquire key focus. If the child forms negotiate with the message pump (either at creation or in situ), they could respect the parent's key stream. I'm suggesting a disconnect between the graphic-message and the key-message streams depending on the child form's purpose.

Displays have become enormous. One consequence is the desire to fill it with lots of stuff - images - stats - annunciators of all ilk. Designed as child forms, placement is for / at the convenience of the user - but operationally secondary to the parent. If the user moves one of these child forms, 'later' it can be confusing as to which has key focus. The user eventually figures out keystrokes are not registering on the form of choice - they click on the parent and off they go - annoyed.

Yes, the parent form can proactively protect it's key stream - (this is) just a different approach that may offer benefits.
« Last Edit: August 22, 2021, 02:38:20 am by 4nlegion »

4nlegion

  • New Member
  • *
  • Posts: 11
Re: How to define child form such that parent still recvs key events
« Reply #2 on: August 22, 2021, 02:54:23 am »
Thank you cdesim, but is not KeyPreview easier and cross platform? But, both of these approaches are defensive in nature - actions taken by the parent form - is there not something more cooperative? In refining this idea, I am looking for a (hopefully cross platform) mechanism for a child form to negotiate with the message pump as to what event streams it will acquire or be responsible for. Thus a child form whose sole purpose is to render photos or videos when instantiated, need not receive any key events. This encapsulates the code to that of the child only, improving portability.
Regards 

4nlegion

  • New Member
  • *
  • Posts: 11
Re: How to define child form such that parent still recvs key events
« Reply #3 on: August 27, 2021, 01:06:19 am »
cdesim, sorry for the delay - yours is a simple and elegant solution - thank you.

 

TinyPortal © 2005-2018