Attributes & Events of MS Treview(Please help..(:<)

I am trying to use use checkbox property of MS Treeview.
Does anybody has an idea where can I find the attributes & events of an activeX control?

What I'm trying to do is to:
1. Identify the number of Entries in a Treview
2. Loop for each Entry in a treeview. And lastly,
3. To identify if that item's checkbox is selected.

If you have any Idea, please send me code sample how to achieve this.

Thanx,
gsanchez


Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.

Anybody know how to toggle

Anybody know how to toggle the 'cheked/unchecked' property of a checkbox using javascript? I need to toggle the 'checked' state of a checkbox based on the click of an image. Click on a graphic once it the checkbox is checked, click the graphic again and it's unchecked. Normally I would just use Dreamweaver's built in behaviors for this but I can't get them to work in this instance, if anyone could toss me an example of the code or point me to where I can find an example of the code I'd appreciate it.


jurjen's picture

Javascript in an MS Treeview OCX??

It is a bit confusing since this article is about the checkboxes in the MS Treeview OCX control and I don't think you want to control those from Javascript?
Since you mention Dreamweaver I suppose you mean that the checkbox is just a simple HTML element. To change the state I guess you can try

    checkbox.checked= !checkbox.checked;

Progress sometimes has

Progress sometimes has problems with INPUT-OUTPUT parameters in OCX events. If your program falls into a runtime error #5900 (wrong input/output parameter mode), simply turn the INPUT-OUTPUT option into a simple INPUT.
Now to automatically check/uncheck children nodes, I usually use an internal procedure (invoked recursively... to handle children of children, etc...). This is how it looks:
#1. The automatically generated procedure to handle OCX.NodeCheck event

PROCEDURE CtrlFrame.TreeView.NodeCheck .
/*------------------------------------------------------------------------------
Purpose:
Parameters: Required for OCX.
Node
Notes:
------------------------------------------------------------------------------*/
DEFINE INPUT PARAMETER p-Node AS COM-HANDLE NO-UNDO.
RUN pr-NodeCheck (INPUT p-Node).
END PROCEDURE.

#2 The extra procedure

PROCEDURE pr-NodeCheck :
/*------------------------------------------------------------------------------
Purpose:
Parameters:
Notes:
------------------------------------------------------------------------------*/
DEF INPUT PARAM p-Node AS COM-HANDLE NO-UNDO.
DEF VAR i-Loop AS INT NO-UNDO.
DEF VAR ch-Node AS COM-HANDLE NO-UNDO.
ch-Node = p-Node:child.
DO WHILE ch-Node <> 0:
ch-Node:CHECKED = p-Node:CHECKED.
IF ch-Node:children > 0 THEN RUN pr-NodeCheck(ch-Node).
ch-Node = ch-Node:NEXT.
END.
END PROCEDURE.


redskienz's picture

It's Working! Thanx

Hi oli.dune,

Bunch of Thanx! Your code really worked.. I've been solving that issue for about a week..
Thank you so much.

gSanchez


redskienz's picture

Thanx!

Do you also know how to use the event "nodeChecked" . i can't understand how to use that cause it has parameter input-output variable. Example of this is when you checked the parent in the tree, its children should be also marked as checked.

gSanchez


Look in the "Pro*Tools"

Look in the "Pro*Tools" toolbar (that generally comes with an AppBuilder session). You'll find an entry named "Progress COM Object Viewer". Once this tool started, click its "Open" button and select the .OCX file you want to analyze (for instance, in your case: "mscomctl.ocx"). Now you have to look at the "COM Objects" list to find out the entry "Treeview", and maybe "Nodes" and "Node" too...

And about some sample code:

DEF VAR iLoop AS INT NO-UNDO.
DEF VAR iNumberOfNodes AS INT NO-UNDO.

/* 1. Identify the number of Entries in a Treview */
iNumberOfNodes = chCtrlFrame:Treeview:nodes:COUNT.

/* 2. Loop for each Entry in a treeview. */
DO iLoop = 1 TO iNumberOfNodes:

/* 3. To identify if that item's checkbox is selected. */
IF chCtrlFrame:Treeview:nodes:Item(iLoop):CHECKED = TRUE
THEN ...
ELSE ...
END.