When LinearLayout is selected are his child too? - android-linearlayout

When a LinearLayout state is changed to selected = "true", are his child's state changed to selected = "true" too ?
Thanks, for your answer.

No the child remains unselected. If you provide some code I will improve my answer...

Use for it's children:
in xml
anroid:duplicateParentState="true"
or in java
setDuplicateParentState(true);

Related

Flex: is it possible to access default `mx:Tree` icons?

I have a bit of a problem, in that I have a tree:
<mx:Tree iconField="#icon" />
That's been fine for a while, but now I want parts of the tree to have their default icons. Now, for reasons I haven't figured out yet, the icon member of the source XML is ignored for branch nodes, and the default is used But for leaf nodes, I must have a valid icon member, or I get an exception. icon="" doesn't work.
Taking a look under the hood, I ran:
trace('The default tree icon: ' + tree.itemToIcon(tree.selectedItem).toString());
which revealed the default to be:
class _TreeStyle__embed_css_Assets_swf_TreeNodeIcon_770392128
which is way too magic string. No thanks. I didn't even try assign that to icon.
Rather than do a screen cap, Gimp edit, and then make it into a custom icon, how do I simply reference the default icon that the platform provides?
Flex 3.5 SDK here.
I think you do over think & with that over complicate everything!
I have not worked with this a long time, but maybe this still could help you a little.From memory I had more complex once as well but have not looked at any of it quiet awhile! One Link of many I used with Tree setup
gallery icon="iconSymbol0AG"
gallery label=" AR - ARGENTINA" src="com/assets/images/countriesFlagsRoundLarge/ar.png"
gallery label=" Mauricio Photography" src="com/assets/images/PageOne/PhotographyBlogs/BlankArtists/AR/TheMauricioBlog.swf"
file label=" Web Site" icon="iconSymbolAR" src="com/assets/images/PageOne/PhotographyBlogs/WebSites/AR/TheCollazosBlog.swf"
gallery
Following Amy's suggestion, I tried:
public var m_icoDefaultLeaf:Class;
private static var m_oDummyTree:Tree;
private static var m_xmlDummy:XML;
...
m_oDummyTree = new Tree;
m_xmlDummy = <dummynode />;
m_oDummyTree.dataProvider = m_xmlDummy;
m_oDummyTree.addEventListener(FlexEvent.CREATION_COMPLETE,
function (evt:FlexEvent):void {
m_icoDefaultLeaf = m_oDummyTree.itemToIcon(m_xmlDummy);
removeChild(m_oDummyTree);
m_oDummyTree = null;
m_xmlDummy = null;
}
);
addChild(m_oDummyTree);
Then I just used icon="m_icoDefaultLeaf" in the XML for the leaves and amazingly, it worked!
Yes, it does have to be that complicated. I had to handle that event, and I had to add the tree as a child of something.
And another thing I tried, was to erase all that code and just use
public var m_icoDefaultLeaf:Class = null;
But that just made a blank icon, not a default.

Remove button Find and Clear in GridControl

like I can eliminate the botton (Find and Clean) of a GridControl, and alone to leave TextEdit.
regards
Alex
You can use the approach demonstrated in How to customize the Find Panel layout? example:
Create the GridControl/GridView descendant components
Override the GridView.CreateFindPanel method to provide your
own customized FindControl instance into the view.
Yes it is possible. you will need to access the FindControl and then access the layoutControl and its Control Items. Use the Code below in form_load etc:
// Get the Find Control on Grid : gcMain
FindControl _FindControl = gcMain.Controls.Find("FindControl", true)[0] as FindControl;
//Get the Layout Control
LayoutControl lc = (_FindControl.ClearButton.Parent as LayoutControl);
//Allow Control Hiding
lc.Root.AllowHide = true;
//Hide Find Button
(lc.Root.Items[2] as LayoutControlItem).ContentVisible = false;
//Hide Clear Button
(lc.Root.Items[3] as LayoutControlItem).ContentVisible = false;

