File tree Expand file tree Collapse file tree 1 file changed +12
-5
lines changed
Expand file tree Collapse file tree 1 file changed +12
-5
lines changed Original file line number Diff line number Diff line change @@ -82,7 +82,7 @@ TDLL = class
8282 // / event handler of button components.
8383 // / </summary>
8484 TButtonBridge = class
85- Source: TButton ;
85+ Source: TComponent ;
8686 Target: TDLL;
8787 Number: integer;
8888 Parent: TNotifyEvent;
@@ -490,19 +490,26 @@ function HandleCallBack(f: PAnsiChar): THandle; stdcall;
490490// / </returns>
491491function ButtonCallBack (f: PAnsiChar): integer; stdcall;
492492var
493- Source: TButton ;
493+ Source: TComponent ;
494494 Bridge: TButtonBridge;
495495begin
496496 Inc(handlerNum);
497497 Result := handlerNum;
498- Source := TButton (GetUI(CtoD(f)));
498+ Source := TComponent (GetUI(CtoD(f)));
499499 if (Source <> nil ) and (LastDLL <> nil ) then begin
500500 Bridge := TButtonBridge.Create;
501501 Bridge.Source := Source;
502502 Bridge.Target := LastDLL;
503503 Bridge.Number := Result;
504- Bridge.Parent := Source.OnClick;
505- Source.OnClick := Bridge.Handle;
504+ if Source is TButton then begin
505+ var comp := TButton(Source);
506+ Bridge.Parent := comp.OnClick;
507+ comp.OnClick := Bridge.Handle;
508+ end else if Source is TMenuItem then begin
509+ var comp := TMenuItem(Source);
510+ Bridge.Parent := comp.OnClick;
511+ comp.OnClick := Bridge.Handle;
512+ end ;
506513 end ;
507514end ;
508515
You can’t perform that action at this time.
0 commit comments