Find the first child that matches the specified class
PtWidget_t *PtFindChildClass( PtWidgetClassRef_t *class, PtWidget_t *widget );
This function finds the first child widget of the specified container, widget, that matches the specified class.
Some container widgets, including PtDivider,
PtMenuBar, PtMultiText, and
PtScrollArea redirect children to an alternate parent.
For all container widgets, it's best to call
PtValidParent() to
determine the "real" parent of the children.
For example, to find a PtButton in a
PtScrollArea:
child = PtFindChildClass( PtButton, PtValidParent( my_scrollarea, PtButton )); |
A pointer to a PtWidget_t structure, or NULL if an error occurs.
main() { PtArg_t argt; PtWidget_t *window, *pane, *button; // Create a window that contains a pane, which in turn // contains a button. window = PtAppInit (NULL, NULL, NULL, 0, NULL) PtSetArg( &argt, Pt_ARG_RESIZE_FLAGS, Pt_TRUE, Pt_RESIZE_XY_ALWAYS ); pane = PtCreateWidget( PtPane, NULL, 1, &argt ); PtSetArg( &argt, Pt_ARG_TEXT_STRING, "Sample", 0 ); PtCreateWidget( PtButton, NULL, 1, &argt ); // The following call finds the button because PtButton // is a subclass of PtLabel. button = PtFindChildClassMember( PtLabel, pane ); // The following call does not find the button because // PtButton is not equivalent to the PtLabel class. button = PtFindChildClass( PtLabel, pane ); // The following call finds the button because PtButton // is in the class PtButton. button = PtFindChildClass( PtButton, pane ); }
Photon
Safety: | |
---|---|
Interrupt handler | No |
Signal handler | No |
Thread | No |
PtFindChildClassMember(), PtValidParent(), PtWidgetBrotherBehind(), PtWidgetBrotherInFront(), PtWidgetChildBack(), PtWidgetFamily(), PtWidgetParent()