How do I know if a tab is selected?

I am trying to get a report based on different information located in tabs. How do I know If a tab is selected? I looked for something like:
if(colorListTab.isSelected)
{
}
but no luck! Can you guys help me out with this?
You could use the ActiveTab property, for example(in ActiveTabChanged):
if(TabContainer1.ActiveTab.Equals(colorListTab)){
}
or you could use the ActiveTabIndex:
if(TabContainer1.ActiveTabIndex == 1){ //second tab
}
http://www.dotnetcurry.com/ShowArticle.aspx?ID=178
Try using ActiveTabChanged event
Also please have a look at this question AJAX ToolKit TabContainer: Can I capture the “Active Tab Panel Changing” event
The property you're looking for is "ActiveTab", a property of the actual TabContainer (not an individual tab)
if(colorListTabContainer.ActiveTab.TabIndex == 1)
{
//You only get here if the index of the active tab is 1
}

How can i give setfocus to the alert buttons?

I am using Flex3.0. in this i am craeting a custom component for an Alert.and for that alert i am applying styles. but when i opening the alert through the application i want to set focus on Alert button.means when i press enter button there are two buttons in alert YES and NO.i need to focus on YES button. any one help me if any reffer url also please provide me
Thanks,
Praveen
you need to set the defaultButtonFlag: (its the last parameter)
Alert.show('alert', 'alert', Alert.NO|Alert.YES, this, null, null, Alert.NO);
From the APIDocs:
show(text:String = "", title:String = "", flags:uint = 0x4, parent:Sprite = null, closeHandler:Function = null, iconClass:Class = null, defaultButtonFlag:uint = 0x4):Alert
[static] Static method that pops up the Alert control.
In a regular Alert.show call this means you can specify the last argument as Alert.YES to make it the default selection. With a custom component, you can call setFocus() on the particular element within your custom Alert component that you want to select (i.e.: in call setFocus() within the custom Alert component's creationComplete event).
So a sample implementation of a YES/NO Alert box would be (split code over two lines to avoid scroll bars):
Alert.show("sample text","sample title",
Alert.YES|Alert.NO,null,null,null,Alert.YES);
Hope this helps.

Flex ComboBox, default value and dataproviders

I have a Flex ComboBox that gets populated by a dataprovider all is well...
I would now like to add a default " -- select a item --" option at the 0 index, how can I do this and still use a dataprovider? I have not seen any examples of such, but I can't imagine this being hard...
If you don't need the default item to be selectable you can use the prompt property of ComboBox and set the selectedIndex to -1. That will show the string you set propmt to as the selected value until the user chooses another. It will not appear in the list of options, however.
I came across this problem today and wanted to share my solution.
I have a ComboBox that has an ArrayCollection containing Objects as it's dataprovider. When the application runs, it uses a RemoteObject to go out and get the ArrayCollection/Objects. In my event handler for that call I just have it append another object to the beginning of the ArrayCollection and select it:
var defaultOption:Object = {MyLabelField: "Select One"};
myDataProvider.addItemAt(defaultOption, 0);
myComboBox.selectedIndex = 0;
This is what my ComboBox looks like for reference:
<mx:ComboBox id="myComboBox" dataProvider="{myDataProvider}" labelField="MyLabelField" />
The way I've dealt with this in the past is to create a new collection to serve as the data provider for the combobox, and then I listen for changes to the original source (using an mx.BindingUtils.ChangeWatcher). When I get such a notification, I recreate my custom data provider.
I wish I knew a better way to approach this; I'll monitor this question just in case.
This can be used following code for selected default value of combobox
var index:String = "foo";
for(var objIndex:int = 0; objIndex < comboBox.dataProvider.length; objIndex++) {
if(comboBox.dataProvider[objIndex].label == index)
{
comboBox.selectedIndex = objIndex;
break;
}
}
<mx:ComboBox id="comboBox" dataProvider="{_pageIndexArray}" />

Resources