Link to home
Start Free TrialLog in
Avatar of Kristian
Kristian

asked on

TMemo, Occasionally not accepting Keypress events in a DLL. (D5)

I have put together a program that works / looks much the same as the Windows 2000 Manage option.
the program has a tree menu, and a panel on the other side that depending on which option you select opens that form / page.
now these pages are all in different DLL's, and are created useing the form CreateParented procedure giving me the required result of a simple menu with different option screens all on one page.
Another reason i did this was some of the screens are also available as programs in there own right, a simple DPR that calls the dll, pops up the form and it just acts like a normal program. simple.

now on one of the screens i have a memo, just a standard TMemo, and if it is running as a single program, or as a popup form from the main menu program, or the first time you run the individual form as a parented window it works fine. BUT if when the form is parented i move to another application and then back again, all navigation keys( up, down, left, right, Alt, CTLR ) do not work.

i have tried setting an on keypress and keydown event and they are just not being called at all. WHY.
if i close the dll form and reopen it again its fine.
If the form is in popup mode rather than parented mode it will allways work fine, only when parented does this happen.
i have checked through out the entire source code and i am not accessing any keypress / keydowns any where ( apart from my own TMyEdit in my package). but that obviously does not have an impact on a TMemo miles away.

im absolutely baffled.

any advice / thoughts / work arounds / fudges / fixs welcome.

Cheers Kristian.
Avatar of Igor UL7AAjr
Igor UL7AAjr
Flag of Kazakhstan image

Hi Kristian,

this behaviour looks like loosing a focus. Seems it looses focus and can't get it back. Try to set focus manually via windows API windows.SetFocus(Handle); Not sure, may it help.

------
Igor.
Avatar of Kristian
Kristian

ASKER

I was with you then, as i also have a status bar that needed some subtle setting of focus to always work when i posted a message to it.

BUT

i tried:

windows.setfocus(QueryMO.handle);
&
SetFocusedControl(QueryMO);
&
QueryMO.Setfocus;

in the OnEnter event of the memo ( ive steped through each time and its doing the call ).

but no luck.

BUT by doing this it did make the problem start straight away rather than after i loose focus and come back so i think were on the right track.

Kristian
ASKER CERTIFIED SOLUTION
Avatar of TOndrej
TOndrej

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
I cant beleive you've hit the nail on the head !!

I have a design + runtime package ( well theres no design time parts so it makes sence to have just the one package).

When im developing i compile including the packages so that it saves me compiling all programs / Dll's if i change the package ( good time saver ).

But as part of the software there is a release unit that compiles and releases itself, and this does not include runtime packages as i wanted to utilize the decrease in network traffic as it is a big suit ETC.

and when compiled with out the package it works absolutely fine ( well i havnt seen any problems yet anyway )..

I dont understand why, and i think its probably not worth trying to find out, ( as its ok on site i can live with it )..

anyway nice one,
Kristian