자유롭게 질의 및 응답을 할 수 있는 게시판입니다. 개발자 여러분의 답변이 큰 도움이 됩니다. 
  • 제품설치/등록 오류 문의: 설치/등록 Q&A 이용 (제품 구매 고객 한정)

Q. 

DBCtrlGrid에 DBLookupCombo를 올린 후 콤보를 선택하면 ""Operation not allowed in DBCtrlGrid"" 오류가 발생하고 목록이 표시되지 않습니다. 어떻게 해결해야하나요?


델파이 4에서 델파이 2007로 마이그레이션 시 중입니다.


A. 

아래와 같이 FormCreate 시 FixDBLookupDataLinks 메소드를 호출해 보세요.


http://stackoverflow.com/questions/1453041/dbctrlgrid-with-a-dblookupcombobox


interface

uses
  ...
  ;

type Tdbp = class(TDBCtrlGrid);
type tdbl = class(TDBLookupControl);

type
  TForm4 = class(TForm)
    ...
    DBCtrlGrid1: TDBCtrlGrid;
    ...
  private
    ...
    function FindLCB(DataFieldName: String): TDBLookupComboBox;
    procedure FixDBLookupDataLinks;
  public
    ...
  end;



...and in your implementation:


----------


implementation

procedure TForm4.FormCreate(Sender: TObject);
begin
  ...
  DBCtrlGrid1.DataSource := DataSource1;
  FixDBLookupDataLinks;
end;

procedure TForm4.FixDBLookupDataLinks;
var
  lcb: TDBLookupComboBox;
  I,n: Integer;
  MyDataLink: TDataLink;
  ctl: TControl;
  dbp: Tdbctrlpanel;
begin
  dbp := Tdbp(DBControlGrid1).Panel;
  for n := 0 to Pred(dbp.ControlCount) do
  begin
    ctl := dbp.Controls[n];
    if ctl.ClassType = TDBLookupComboBox then
    begin
      lcb := TDBLookupComboBox(ctl);
      lcb.ControlStyle := lcb.ControlStyle + [csReplicatable];
      TDBL(lcb).ListLink.DataSourceFixed := False;
      for I := 0 to Pred(lcb.ControlCount) do
      begin
        if lcb.Controls[I] is TPopupDataList then
        begin
          TDBL(lcb).ListLink.DataSourceFixed := False;
          TDBL(lcb).DataLink.DataSourceFixed := False;
          MyDataLink := TDataLink(lcb.Controls[I].Perform(CM_GETDATALINK, 0, 0));
          if MyDataLink <> nil then
            MyDataLink.DataSourceFixed := False;
            MyDataLink.DataSource := nil;
        end;
      end;
    end;
  end;
end;

function TForm4.FindLCB(DataFieldName: String): TDBLookupComboBox;
var
  i: Integer;
begin
  Result := Nil;
  for i := 0 to Pred(ControlCount) do
    if Controls[i].ClassType = TDBLookupComboBox then
      if TDBLookupComboBox(Controls[i]).DataField = DataFieldName then
      begin
        Result := TDBLookupComboBox(Controls[i]);
        Break;
      end;
end;
번호 제목 글쓴이 날짜 조회 수
공지 [프로그래밍 강의] 2021.6~2021.12 관리자 2015.01.22 17260
공지 유용한 관련 사이트 관리자2 2014.03.20 56158
공지 본 게시판은 개발자 여러분들의 질문과 답변을 공유하는 공간입니다. 관리자 2012.01.10 99579
613 [세미나][DavidI] BeaconFence의 인식 범위는 어느정도까지 가능한가요? 험프리 2015.10.21 129
612 [마이그레이션][델파이3>델파이10시애틀] Quick Report 마이그레이션 방법 알려주세요(마이그레이션 후 레포트 폼이 실행되지 않습니다.) [1] 박성민 2015.10.20 398
611 비콘 블루투스 끊겼을때 exception 처리에 대해 devdevil0625 2015.10.16 266
610 [마이그레이션][델파이 1~3] WinProcs.dcu, WinTypes.dcu not found 오류 발생 시 대처방법 험프리 2015.10.16 329
609 [마이그레이션][팁] TServerSocket, TClientSocket 컴포넌트 추가 방법 험프리 2015.10.13 254
608 FastReport 문의. [1] 회원 2015.10.12 1241
607 사진앨범 접근, 사진 가져오기 [1] file 라드 2015.10.05 322
606 delphi dx 및 er stduio 설치후 기존 버전 문제 [1] voyager 2015.10.12 154
605 [마이그레이션][팁] 함수(또는 변수)에 빨간밑줄이 가고 컴파일 시 Undeclared Identifier 오류 시 조치방법 험프리 2015.10.12 153
» [마이그레이션][델파이4>2007] DBCtrlGrid에 DBLookupCombo를 올린 후 콤보를 선택하면 ""Operation not allowed in DBCtrlGrid"" 오류가 발생하고 목록이 표시되지 않습니다. 어떻게 해결해야하나요? 험프리 2015.05.30 406
603 [마이그레이션] 델파이 XE8에서 체크박스, 라디오버튼의 글자의 색상을 변경하고 싶어요. 험프리 2015.06.10 1248
602 [마이그레이션] 델파이 버전별 소스 호환성에 대한 문의 [1] 유메꾸이 2015.08.21 392
601 line-wrap activated option setting [2] 우석이 2015.10.05 128
600 TDataSetProvider 에 대해 문의합니다. [1] file 거북이 2015.10.05 152
599 Delphi 10 Seattle 리포팅툴 [1] 라시드 2015.10.06 345
598 입력받은 텍스트가 한글인지 검사 [3] 라드 2015.09.30 2457
597 한문을 한글로 변환하는 방법 좀 알려주세요. [3] 로로봉 2015.10.02 1581
596 재질문 Push 알림 한글깨짐 문의 [1] file 사랑남 2015.09.25 496
595 몇몇 데모 앱들이 OSX에서 실행시 PAServer 상에 오류가납니다. [1] file devdevil0625 2015.09.23 103
594 [공유] iOS9에서 웹브라우저를 실행하면 앱이 비정상 종료됩니다. Humphery 2015.10.01 228