C++Builder Programming Forum
C++Builder  |  Delphi  |  FireMonkey  |  C/C++  |  Free Pascal  |  Firebird
볼랜드포럼 BorlandForum
 경고! 게시물 작성자의 사전 허락없는 메일주소 추출행위 절대 금지
C++빌더 포럼
Q & A
FAQ
팁&트릭
강좌/문서
자료실
컴포넌트/라이브러리
메신저 프로젝트
볼랜드포럼 홈
헤드라인 뉴스
IT 뉴스
공지사항
자유게시판
해피 브레이크
공동 프로젝트
구인/구직
회원 장터
건의사항
운영진 게시판
회원 메뉴
북마크
볼랜드포럼 광고 모집

C++빌더 Q&A
C++Builder Programming Q&A
[55001] 답변 감사합니다.
안정혁.덱스터 [dexter] 1949 읽음    2008-10-23 19:43
장성호님 답변 감사합니다.
Controls.pas파일에서 SetZOrderPosition 함수 소스보면서
빌더로 컨버팅할까 고민중이었는데 이렇게 해결책을 두개나 알려주셔서 지금
어떤걸로 적용할가 행복한 고민중입니다.
그리고 55000번 게시물 등록도 축하드립니다. ^^

장성호 님이 쓰신 글 :
: 음...
:
: 지난번에 팁란에 쓴 SetZOrderPosition 관한 부분은 잘못된 부분이 있었습니다.
: private 로 변수가 아니라 함수같은경우 access하기  쉽지 않더라구요
:
: SetZOrderPosition를 쓰는 방법으로
:
: 첫째로
:   박지훈.임프님이 소개해준 방법으로   ***.hpp 파일을 수정해서 쓰는 방법입니다.
:    http://cbuilder.borlandforum.com/impboard/impboard.dll?action=read&db=bcb_tip&no=21
:
:
: //Controls.hpp 파일
: 
: 	void __fastcall SetParentFont(bool Value);
: 	void __fastcall SetShowHint(bool Value);
: 	void __fastcall SetParentShowHint(bool Value);
: 	void __fastcall SetPopupMenu(Menus::TPopupMenu* Value);
: 	void __fastcall SetText(const AnsiString Value);
: 	void __fastcall SetTop(int Value);
: 	void __fastcall SetVisible(bool Value);
: 	void __fastcall SetWidth(int Value);
: 
: public:       //다음과 같이 SetZOrderPosition 메소듣 public으로 수정해버린다.
: 	void __fastcall SetZOrderPosition(int Position);
: private:
: 	void __fastcall UpdateAnchorRules(void);
: 	void __fastcall WriteIsControl(Classes::TWriter* Writer);
: 
: 

:
:
: 두번째 방법은
:       SetZOrderPosition 함수를 직접 구현하는 방법입니다.
:
:
: 아래는 제가 작성한 코드입니다.
:
:
:
: //C++Builder버젼
: void __fastcall SetZOrderPosition3(TWinControl *wParent,TControl *Ctrl, int  Position)
: {
:     TList *cList=new TList;
: 
:     for(int i=wParent->ControlCount -1  ; i>=0 ; i--)
:       if( wParent->Controls[i]!=Ctrl )cList->Add( wParent->Controls[i]);
: 
:     if(Position>=wParent->ControlCount)cList->Add(Ctrl);
:     else cList->Insert(Position,Ctrl);
: 
:     for(int i=0 ;i< cList->Count;i++)
:         ((TControl*)cList->Items[i])->Parent=NULL;
: 
:     for(int i=cList->Count -1; i>=0;i--)
:         ((TControl*)cList->Items[i])->Parent=wParent;
: 
:     delete cList;
: }
: //------------------------------
: void __fastcall TForm1::Button1Click(TObject *Sender)
: {
:   int idx=StrToIntDef(Edit1->Text,0);
: 
:   TControl *Ctrl=(TControl *)FindComponent(Edit2->Text);
:   if( Ctrl==NULL)return;
: 
:   SetZOrderPosition3(this,Ctrl,idx);
: 
: }
: 
: 

:
:
:
:
: //Delphi 버젼
: procedure SetZOrderPosition3(wParent: TWinControl ;  Ctrl:TControl; Position: Integer);
: var
:   I, Count: Integer;
:   cList: TList;
:   bAddCtrl: boolean;
: begin
:   cList:=TList.Create;
: 
:   for i:=wParent.ControlCount -1  downto 0  do
:   begin
: 
:       if wParent.Controls[i]<>Ctrl then
:         cList.Add( wParent.Controls[i]);
:   end;
: 
: 
:   if(Position>=wParent.ControlCount) then
:      cList.Add(Ctrl)
:   else
:     cList.Insert(Position,Ctrl);
: 
:   for i:=0 to cList.Count -1 do
:   begin
:     TControl(cList.Items[i]).Parent:=nil;
:   end;
: 
:   for i:=cList.Count -1  downto 0  do
:   begin
:     TControl(cList.Items[i]).Parent:=wParent;
:   end;
: 
: 
:   cList.Free;
: end;
: 
: 
: procedure TForm1.Button1Click(Sender: TObject);
: var
:   idx: Integer;
:   ctrl: TControl;
: begin
:   idx:=StrToIntDef(Edit1.Text,0);
: 
:   ctrl:=TControl(FindComponent(Edit2.Text));
:   if not Assigned(ctrl) then Exit;
: 
:   SetZOrderPosition3(self,ctrl,idx);
: 
: 
: end;
: 
: 

:
:
: 그럼...
:
:
:
: 안정혁.덱스터 님이 쓰신 글 :
: : 혹시 SetZOrderPosition의 사용법에 대해서 아시는분 있으면
: : 사용법에 대해서 좀 알려주세요
: : BDS2006의 헬프에는 언급도 없고
: : 팁&트릭란에 장성호님이 게시한 내용을 봐서는 잘모르겠네요
: : 무작정 어떻게든 써볼려구 하니
: : TControl::SetZOrderPosition not Accessible 에러 나오는데
: : 혹시라도 써보신분 있으면 좀 알려주세요

+ -

관련 글 리스트
54997 SetZOrderPosition의 사용법 안정혁.덱스터 2728 2008/10/23
55000     Re:SetZOrderPosition의 사용법 장성호 2558 2008/10/23
55001         답변 감사합니다. 안정혁.덱스터 1949 2008/10/23
Google
Copyright © 1999-2015, borlandforum.com. All right reserved.