Skip to content

Commit

Permalink
py listbox api: events
Browse files Browse the repository at this point in the history
  • Loading branch information
Alexey-T committed Nov 4, 2016
1 parent 5528d09 commit d033409
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 12 deletions.
2 changes: 1 addition & 1 deletion app/formmain.pas
Original file line number Diff line number Diff line change
Expand Up @@ -527,7 +527,7 @@ TfmMain = class(TForm)
function DoMenuEnum(const AStr: string): string;
procedure DoOnTabMove(Sender: TObject; NFrom, NTo: Integer);
procedure DoOps_LoadPluginFromInf(const fn_inf: string);
procedure DoPanel_Event(AControl: TControl; const AEvent: string);
procedure DoPanel_Event(AControl: TObject; const AEvent: string);
procedure DoPanel_OnContextPopup(Sender: TObject; MousePos: TPoint; var Handled: Boolean);
procedure DoPanel_OnSelChanged(Sender: TObject);
procedure DoSidebar_OnTabClick(Sender: TObject);
Expand Down
10 changes: 5 additions & 5 deletions app/formmain_plugins.inc
Original file line number Diff line number Diff line change
Expand Up @@ -344,7 +344,7 @@ begin
DoPyCommand(PyLastCommandModule, PyLastCommandMethod, PyLastCommandParam);
end;

procedure TfmMain.DoPanel_Event(AControl: TControl; const AEvent: string);
procedure TfmMain.DoPanel_Event(AControl: TObject; const AEvent: string);
begin
DoPyEvent(CurrentEditor, cEventOnPanel,
[
Expand All @@ -356,21 +356,21 @@ end;
procedure TfmMain.DoPanel_OnContextPopup(Sender: TObject; MousePos: TPoint;
var Handled: Boolean);
begin
DoPanel_Event(Sender as TControl, 'on_menu');
DoPanel_Event(Sender, 'on_menu');
end;

procedure TfmMain.DoPanel_OnClick(Sender: TObject);
begin
DoPanel_Event(Sender as TControl, 'on_click');
DoPanel_Event(Sender, 'on_click');
end;

procedure TfmMain.DoPanel_OnDblClick(Sender: TObject);
begin
DoPanel_Event(Sender as TControl, 'on_dbl_click');
DoPanel_Event(Sender, 'on_dbl_click');
end;

procedure TfmMain.DoPanel_OnSelChanged(Sender: TObject);
begin
DoPanel_Event(Sender as TControl, 'on_sel');
DoPanel_Event(Sender, 'on_sel');
end;

9 changes: 3 additions & 6 deletions app/formmain_sidepanel.inc
Original file line number Diff line number Diff line change
Expand Up @@ -149,15 +149,12 @@ begin
ItemListbox.ItemHeight:= ListboxOut.ItemHeight;
ItemListbox.CanGetFocus:= true;

DoApplyThemeToListbox(ItemListbox);
{
//todo: events
ItemListbox.OnClick:= @DoPanel_OnClick;
ItemListbox.OnDblClick:= @DoPanel_OnDblClick;
ItemListbox.OnSelectionChanged:= @DoPanel_OnSelChanged;
ItemListbox.OnChangedSel:= @DoPanel_OnSelChanged;
ItemListbox.OnContextPopup:=@DoPanel_OnContextPopup;
ItemListbox.OnKeyDown:= @TreeKeyDown;
}

DoApplyThemeToListbox(ItemListbox);
end;
end;

Expand Down

0 comments on commit d033409

Please sign in to comment.