当前位置: 首页>>代码示例>>C++>>正文


C++ TTimer::Connect方法代码示例

本文整理汇总了C++中TTimer::Connect方法的典型用法代码示例。如果您正苦于以下问题:C++ TTimer::Connect方法的具体用法?C++ TTimer::Connect怎么用?C++ TTimer::Connect使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在TTimer的用法示例。


在下文中一共展示了TTimer::Connect方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: TGMainFrame

MyMainFrame::MyMainFrame(const TGWindow *p, UInt_t w, UInt_t h, 
  TH1F* histogram[10], TH1F* histogram_store[10], TH2F* map[10],
  TGraphErrors* graph_fit[10], TGraphErrors* graph_threshold[10],
  TGraphErrors* graph_detected[10], TGraphErrors* graph_neutrons[10],
  TFile* file)
{
  for (int i = 0; i < 10; i++) {
	  fHistogram[i] = histogram[i];
	  fHistogram_store[i] = histogram_store[i];
	  fMap[i] = map[i];
    fGraph_fit[i] = graph_fit[i];
	  fGraph_threshold[i] = graph_threshold[i];
	  fGraph_detected[i] = graph_detected[i];
	  fGraph_neutrons[i] = graph_neutrons[i];
	  fFile = file;

	  fGraph_fit[i]->SetPoint(0, 0, 0);
	  fGraph_fit[i]->SetPointError(0, 0, 0);
	  fGraph_threshold[i]->SetPoint(0, 0, 0);
	  fGraph_threshold[i]->SetPointError(0, 0, 0);
	  fGraph_detected[i]->SetPoint(0, 0, 0);
	  fGraph_detected[i]->SetPointError(0, 0, 0);
	  fGraph_neutrons[i]->SetPoint(0, 0, 0);
	  fGraph_neutrons[i]->SetPointError(0, 0, 0);

    fGraph_fit[i]->SetMarkerColor(kRed);
    fGraph_fit[i]->SetMarkerStyle(20);
    fGraph_fit[i]->SetLineColor(kRed);
    fGraph_fit[i]->SetLineWidth(1);

    fGraph_threshold[i]->SetMarkerColor(kBlack);
    fGraph_threshold[i]->SetMarkerStyle(20);
    fGraph_threshold[i]->SetLineColor(kRed);
    fGraph_threshold[i]->SetLineWidth(1);

    fGraph_detected[i]->SetMarkerColor(kRed);
    fGraph_detected[i]->SetMarkerStyle(20);
    fGraph_detected[i]->SetLineColor(kRed);
    fGraph_detected[i]->SetLineWidth(1);

    fGraph_neutrons[i]->SetMarkerColor(kBlue);
    fGraph_neutrons[i]->SetMarkerStyle(20);
    fGraph_neutrons[i]->SetLineColor(kRed);
    fGraph_neutrons[i]->SetLineWidth(1);

    fHistogram_store[i]->SetLineColor(kYellow);
    fHistogram_store[i]->SetFillColor(kYellow);
    fHistogram[i]->SetAxisRange(0, 5000, "Y");
    fHistogram_store[i]->SetAxisRange(0, 5000, "Y");
  }

  /////////////////////////////////////////////////////////////////////////////
	// Create the main frame
	fMain = new TGMainFrame(p, w, h);

  /////////////////////////////////////////////////////////////////////////////
  // Create a frame for combo box 1
  TGHorizontalFrame *frame1 = new TGHorizontalFrame(fMain, 1000, 20);

  // Create combo box 1
  TGComboBox *selectionCombo1 = new TGComboBox(frame1, 98);
  Int_t initialSelection1 = 0;
  Int_t firstEntry = 0;
  Int_t lastEntry = 9;
  for (int i = firstEntry; i <= lastEntry; i++) {
    char tmp[20];
    sprintf(tmp, "Channel %i", i);
    selectionCombo1->AddEntry(tmp, i);
  }
  selectionCombo1->Connect("Selected(Int_t)", "MyMainFrame", this, "do_selection1(Int_t)");
  selectionCombo1->Resize(100, 20);
  frame1->AddFrame(selectionCombo1, new TGLayoutHints(kLHintsLeft, 5, 5, 3, 4));

  // Add the frame for combo box 1 to the main frame
  fMain->AddFrame(frame1, new TGLayoutHints(kLHintsLeft, 2, 2, 2, 2));

  // Create embedded canvas 1 and add it to the main frame
  fEcanvas1 = new TRootEmbeddedCanvas("Ecanvas1", fMain, 1000, 220);
  fMain->AddFrame(fEcanvas1, new TGLayoutHints(kLHintsExpandX | kLHintsExpandY, 10, 10, 10, 1));

  /////////////////////////////////////////////////////////////////////////////
  // Create a frame for combo box 2
  TGHorizontalFrame *frame2 = new TGHorizontalFrame(fMain, 1000, 20);

  // Create combo box 2
  TGComboBox *selectionCombo2 = new TGComboBox(frame2, 99);
  Int_t initialSelection2 = 1;
  for (int i = firstEntry; i <= lastEntry; i++) {
    char tmp[20];
    sprintf(tmp, "Channel %i", i);
    selectionCombo2->AddEntry(tmp, i);
  }
  selectionCombo2->Connect("Selected(Int_t)", "MyMainFrame", this, "do_selection2(Int_t)");
  selectionCombo2->Resize(100, 20);
  frame2->AddFrame(selectionCombo2, new TGLayoutHints(kLHintsCenterX, 5, 5, 3, 4));

  // Add the frame for combo box 2 to the main frame
  fMain->AddFrame(frame2, new TGLayoutHints(kLHintsLeft, 2, 2, 2, 2));

  // Create embedded canvas 2 and add it to the main frame
//.........这里部分代码省略.........
开发者ID:kakabori,项目名称:NeutronMonitor,代码行数:101,代码来源:myFrame.cpp


注:本文中的TTimer::Connect方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。