EnumChildWindows doesn't return direct children - hierarchy

I am trying to create an application that dumps all processes and their children controls to a text file. I used EnumChildWindow but it visits all children including children's childdren. I can't create hierarchy using this method.
Is there another way of doing this?
Thanks

You should instead use FindWindowEx() and specify NULL for the hwndChildAfter parameter.
This will enumerate all direct descendant child windows.

Related

How to add an extra OR relation to a aot query linking a child parent and parent table

How to add an extra OR relation to a aot query linking a child parent (which is already linked to another parent table) with another parent table in the view's init method in ax 2012 Please help me with a code.(Note: my issue how to give an or relation in aot query or relation between two parent tables(SecurityRole and SecuritySubRole) from the same child table securityRoleTaskGrant to fetch all the duties of security roles and securitysubroles in a single column of views.) using x++ coding
Thanks in advance,
Hari
I think you can do it with expressions in the range of your query : https://msdn.microsoft.com/en-us/library/aa893981.aspx.
Regards.

Data model in child component

I would like to know what the best practice is for a communication between parent/child components. I have read this blogpost about communication and components states but haven't found the right answer for my problem.
Following components are considered.
My parent component is a List, which renders several Tasks (child component) from objects in the parent component.
So my questions are:
Is it best practice to pass the object to each Task component?
When a value has changed in the Task component, how does the parent component know about this? Because the parent should know about the infos of all children.
So is this a right pattern to use?
In my Parent Component I have this in the render function:
<Task key={index} taskdata={taskobj} />
My Task child component looks like this:
render() {
return (
<input type="text" name="wunsch" defaultValue={this.props.task.title}/>
);
}
So if the value of the input field will change, does taskobj in the parent component also change? In this example no. But what would be the right pattern here?
Basically when you want to pass information from parent to children you use props, when you want to pass information from child to parent you pass a function to a child as a prop and then call it when you need to update a parent.
You can read more in official docs
Also you can take a look Reflux.
A simple library for unidirectional dataflow architecture inspired by ReactJS Flux
In React, data flows one way
I wasn't really aware of this React concept.
So after reading this link in the ReactJS Doc I decided to the onChange/setState() way as ReactLink is already deprecated.
So when a change in the model happens in the child component I call a method in the parents component to update (setState) my data.

Sitecore 6.5 change user control dynamically

I have a collection of some items. Using * symbol I set user control (ascx) in presentation details for all of them. Now I have a problem because on of this items has to be display in another control. Is there some trick that allow me to change used control dynamically, for example checking url segment?
I'm guessing you're using wildcard item called * with some presentation details defined on it. And now you want to display different components for one you the urls?
If you want to have completely different presentation, you can add another item as a sibling of the * item and put new presentation detail there. This item will be matched before the wildcard item, if the url segment is equal to this item name.
If you want to change only one or few components, you can use personalization for this component and where the item name compares to ... rule.
Marek's answer is preferable, but for completeness I will provide another potential option.
It depends on how you are handling the wildcards. I don't think it will work if you are using the wildcard item module from the Marketplace and it might not play well with some of your existing code, but here goes...
You could place the required presentation details on the target items themselves. Then when you resolve the wildcard, you would need to change the context item to be selected target item. When the page loads, it will use the presentation of the newly set context item.
One way to achieve this would be to create a custom item resolver
class WildCardItemResolver : ItemResolver
{
public override Process(HttpRequestArgsargs args)
{
base.Process(args);
// if Context.Item is as wildcard
// look up the target item
Context.Item = targetItem
}
}

Tell if a WordPress page has "grandchildren"

I want a conditional that checks if a page has at least 2 levels of children; that is, if its children have children. I know you can get ancestors, and get a page's depth, but I can't find a way to see if a page is a grandparent (or great-grandparent, etc.).
How can I construct a conditional statement that returns true if a page has more than one level of children?
you can check if a post has a parent with $post->post_parent, if no parent returns 0.
if($post->post_parent == 0){
// your code
}
The problem here is that i think you can`t check easily if a page has more than one.
You will need to create a custom query to get all pages that have a parent, put that result in an array, then use array_count_values() function to check for duplicates, now you can know if a page has more than one children....
I think you can do it that way

Flex component access other component

I have 2 components for example (editor.mxml using mx:windows), when I click an edit button, I want to get the current value from the other component's datafield? (datagrid.mxml using mx:window)
I do know how to access the main MXML's datagrid by parentDocument or Application.application method, but stumped block if I want to access other way as mentioned above. Keep the code as simple as possible.
You could either do dependency injection, that is, give component A a reference to component B so that they can communicate directly (example of tighter coupling,) or have both components communicate through a common mediator using events (example of more loose coupling.)
Both of those options would be implemented wherever it is that you're creating those components (A and B in this example) and adding them to the display list.
This might be more complicated than it deserves, and it smacks of Pattern-Fever, but you could use a mediator class that listens for the CLICK event from the button and knows enough about the other component to query its property. It could even transmit that data using a custom event, which the button listens for.
While this involves three classes instead of two, it often turns out to be easier to have two components that focus on looking good and one that worries about coordination.
Cheers
Try this:
FlexGlobals.topLevelApplication
This points Your root. From the root You can grab every element You want.
You can also add an id to the custom component like this,
<custom:Editor id="myCustomComponent">
</Editor:AddressForm>
and
access your datagrid's value like this,
var data:ArrayCollection = myCustomComponent.DatagridID.dataProvider;

Resources