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
[43958] Why i get 2 icons for the TreeNode with checkbox? ( I only need StateIndex)
alex [] 836 읽음    2006-03-07 11:03
My code is like this, why i see the ImageIndex as well.
Once i click the checkbox, I like to display only the StateImage 

And also, if i use 
  ht.Contains(htOnStateIcon)
Never hit this.

ps. If i use ImageIndex instead of StateIndex, it shows the single icon but
it's not reflect the change properly.

__fastcall TForm1::TForm1(TComponent* Owner)
    : TForm(Owner)
{

    AnsiString s;
    TTreeNode *pNode = NULL;
    TTreeNode *pAddToNode = NULL;
    TTreeNode *pChildNode;
    for ( int i = 0; i < 20; i++ )
    {
        s = AnsiString( "test node") + AnsiString(i);
        pNode = tv->Items->AddObject( NULL,s.c_str() , (TObject *)0xffff );
        pNode->StateIndex = 2;//checked icon..

        pAddToNode = pNode;
        for( int j=0;j<3 ;j++ )
        {
            pNode = tv->Items->AddChildObject( pAddToNode ,s.c_str() , (TObject *)0xffff );
            pNode->StateIndex = 2;

        }
    }
}

void __fastcall TForm1::tvMouseDown(TObject *Sender, TMouseButton Button,
      TShiftState Shift, int X, int Y)
{
  if ( Button == mbLeft )
    {
        TTreeNode *pNode   = ((TTreeView*)Sender)->GetNodeAt(X, Y);
        if( pNode )
        {

            THitTests ht = tv->GetHitTestInfoAt( X, Y );
            if ( ht.Contains(htOnStateIcon) || ht.Contains(htOnIcon))
            {
                tv->Selected = pNode;
                if ( pNode->StateIndex == 0 || pNode->StateIndex == 2 )
                    pNode->StateIndex = 1;
                else
                    pNode->StateIndex = 2;
            }
        }
    }
}

+ -

관련 글 리스트
43958 Why i get 2 icons for the TreeNode with checkbox? ( I only need StateIndex) alex 836 2006/03/07
43960     Re:Why i get 2 icons for the TreeNode with checkbox? ( I only need StateIndex) Studyman 944 2006/03/07
Google
Copyright © 1999-2015, borlandforum.com. All right reserved.