안녕하세요...
꼭 좀 도와 주세요...
폼1의 버튼을 누르면 폼2가(show)가 나타납니다...
그리고 폼2의 버튼9개를 클릭시 폼3이 동적으로 생성됩니다..(modal)
동적으로 생성된 폼3에 동적으로 생성된 버튼이 폼3을 종료시키는 역할을 하는데..
여기서 에러가 납니다..
ivalid pointer..... 
소스는 다음과 같음....
동적으로 생성된 폼과 콤보박스, 버튼
procedure Tfrm_cate2.FormActivate(Sender: TObject);
var
    r:trect;
    i:integer;
begin
    for i:=0 to frm_edit.slist[inx].count do begin
      setlength(mycheckbox,frm_edit.slist[inx].count);
       mycheckbox[i]:=Tflatcheckbox.create(frm_cate2);
       mycheckbox[i].OnClick:=mycheckboxonclick;
   with mycheckbox[i] do
    if i=0 then  begin
      caption :='All of the below ';
      parent :=frm_cate2;
      Transparent:=true;
      layout:=checkboxRight;
      left:=1;
      top:=1 ;
      height:=13;
      width:=101;
      show;
    end
  else if i<>0 then
   begin
      layout:=checkboxRight;
      caption :=frm_edit.slist[inx].strings[i-1];
      parent :=frm_cate2;
      Transparent:=true;
      left:=1;
      top:= mycheckbox[i-1].top + mycheckbox[i-1].height;
      height:=13;
      width:=101;
      //cursor:=crhandpoint;
      show;
    end;
    end;
    //end;
    //onclick := mycheckboxclick;
  mybutton:=ttransparentbutton.create(frm_cate2);
  with mybutton do  begin
    caption:=' O K';
    parent:=frm_cate2;
    left:=1;
    top:= mycheckbox[frm_edit.slist[inx].count].top+mycheckbox                    [frm_edit.slist[inx].count].height;
    height:=13;
    width:=101;
    show;
    
    onclick := mybuttonclick;
    end;
    frm_cate2.Height:=13*(frm_edit.slist[inx].count+2);
    frm_cate2.ClientHeight:=13*(frm_edit.slist[inx].count+2);
    
    end;
procedure Tfrm_cate2.mybuttonclick(sender : tobject);
 begin
   //free;
 frm_cate2.close;
 end;
			 
	
	
    
    
	
	
    
    
    
제 경험으로는 이런 경우 흔히
폼3이 Close되는 데 다른 곳에서 폼3의 컴포넌트를 참조하고 있거나
하는 경우였습니다.
폼3이 Close될때를 추적해 보시는 게 어떨까 하는데요..
왕초보 wrote:
> 안녕하세요...
> 꼭 좀 도와 주세요...
> 폼1의 버튼을 누르면 폼2가(show)가 나타납니다...
> 그리고 폼2의 버튼9개를 클릭시 폼3이 동적으로 생성됩니다..(modal)
> 동적으로 생성된 폼3에 동적으로 생성된 버튼이 폼3을 종료시키는 역할을 하는데..
> 여기서 에러가 납니다..
> ivalid pointer.....
>
> 소스는 다음과 같음....
>
> 동적으로 생성된 폼과 콤보박스, 버튼
> procedure Tfrm_cate2.FormActivate(Sender: TObject);
> var
> r:trect;
> i:integer;
> begin
> for i:=0 to frm_edit.slist[inx].count do begin
> setlength(mycheckbox,frm_edit.slist[inx].count);
> mycheckbox[i]:=Tflatcheckbox.create(frm_cate2);
> mycheckbox[i].OnClick:=mycheckboxonclick;
> with mycheckbox[i] do
> if i=0 then begin
> caption :='All of the below ';
> parent :=frm_cate2;
> Transparent:=true;
> layout:=checkboxRight;
> left:=1;
> top:=1 ;
> height:=13;
> width:=101;
> show;
>
> end
> else if i<>0 then
> begin
> layout:=checkboxRight;
> caption :=frm_edit.slist[inx].strings[i-1];
> parent :=frm_cate2;
> Transparent:=true;
> left:=1;
> top:= mycheckbox[i-1].top + mycheckbox[i-1].height;
> height:=13;
> width:=101;
> //cursor:=crhandpoint;
> show;
> end;
> end;
> //end;
> //onclick := mycheckboxclick;
> mybutton:=ttransparentbutton.create(frm_cate2);
> with mybutton do begin
> caption:=' O K';
> parent:=frm_cate2;
> left:=1;
> top:= mycheckbox[frm_edit.slist[inx].count].top+mycheckbox [frm_edit.slist[inx].count].height;
> height:=13;
> width:=101;
> show;
>
> onclick := mybuttonclick;
> end;
> frm_cate2.Height:=13*(frm_edit.slist[inx].count+2);
> frm_cate2.ClientHeight:=13*(frm_edit.slist[inx].count+2);
>
> end;
>
>
> procedure Tfrm_cate2.mybuttonclick(sender : tobject);
> begin
> //free;
> frm_cate2.close;
> end;
>