procedure TF_Main.dxBarButton125Click(Sender: TObject);
var
  i: Integer;
begin
if (F_Main.ActiveMDIChild.ClassName = 'TfrmSelectAPForm') then
  begin
    for i := Low(PanelCaption) to High(PanelCaption) do
    begin //在frmSelectAPForm中定義了一個常量數組,用于存儲功能鍵標題和序號
      if PanelCaption[i] = '連接鍵設定' then
        if frmSelectAPForm <> nil then
        begin //如果功能設定窗體已經創建,那麼就不必重複創建,直接切換到
連接鍵設定即可!
          frmSelectAPForm.pagSelect.ActivePageIndex := i;
          break;
        end;
    end;
  end
  else
  begin
    CallCloseForm(Sender);
    ReEnter(doneEvent, 0);    p_sSelectAPFormCaption := '連接鍵設定';
    p_iSelectAPFormActivePageID := 8;
    OpenMDIForm(Sender, TfrmSelectAPForm, '', '', True, 1);
  end;

解决方案 »

  1.   

    procedure TF_Main.dxBarButton125Click(Sender: TObject);
    begin
      if (F_Main.ActiveMDIChild.ClassName = 'TfrmSelectAPForm') then
        if Trim(TfrmSelectAPForm(ActiveMDIChild).panTitle.Caption) = '硈挡龄砞﹚' then
          Exit;  CallCloseForm(Sender);
      ReEnter(doneEvent, 0);  p_sSelectAPFormCaption := '硈挡龄砞﹚';
      p_iSelectAPFormActivePageID := 8;
      OpenMDIForm(Sender, TfrmSelectAPForm, '', '', True, 1);end;