TreeCombos.cpp
上传用户:hylc_2004
上传日期:2014-01-23
资源大小:46800k
文件大小:3k
源码类别:

Delphi控件源码

开发平台:

Delphi

  1. //---------------------------------------------------------------------------
  2. #include <vcl.h>
  3. #pragma hdrstop
  4. #include "TreeCombos.h"
  5. //---------------------------------------------------------------------------
  6. #pragma package(smart_init)
  7. #pragma link "fcCombo"
  8. #pragma link "fcDemoRichEdit"
  9. #pragma link "fcFontCombo"
  10. #pragma link "fcTreeCombo"
  11. #pragma link "fctreecombo"
  12. #pragma resource "*.dfm"
  13. TTreeComboDemoForm *TreeComboDemoForm;
  14. //---------------------------------------------------------------------------
  15. __fastcall TTreeComboDemoForm::TTreeComboDemoForm(TComponent* Owner)
  16.         : TForm(Owner)
  17. {
  18. }
  19. //---------------------------------------------------------------------------
  20. void __fastcall TTreeComboDemoForm::PageControl1Change(TObject *Sender)
  21. {
  22.   if (PageControl1->ActivePage == TabSheet1) {
  23.      TreeCombo1->SetFocus();
  24.   } else fcFontCombo1->SetFocus();
  25. }
  26. //---------------------------------------------------------------------------
  27. void __fastcall TTreeComboDemoForm::FormShow(TObject *Sender)
  28. {
  29.  PageControl1Change(PageControl1);
  30.  TreeCombo1->Text= "HandShake";
  31.  TreeCombo1->SelectAll();
  32.  TreeCombo2->Text= "Satellite";
  33. }
  34. //---------------------------------------------------------------------------
  35. void __fastcall TTreeComboDemoForm::CheckListBoxClickCheck(TObject *Sender)
  36. {
  37.   if (CheckListBox->Checked[4]) {ActiveCombo->TreeOptions << tvoRowSelect;}
  38.   else ActiveCombo->TreeOptions >> tvoRowSelect;
  39.   if (CheckListBox->Checked[2]) {ActiveCombo->TreeOptions << tvoShowButtons;}
  40.   else ActiveCombo->TreeOptions >> tvoShowButtons;
  41.   if (CheckListBox->Checked[0]) {ActiveCombo->TreeOptions << tvoShowLines;}
  42.   else ActiveCombo->TreeOptions >> tvoShowLines;
  43.   if (CheckListBox->Checked[1]) {ActiveCombo->TreeOptions << tvoShowRoot;}
  44.   else ActiveCombo->TreeOptions >> tvoShowRoot;
  45.   if (CheckListBox->Checked[3]) {ActiveCombo->Options << icoExpanded;}
  46.   else ActiveCombo->Options >> icoExpanded;
  47.   if (CheckListBox->Checked[5]) {ActiveCombo->Options << icoEndNodesOnly;}
  48.   else ActiveCombo->Options >> icoEndNodesOnly;
  49.   ActiveCombo->ShowMatchText = CheckListBox->Checked[6];
  50.   if (CheckListBox->Checked[7]) {ActiveCombo->Style = Fccombo::csDropDownList;}
  51.   else ActiveCombo->Style = Fccombo::csDropDown;
  52. }
  53. //---------------------------------------------------------------------------
  54. void __fastcall TTreeComboDemoForm::ComboEnter(TObject *Sender)
  55. {
  56.   ActiveCombo = (TfcCustomTreeCombo *)Sender;
  57.   CheckListBox->Checked[0] = (ActiveCombo->TreeOptions.Contains(tvoShowLines));
  58.   CheckListBox->Checked[1] = (ActiveCombo->TreeOptions.Contains(tvoShowRoot));
  59.   CheckListBox->Checked[2] = (ActiveCombo->TreeOptions.Contains(tvoShowButtons));
  60.   CheckListBox->Checked[3] = (ActiveCombo->Options.Contains(icoExpanded));
  61.   CheckListBox->Checked[4] = (ActiveCombo->TreeOptions.Contains(tvoRowSelect));
  62.   CheckListBox->Checked[5] = (ActiveCombo->Options.Contains(icoEndNodesOnly));
  63.   CheckListBox->Checked[6] = ActiveCombo->ShowMatchText;
  64.   CheckListBox->Checked[7] = (ActiveCombo->Style == Fccombo::csDropDownList);
  65. }
  66. //---------------------------------------------------------------------------