컨트롤이 완전히 초기화되었는지 어떻게 확인할 수 있습니까?
는컨트롤이 완전히 초기화 된 때를 확인하는 방법?
type
TForm1 = class(TForm)
Memo1: TMemo;
private
procedure WndProc(var Message: TMessage); override;
public
{ Public declarations }
end;
procedure TForm1.WndProc(var Message: TMessage);
begin
{
I'd like to log the messages to the memo as soon
as it's possible so I need to find out how to
check if the memo box is ready to use; the following
code stuck the application, so that the form is not
even displayed. How would you fix this code except
"avoid using of component access in window proc" ?
}
if Assigned(Memo1) then
if Memo1.HandleAllocated then
Memo1.Lines.Add('Message: ' + IntToStr(Message.Msg));
inherited WndProc(Message);
end;
P.S.를 (예를 들어 그것을 확인하시기 바랍니다 나는 그것이이 작업을 수행하는 아주 나쁜 연습을 알고) 다음 코드를 고려 나는 OutputDebugString을 안다 :-)
고마워!
혼란 스럽습니다. 정확히 무엇을 원하니? 1) 메시지 루프에서 발생하는 모든 Message.Msg를 Memo1에 로깅하거나 'Form1 및/또는 Memo1'의 초기화 완료를 기록 하시겠습니까? 제발 그걸 명확히 해줄 수 있니? – menjaraz
@menjaraz "메시지 루프"라고 할 때주의하십시오. 그것은 대기중인 메시지입니다. 큐되지 않은 메시지는 또한'WndProc'를 거칩니다. –
@ David Heffernan : 지적 해 주셔서 감사합니다. SO는 정말 좋은 곳입니다. – menjaraz