[comp.windows.x.motif] Way to get list of form's children?

behner@AUSTIN.LOCKHEED.COM (Ralph Behner) (04/25/91)

In Motif 1.0, I am creating a form and then creating children of the
form.  Is there a way to later find out what the form's children are,
besides keeping track of them as created?
                                 Thanx in advance for any help,
                                  Max B.

-- 
 Max Behner                        | "I used to be disgusted - now I 
 Inter: behner@austin.lockheed.com |  try to be amused!"
 UUCP:  ut-emx!lad-shrike!behner   |                    (Elvis lives)
 Phone: (512) 386-2556             |                                 

slh@gibdo.engr.washington.edu (04/26/91)

In article <550@shrike.AUSTIN.LOCKHEED.COM> behner@AUSTIN.LOCKHEED.COM (Ralph Behner) writes:
|In Motif 1.0, I am creating a form and then creating children of the
|form.  Is there a way to later find out what the form's children are,
|besides keeping track of them as created?
	something like:
	In R4 : XtGetChildren() & XtGetNumChildren()
	In R3 : children & num_children fields of the composite part

karlm@alpha.tih.no (Karl Martin Lund) (04/26/91)

In article <550@shrike.AUSTIN.LOCKHEED.COM>, behner@AUSTIN.LOCKHEED.COM (Ralph Behner) writes:
|> In Motif 1.0, I am creating a form and then creating children of the
|> form.  Is there a way to later find out what the form's children are,
|> besides keeping track of them as created?
|>                                  Thanx in advance for any help,
|>                                   Max B.
|> 
|> -- 
|>  Max Behner                        | "I used to be disgusted - now I 
|>  Inter: behner@austin.lockheed.com |  try to be amused!"
|>  UUCP:  ut-emx!lad-shrike!behner   |                    (Elvis lives)
|>  Phone: (512) 386-2556             |                                 



I'm sorry I can't help you; i've got the same problem myself. But i would like a way to get access to any widget's children.

My problem is that i have a bulletin board dialog that contains two edit fields, three pushbuttons and some lables. When the user presses the OK-button a callback function is called. Then I would like to have access to the text in the edit fields, but those widgets are defined in a different function. Do I have to define all widgets globally, or is there a simpler and cleaner way. I know about sending arguments to the callback routine, but what about the second (and third and.... widget).

Help on this matter would be highly apprechiated (where is my diksjonary??? :-)


KMLUND. (This would not be a problem on an Amiga...)
(Perhaps it's no problem here either??)

dm@gene.com (David Mischel) (04/26/91)

		something like:
		In R4 : XtGetChildren() & XtGetNumChildren()
	
i can't find these functions in my R4 source.  what file(s) are they in?
i'm at patch level 18.

< david

ik@snoopy.ctt.bellcore.com (Ik Su Yoo) (04/27/91)

In article <9104261609.AA21960@genie.gene.com>, dm@gene.com (David
Mischel) writes:
> 
> 		something like:
> 		In R4 : XtGetChildren() & XtGetNumChildren()
> 	
> i can't find these functions in my R4 source.  what file(s) are they in?
> i'm at patch level 18.
> 

I can't either. But try:

    WidgetList ch;
    Cardinal ch_count;

    XtVaGetValues(form, XmNchildren, &ch, XmNchildCount, &ch_count, NULL);

Note that `ch' is read-only.

Ik Su Yoo
RRC 1H-229, (908) 699-5764
ik@ctt.bellcore.com

ik@snoopy.ctt.bellcore.com (Ik Su Yoo) (04/28/91)

>     WidgetList ch;
>     Cardinal ch_count;
> 
>     XtVaGetValues(form, XmNchildren, &ch, XmNchildCount, &ch_count, NULL);
> 
> Note that `ch' is read-only.

Oops, the resources should have been XmNchildren and XmNnumChildren.
Also, both `ch' and `ch_count' are read-only. Sorry for the confusion.
(BTW, these are documented under Composite(3X).)

Ik Su Yoo
RRC 1H-229, (908) 699-5764
ik@ctt.bellcore.com

bturner@hpcvlx.cv.hp.com (Bill Turner) (05/04/91)

>    WidgetList ch;
>    Cardinal ch_count;
>
>    XtVaGetValues(form, XmNchildren, &ch, XmNchildCount, &ch_count, NULL);
>
>Note that `ch' is read-only.

Also be forwarned that some of the children of manager widgets are not
"real" objects.  If you are going to be doing things to the children
returned, check XtIsObject(ch[n]) before doing anything to it.  If it
isn't an object, then don't use it.

--Bill Turner (bturner@hp-pcd.cv.hp.com)
HP Interface Technology Operation