Squall_FF8 1 Posted Wednesday at 02:11 PM (edited) Hey guys, I found the following mystery. Could you help me to solve it? A VCL application with Main form. On that form we have Edit and panel that different forms attach to it (one at a time, depending on a context). - The Edit has OnKeePress that handle, when Enter is used. - Attached forms have Action that has short-key: Enter. - 7 of Attached forms are Auto created (in the project). - 2 of Attached forms are created only once per use in run time. The mystery: What will happen if the Edit has a focus and I hit Enter? Whose handler will be triggered - Edit or attached window? Well at run time, if I have attached one of the 7 - Edit handler respond. If I have attached one of the 2 - their handler respond. So I guess my question is WHY? Why the difference between 7 and 2 windows? What is going on under the hood? Edited Wednesday at 02:29 PM by Squall_FF8 Share this post Link to post
Die Holländer 91 Posted Wednesday at 02:30 PM (edited) 19 minutes ago, Squall_FF8 said: 2 of Attached forms are created only once per use in run time. Where? In the Main form? Created with "self" in Main form? The Autocreated with Application.CreateForm in *.dpr? Edited Wednesday at 02:31 PM by Die Holländer Share this post Link to post
Squall_FF8 1 Posted Wednesday at 02:32 PM 1 minute ago, Die Holländer said: Where in the Main form? Created with "self" in Main form? The Autocreated with Application.Create in *.dpr? Yes, to both questions, The 2 are created on demand and reused after that (if/when needed) Share this post Link to post
Squall_FF8 1 Posted Wednesday at 02:39 PM 7 minutes ago, Die Holländer said: Created with "self" in Main form? Hmm are you suggesting, that because Main is the owner of the 2 windows (and the Edit), the Actions have higher precedence? (and thus difference in behavior) Share this post Link to post
PeterBelow 260 Posted Wednesday at 05:29 PM Perhaps you can get some understanding from this old article of mine. Key processing was already complex at the time the article was written and it only got more so with later additions, e.g. the modified MDI support introduced in recent versions of Delphi. Share this post Link to post