Ignore:
Timestamp:
Feb 10, 2011, 4:10:59 PM (14 years ago)
Author:
george
Message:
  • Added: Context menu in microthreads list to show microthread call stack.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • MicroThreading/UMicroThreadList.pas

    r164 r168  
    77uses
    88  Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, ComCtrls,
    9   ExtCtrls, StdCtrls, DateUtils, UPlatform;
     9  ExtCtrls, StdCtrls, Menus, DateUtils, UPlatform, UMicroThreadCallStack;
    1010
    1111type
     
    2121    Label8: TLabel;
    2222    Label9: TLabel;
     23    MenuItemCallStack: TMenuItem;
     24    PopupMenu1: TPopupMenu;
    2325    TimerRedraw: TTimer;
    2426    Label1: TLabel;
     
    3133    TabSheet3: TTabSheet;
    3234    procedure FormClose(Sender: TObject; var CloseAction: TCloseAction);
     35    procedure FormCreate(Sender: TObject);
     36    procedure FormDestroy(Sender: TObject);
    3337    procedure FormHide(Sender: TObject);
    3438    procedure FormShow(Sender: TObject);
    3539    procedure ListView1Data(Sender: TObject; Item: TListItem);
    3640    procedure ListView2Data(Sender: TObject; Item: TListItem);
     41    procedure MenuItemCallStackClick(Sender: TObject);
    3742    procedure TimerRedrawTimer(Sender: TObject);
    3843  private
    39     { private declarations }
     44    CallStackForm: TCallStackForm;
    4045  public
    4146    { public declarations }
     
    8186    with TMicroThread(MainScheduler.MicroThreads[Item.Index]) do begin
    8287      Item.Caption := IntToStr(Id);
     88      Item.Data := TMicroThread(MainScheduler.MicroThreads[Item.Index]);
    8389      Item.SubItems.Add('');
    8490      Item.SubItems.Add(IntToStr(Priority));
     
    124130end;
    125131
     132procedure TMicroThreadListForm.MenuItemCallStackClick(Sender: TObject);
     133begin
     134  if Assigned(ListView1.Selected) then
     135  with TMicroThread(ListView1.Selected.Data) do begin
     136    //Suspend;
     137    CallStackForm.Show(BasePointer);
     138    //Resume;
     139  end;
     140end;
     141
    126142procedure TMicroThreadListForm.FormShow(Sender: TObject);
    127143begin
     
    140156end;
    141157
     158procedure TMicroThreadListForm.FormCreate(Sender: TObject);
     159begin
     160  CallStackForm := TCallStackForm.Create(nil);
     161end;
     162
     163procedure TMicroThreadListForm.FormDestroy(Sender: TObject);
     164begin
     165  CallStackForm.Free;
     166end;
     167
    142168
    143169end.
Note: See TracChangeset for help on using the changeset viewer.