|
quote from BDS2006 Help Document...
----------------------------------------
TTreeNode::StateIndex Property
...bla~
...bla~
...
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
Valid index values are 1..15 only. Values of 0 or -1 mean no state icon.
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
alex 님이 쓰신 글 :
: 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 = 0;
:
: pAddToNode = pNode;
: for( int j=0;j<3 ;j++ )
: {
: pNode = tv->Items->AddChildObject( pAddToNode ,s.c_str() , (TObject *)0xffff );
: pNode->StateIndex = 0;
:
: }
: }
: }
:
: 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;
: }
: }
: }
: }
|