ミ,,゚Д゚彡DelフサギコのフサフサDelphi談話室�A
■ このスレッドは過去ログ倉庫に格納されています
0084Delフサギコ
NGNGミ゚Д゚,ミ,ノ< わひょーん
ミ⊃ ,ミ \
ミ, ,,ミ
⊂,,,ノ
∪
難しいですね、VCL恐るべし。
こんな流れ?
ユーザーがボタンクリックする
→WM_COMMANDが親Windowに伝わる
→MainWiondowProcで受け取る
→FindControlでButton1を見つける
→Button1にCN_COMMAND投げる
→Button1でそのメッセージ受け取る
→ButtonClickイベント発生
あれ?そしたらClickイベント後は
別にどこにも戻らなくてよさそう?
だから、OnClickイベントでFreeしても一応は安全なのかな。
(やらない方がよさそうというのは納得しました)
procedure TButton.CNCommand(var Message: TWMCommand);
begin
if Message.NotifyCode = BN_CLICKED then Click;
end;
procedure TButton.Click;
var
Form: TCustomForm;
begin
Form := GetParentForm(Self);
if Form <> nil then Form.ModalResult := ModalResult;
inherited Click;
end;
procedure TControl.Click;
begin
{ Call OnClick if assigned and not equal to associated action's OnExecute.
If associated action's OnExecute assigned then call it, otherwise, call
OnClick. }
if Assigned(FOnClick) and (Action <> nil) and (@FOnClick <> @Action.OnExecute) then
FOnClick(Self)
else if not (csDesigning in ComponentState) and (ActionLink <> nil) then
ActionLink.Execute(Self)
else if Assigned(FOnClick) then
FOnClick(Self);
end;
■ このスレッドは過去ログ倉庫に格納されています