📄 formfamtree.h
字号:
//----------------------------------------------------------------------------
//
// formatfamtree.h
// Chapter 30 - How To - Tree View Component Example
//
// Paul Gustavson
// pgustavson@simventions.com
//
//---------------------------------------------------------------------------
#ifndef formfamtreeH
#define formfamtreeH
//---------------------------------------------------------------------------
#include <Classes.hpp>
#include <Controls.hpp>
#include <StdCtrls.hpp>
#include <Forms.hpp>
#include <Buttons.hpp>
#include <ComCtrls.hpp>
#include <Menus.hpp>
#include <ExtCtrls.hpp>
#include <ActnList.hpp>
#include <Dialogs.hpp>
#include <ExtDlgs.hpp>
#include <ImgList.hpp>
#include "tree_util.h"
#include <ToolWin.hpp>
#define gPersonMale 0
#define gPersonFemale 1
#define gPersonMaleSelected 2
#define gPersonFemaleSelected 3
#define gPlus 4
#define gMinus 5
#define gAddPerson 6
#define gRemovePerson 7
#define gDeleted 8
#define gUp 25
#define gDown 26
//---------------------------------------------------------------------------
class TFormFamilyTree : public TForm
{
__published: // IDE-managed Components
TPageControl *PageControlEditEntry;
TTabSheet *TabSheet1;
TSplitter *Splitter1;
TMainMenu *MainMenu1;
TMenuItem *File1;
TMenuItem *New1;
TMenuItem *Open1;
TMenuItem *SaveAs1;
TOpenDialog *OpenDialog1;
TSaveDialog *SaveDialog1;
TActionList *ActionList1;
TMenuItem *N1;
TMenuItem *Exit1;
TAction *ActionFileSaveAs;
TAction *ActionNodeAddLabel;
TAction *ActionNodeDeleteHard;
TAction *ActionNodeModify;
TMenuItem *Edit1;
TMenuItem *Delete1;
TMenuItem *Add1;
TMenuItem *Modify1;
TAction *ActionFileOpen;
TAction *ActionNodeMoveUp;
TAction *ActionNodeMoveDown;
TAction *ActionNodeFindLabel;
TTabSheet *TabSheet2;
TPanel *PanelEditEntry;
TLabel *Label2;
TEdit *EditFirstName;
TEdit *EditLastName;
TLabel *Label1;
TAction *ActionNodeAddData;
TImageList *ImageListTreeViewIcons;
TAction *ActionNodeFindID;
TAction *ActionNodeDeleteSoft;
TPopupMenu *PopupMenu1;
TMenuItem *Up1;
TMenuItem *Down1;
TMenuItem *Remove1;
TAction *ActionEditUndo;
TAction *ActionEditRedo;
TMenuItem *Undo1;
TMenuItem *Redo1;
TPopupMenu *PopupMenu2;
TMenuItem *MenuItem1;
TMenuItem *MenuItem2;
TAction *ActionFileClear;
TPanel *Panel4;
TTreeView *TreeViewFamily;
TToolBar *ToolBar1;
TToolButton *ToolButton1;
TToolButton *ToolButton2;
TPanel *Panel1;
TToolBar *ToolBar2;
TToolButton *ToolButton3;
TToolButton *ToolButtonRestore;
TLabel *LabelDOB;
TEdit *EditDOB;
TEdit *EditDOD;
TLabel *Label5;
TEdit *EditOccupation;
TLabel *Label3;
TEdit *EditMother;
TLabel *Label9;
TEdit *EditFather;
TLabel *Label8;
TRadioButton *RadioButtonMale;
TRadioButton *RadioButtonFemale;
TLabel *Label6;
TEdit *EditEpitath;
TLabel *Label10;
TEdit *EditBirthPlace;
TLabel *Label11;
TEdit *EditNotes;
TLabel *Label7;
TBevel *Bevel1;
TSpeedButton *SpeedButton1;
TSpeedButton *SpeedButton2;
TPanel *Panel2;
TTreeView *TreeViewUndo;
TLabel *Label4;
TPanel *Panel3;
TTreeView *TreeViewRedo;
TLabel *Label12;
TLabel *Label13;
TEdit *EditID;
TSpeedButton *SpeedButton3;
TAction *ActionEditRefresh;
TMenuItem *N2;
TMenuItem *N3;
TMenuItem *RefreshTree1;
TLabel *Label14;
TLabel *Label15;
TEdit *EditMotherID;
TEdit *EditFatherID;
TAction *ActionOtherChange;
TAction *ActionOtherRestore;
TToolButton *ToolButton4;
TToolButton *ToolButton5;
TToolButton *ToolButton6;
TAction *ActionTreeExpand;
TAction *ActionTreeCollapse;
TEdit *EditResidence;
TLabel *Label16;
TToolButton *ToolButton7;
TToolButton *ToolButton8;
void __fastcall FormActivate(TObject *Sender);
void __fastcall FormClose(TObject *Sender, TCloseAction &Action);
void __fastcall TreeViewFamilyClick(TObject *Sender);
void __fastcall TreeViewFamilyKeyDown(TObject *Sender, WORD &Key,
TShiftState Shift);
void __fastcall TreeViewFamilyKeyUp(TObject *Sender, WORD &Key,
TShiftState Shift);
void __fastcall TreeViewFamilyDragDrop(TObject *Sender,
TObject *Source, int X, int Y);
void __fastcall TreeViewFamilyDragOver(TObject *Sender,
TObject *Source, int X, int Y, TDragState State, bool &Accept);
void __fastcall ActionNodeAddLabelExecute(TObject *Sender);
void __fastcall ActionNodeModifyExecute(TObject *Sender);
void __fastcall ActionNodeDeleteHardExecute(TObject *Sender);
void __fastcall ActionFileSaveAsExecute(TObject *Sender);
void __fastcall ActionFileOpenExecute(TObject *Sender);
void __fastcall TreeViewFamilyEdited(TObject *Sender,
TTreeNode *Node, AnsiString &S);
void __fastcall TreeViewFamilyEditing(TObject *Sender,
TTreeNode *Node, bool &AllowEdit);
void __fastcall ActionNodeMoveUpExecute(TObject *Sender);
void __fastcall ActionNodeMoveDownExecute(TObject *Sender);
void __fastcall ActionNodeFindLabelExecute(TObject *Sender);
void __fastcall ActionNodeAddDataExecute(TObject *Sender);
void __fastcall Exit1Click(TObject *Sender);
void __fastcall ActionNodeDeleteSoftExecute(TObject *Sender);
void __fastcall ActionEditUndoExecute(TObject *Sender);
void __fastcall ActionEditRedoExecute(TObject *Sender);
void __fastcall ActionFileClearExecute(TObject *Sender);
void __fastcall ActionEditRefreshExecute(TObject *Sender);
void __fastcall ActionOtherChangeExecute(TObject *Sender);
void __fastcall ActionOtherRestoreExecute(TObject *Sender);
void __fastcall ActionTreeExpandExecute(TObject *Sender);
void __fastcall ActionTreeCollapseExecute(TObject *Sender);
private: // User declarations
AnsiString __fastcall CreateLabel(AnsiString FirstName, AnsiString LastName);
void __fastcall ClearEntryPanel();
void __fastcall ReflectNodeLabel(TTreeNode* node);
void __fastcall TransferPersonalInfoFromEditEntry(unsigned int id, AnsiString text,TPersonalInfo *pinfo);
bool __fastcall TransferPersonalInfoToEditEntry(TPersonalInfo *pi);
TTreeNode* nodetoremember;
public: // User declarations
__fastcall TFormFamilyTree(TComponent* Owner);
};
//---------------------------------------------------------------------------
extern PACKAGE TFormFamilyTree *FormFamilyTree;
//---------------------------------------------------------------------------
#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -