Skip to content

Commit

Permalink
dlg_proc: subevent on_click uses control's callback
Browse files Browse the repository at this point in the history
  • Loading branch information
Alexey-T committed May 25, 2017
1 parent c421eff commit 753c2aa
Showing 1 changed file with 13 additions and 3 deletions.
16 changes: 13 additions & 3 deletions app/proc_customdialog_dummy.pas
Original file line number Diff line number Diff line change
Expand Up @@ -204,14 +204,25 @@ procedure TFormDummy.DoOnShow(Sender: TObject);

procedure TFormDummy.DoOnClick(Sender: TObject);
var
Props: TAppControlProps;
IdControl: integer;
SInfo: string;
P: TPoint;
begin
Props:= TAppControlProps((Sender as TControl).Tag);
IdControl:= FindControlIndexByOurObject(Sender);
P:= (Sender as TControl).ScreenToClient(Mouse.CursorPos);
SInfo:= Format('(%d,%d)', [P.X, P.Y]);
DoEvent(IdControl, '"on_click"', SInfo, true);

if Props.FCallback<>'' then
CustomDialog_DoPyCallback(Props.FCallback, [
IntToStr(PtrInt(Self)), //id_dlg
IntToStr(IdControl), //id_ctl
'"on_click"', //id_event
'info='+SInfo //info
])
else
DoEvent(IdControl, '"on_click"', SInfo, true);
end;

procedure TFormDummy.DoOnKeyDown(Sender: TObject; var Key: Word; Shift: TShiftState);
Expand Down Expand Up @@ -325,12 +336,11 @@ function TFormDummy.FindControlIndexByOurName(const AName: string): integer;
procedure TFormDummy.DoOnChange(Sender: TObject);
var
Props: TAppControlProps;
i: integer;
begin
if BlockedOnChange then exit;

//workarnd for bug on Mac
//(flicker on More>> press in BackupFile dialog)
//(flickering on More>> press in BackupFile dialog)
if not IsFormShownAlready then exit;

Props:= TAppControlProps((Sender as TControl).Tag);
Expand Down

0 comments on commit 753c2aa

Please sign in to comment.