Questions tagged [children]

Children is the set of all nodes within a hierarchical data structure which have a node above them.

1638 questions
17
votes
4 answers

What is the correct typescript type for react children?

I'm trying to properly type the props for a component that maps children: type Props = { children: any } const MyComponent: FunctionComponent = () => (React.Children.map(children, someMapingFunction); I've been using JSX.Element but…
linuxdan
  • 4,476
  • 4
  • 30
  • 41
17
votes
1 answer

JS .children Returns an Object, Want an Array (ES6)

According its w3schools page (everyone's favorite resource, I know), the .children property returns A live HTMLCollection object, representing a collection of element nodes This object can be looped over as if it were an array like so: var…
dougmacklin
  • 2,560
  • 10
  • 42
  • 69
17
votes
2 answers

React component with two sets of children

I'm creating a component that needs to take in two sets of children and to be placed in two different parts of a component. let CreditCardForm = ({icons, fields}) => (
ThomasReggi
  • 55,053
  • 85
  • 237
  • 424
16
votes
2 answers

How to get all child components of QWidget in pyside/pyqt/qt?

I am developing a desktop application using pyside(qt), I want to access(iterate) all line edit components of QWidget. In qt I found two methods findChild and findChildren but there is no proper example found and My code shows error, 'form' object…
anils
  • 1,782
  • 6
  • 19
  • 29
15
votes
3 answers

C# WPF add control to main window at run time

My goal is to attach a new image control while the application is running. img = new System.Windows.Controls.Image(); img.Margin = new Thickness(200, 10, 0, 0); img.Width = 32; img.Height = 32; img.Source = etc; I've tried this.AddChild(img);//…
Drake
  • 3,851
  • 8
  • 39
  • 48
15
votes
1 answer

Which HTML elements can't contain child nodes?

I've been looking for an exhaustive list, but can't find one anywhere. To avoid having to trawl through the specs, does anyone know what they are (and I suppose a complementary list of elements that can contain children would be useful too). And how…
wheresrhys
  • 22,558
  • 19
  • 94
  • 162
14
votes
1 answer

Removing all grid's children in WPF

I'm trying to remove all children (and sub-children) of a Grid in WPF (I'm really new to the whole WPF business). Is there a good way of doing it programmatically? I need to do this so that I could leave an empty canvas (Grid) at one point and draw…
Phonon
  • 12,549
  • 13
  • 64
  • 114
14
votes
2 answers

Panel.Children vs Panel.InternalChildren -- What's the difference?

According to MSDN - Panel.InternalChildren Property: Classes that are derived from Panel should use this property, instead of the Children property, for internal overrides such as MeasureCore and ArrangeCore. So, this is really a 2 part…
myermian
  • 31,823
  • 24
  • 123
  • 215
14
votes
5 answers

Disable home button in android toddler app?

I've developed and app that is a slide show of pictures which each play a sound when you tap them. It's like a picture book for ages 2-4. The problem is, since android won't let you capture a home button press and essentially disable it, when…
cmerrell
  • 503
  • 3
  • 7
  • 16
14
votes
1 answer

Javascript get all direct children

I need to get all the direct children of an element. As it is here:
I need the two DIVs with class "2" using the one with class "1". Plain…
Krupp
  • 351
  • 1
  • 5
  • 18
13
votes
7 answers

Prevent duplicate MDI children forms

Is there a way to prevent the opening of a certain form within an MDI container if that said form is already opened?
user
  • 16,429
  • 28
  • 80
  • 97
12
votes
3 answers

React.js - this.props.children an object when spreading the result of a .map from the parent

I am having some strange behaviour where this.props.children is converting to an object when I spread the result of a .map() from the parent. example: const items = [ { id: 1, name: "Name1" }, { id: 2, name: "Name2" } ].map((item) => { return…
Celestriel
  • 377
  • 1
  • 5
  • 12
12
votes
7 answers

Kill bash script foreground children when a signal comes

I am wrapping a fastcgi app in a bash script like this: #!/bin/bash # stuff ./fastcgi_bin # stuff As bash only executes traps for signals when the foreground script ends I can't just kill -TERM scriptpid because the fastcgi app will be kept…
Arkaitz Jimenez
  • 22,500
  • 11
  • 75
  • 105
12
votes
1 answer

Python multiprocessing and independence of children processes

From the python terminal, I run some command like the following, to spawn a long-running child process: from multiprocessing.process import Process Process(target=LONG_RUNNING_FUNCTION).start() This command returns, and I can do other things in the…
Zags
  • 37,389
  • 14
  • 105
  • 140
12
votes
4 answers

Find parent and first child of it's parent

I am trying to find the parent of an element and it's parent first child, the code is like this: