Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Treeview
Message
From
06/10/2004 11:02:37
 
 
To
06/10/2004 05:27:38
General information
Forum:
Visual FoxPro
Category:
ActiveX controls in VFP
Title:
Miscellaneous
Thread ID:
00949070
Message ID:
00949216
Views:
6
This message has been marked as a message which has helped to the initial question of the thread.
Hi,

>>
Is it possible to mark in a grey forecolor the check box of a Node whose children are partially checked ?
>>

This might get you started (hope it still works..):
LPARAMETER loNode
* loNode is FirstSibling
*Recursive
*Check all siblings of this node
* If all are set then Parent Image should be 1
* If some are set 3
* If none are set then 0

WITH loNode
  IF ISNULL(.PARENT)
    RETURN
  ENDIF

  LOCAL lnTick,llGreys,lcIndex

  lnTick = 0
  lcIndex = .firstsibling.INDEX

  DO WHILE lcIndex <> .LastSibling.INDEX
    * Count fully checked
    WITH THIS.Nodes(lcIndex)
      lnTick = lnTick + IIF(.IMAGE = 1,1,0)
      llGreys = EVAL(".Image = 2")
      IF llGreys
        EXIT
      ENDIF
      lcIndex = .NEXT.INDEX
    ENDWITH
  ENDDO
  * Either hit a grey or on lastsibling
  WITH THIS.Nodes(lcIndex)
    lnTick = lnTick + IIF(.IMAGE = 1,1,0)
    llGreys = EVAL(".Image = 2")
  ENDWITH

  DO CASE
    CASE llGreys
      .PARENT.IMAGE = 2
    CASE lnTick = loNode.PARENT.Children
      * All siblings were ticked
      .PARENT.IMAGE = 1
    CASE lnTick = 0
      * No Greys or Ticks
      .PARENT.IMAGE = 0
    OTHERWISE
      *Some ticks
      .PARENT.IMAGE = 2
  ENDCASE

  *Now run this again using first sibling of Parent
  THIS.CheckIconUpTree(.PARENT.firstsibling)
ENDWITH
Works from 'bottom up' - call CheckIconUpTree(node.parent.firstsibling) when a node is selected/deselected.
HTH,
Viv
Previous
Reply
Map
View

Click here to load this message in the networking platform