BVB Source Codes

MVC framework based on Delphi examples Show IndexTreeCtrl.pas Source code

Return Download MVC framework based on Delphi examples: download IndexTreeCtrl.pas Source code - Download MVC framework based on Delphi examples Source code - Type:.pas
  1. unit IndexTreeCtrl;
  2.  
  3. interface
  4. uses
  5.   SysUtils, forms, Menus, ComCtrls, buttons, classes, controls, patterns,
  6.   IndexTreeMdl, IndexTreeView;
  7.  
  8. type
  9.   TControllerIndexTree = class(TController)
  10.     model: TModelIndexTree;
  11.     view: TViewIndexTree;
  12.   protected
  13.     procedure DoCommand(ACommand: string; const args: string = ''); override;
  14.   public
  15.     constructor Create;
  16.     destructor Destroy; override;
  17.     procedure OnClick(Sender: TObject); //for ieventListener
  18.     procedure OnMouseEvent(Sender: TObject;
  19.       Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
  20.   end;
  21.  
  22. implementation
  23. uses
  24.   commandlist;
  25.  
  26. procedure TControllerIndexTree.OnClick(Sender: TObject);
  27. begin
  28.   if Sender is TMenuItem then
  29.   begin
  30.     if TMenuItem(Sender).caption = '&Property' then
  31.       Application.MessageBox('Menu Property clicked!', 'Info', 0)
  32.     else if TMenuItem(Sender).caption = '&Refresh' then
  33.       MOdel.refresh;
  34.   end;
  35.  
  36.   if Sender is TTreeView then
  37.   begin
  38.     if assigned(TTreeView(Sender).Selected) then
  39.       //send the node as a parameter of a String command,
  40.       //who will handle this command?
  41.       //I don't know and don't care eighter
  42.       self.SendCommand(CMD_TREEINDEX_SELECT, Model.GetNodeByParam(TTreeView(Sender).Selected.Data));
  43.   end;
  44. end;
  45.  
  46. procedure TControllerIndexTree.OnMouseEvent(Sender: TObject;
  47.   Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
  48. begin
  49.  
  50. end;
  51.  
  52. constructor TControllerIndexTree.Create;
  53. begin
  54.   inherited;
  55.   model := TModelIndexTree.Create;
  56.   view := TViewIndexTree.create(nil);
  57.   view.setEventHandler(OnClick);
  58.   model.RegObserver(view);
  59. end;
  60.  
  61. destructor TControllerIndexTree.destroy;
  62. begin
  63.   freeAndNil(model);
  64.   freeAndNil(view);
  65.   inherited;
  66. end;
  67.  
  68. procedure TControllerIndexTree.DoCommand(ACommand: string; const args: string = '');
  69. begin
  70.   if ACommand = CMD_REQUIRE_INDEXTREE then
  71.   begin
  72.     //make sure the view not released by the command object
  73.     self.model.MakeIndexTree;
  74.     self.SendCommand(TCommand.Create(CMD_SHOW_INDEXTREE, nil, view, '', nil, false));
  75.   end;
  76. end;
  77.  
  78. initialization
  79.   ControlCenter.RegController(TControllerIndexTree.Create);
  80.  
  81. end.
  82.  
  83.  
downloadIndexTreeCtrl.pas Source code - Download MVC framework based on Delphi examples Source code
Related Source Codes/Software:
Delphi computer training school management system source code - A training management system for computer training... 2012-02-18
FLEX+Delphi+Java+C# combined to create chat rooms - This is a comprehensive real life examples, it is ... 2012-02-18
DELPHI by URL trigger implementation of registration agreement - A deal registration tool written in DELPHI source ... 2012-02-18
Delphi computer machine service system source code - Do you have a source, or even not registered softw... 2012-02-18
Delphi source SQL Server Query Analyzer and simulation code - More simple than SQLSERVER's Query Analyzer, you c... 2012-02-18
Delphi 3D brick breaker PlateBall source program - A very interesting and slightly more difficult gam... 2012-02-18
SMS messaging platform and interface for Delphi source code - One formerly was SP partners for better business i... 2012-02-18
Delphi 3DS model actual combat in operation source - This is a good example, demonstrates the JPG image... 2012-02-18
Simulation of TGO 32Bit v1.0 for Delphi 3D rendering source code - TGO32B, seems to travel abroad program, although o... 2012-02-18
Delphi graduation: student management system - This is a formal student management system SQL ver... 2012-02-18
Delphi car rental company business management system - A car rental company's business management systems... 2012-02-18
Delphi major revision of the human resources management system source code - RedHR owned a large OFFICE of human resources mana... 2012-02-18
DELPHI pawn industry management system source code - Pawn shop of an integrated business management sys... 2012-02-18
Cool interface Delphi chat software source code - Interface is really cool? This is a small LAN chat... 2012-02-18
Delphi shield Ctrl+Alt+Del reqijian method - Real shielding theory of Delphi is this: using a r... 2012-02-18
Classic RPG games with Delphi source code - The actual and Diablo game or scene is similar in ... 2012-02-18
35 Delphi7 Indy instance package - Application example demonstrates a lot of Indy Dem... 2012-02-18
Delphi transportation company business management system - A Delphi transportation company business managemen... 2012-02-18
Using Delphi to achieve control of the camera - This procedure describes how to use DELPHI AVICAP3... 2012-02-18
Cell of the report component for Delphi example source program - UFIDA table company developed a report component, ... 2012-02-18

 Back to top