jagdeepjain / sfapi

Automatically exported from code.google.com/p/sfapi
0 stars 0 forks source link

Button not getting detected in Flex #12

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
Hi,

I am newbie to Flex and trying to write small automation for my flex 
application.

My Flex application code snippet is

    <mx:Panel id="Panel1" 
        horizontalScrollPolicy="off" 
        verticalScrollPolicy="off">

        <mx:Form id="Form1">
            <mx:FormItem label="Username:">
                <mx:TextInput id="Username"/>
            </mx:FormItem>
            <mx:FormItem label="Password:">
                <mx:TextInput id="Password" displayAsPassword="true"/>
            </mx:FormItem>

        </mx:Form>

        <mx:ControlBar id="ControlBar1">
> 
            <mx:Button label="Login" id="Button1" labelPlacement="left" 
click="login()"/>
        </mx:ControlBar>
    </mx:Panel>

Now the problem is I can detect Username and Password in my C# automation 
but cannot detect Login Button. Also when I move button from ControlBar to 
Form, I can detect button.
So can anyone help me with why its not detecting button in ControlBar.

I am using doFlexClick (Control ) to access them. Is there any way by 
which I can detect ControlBar and then button ?

Thanks.

Original issue reported on code.google.com by Sachin.T...@gmail.com on 6 Jan 2010 at 10:48

GoogleCodeExporter commented 8 years ago
I am experiencing this bug too :-(

I guess it is because stuff in a ControlBar gets put into the rawChildren. I 
*do* see
some rawChildren code handling in AppTreeParser, but nevertheless, a component 
in a
ControlBar is not found.

Looking at the component hierarchy in FlexSpy locates the component under 
"Chrome".

Original comment by per.ole...@gmail.com on 12 Mar 2010 at 3:16

GoogleCodeExporter commented 8 years ago
Here is a screen shot of how flexspy shows the component hierarchy. It finds the
button down under a "Chrome" node in the tree.

Original comment by per.ole...@gmail.com on 12 Mar 2010 at 3:40

Attachments:

GoogleCodeExporter commented 8 years ago
You can fix that very easily. Just go to the line 278 in
src/sfapi/core/AppTreeParser.as, take out ! or !isChild(child, parent). 
The code looks like the following:
if(isNotContentPane(child) && isChild(child, parent))
or 
if(isNotContentPane(child)).

Original comment by yugan...@gmail.com on 27 Mar 2010 at 12:16

GoogleCodeExporter commented 8 years ago
Thanks to "yugan..." for the tip. It works. Do you now if the project owners are
active on this project anymore. Seems like a checkin and run operation :-) as in
nothing happing.

Would be nice with a fix for this and a release, instead of having to pull down
source and make your own version.

Original comment by per.ole...@gmail.com on 29 Mar 2010 at 10:20

GoogleCodeExporter commented 8 years ago
Here's a diff that shows the change that made it work for me:

Index: src/sfapi/core/AppTreeParser.as
===================================================================
--- src/sfapi/core/AppTreeParser.as (revision 4)
+++ src/sfapi/core/AppTreeParser.as (working copy)
@@ -275,7 +275,7 @@
                while(i < parent.rawChildren.numChildren)
                {
                    child = parent.rawChildren.getChildAt(i);
-                   if(isNotContentPane(child) && ! isChild(child, parent))
+                   if(isNotContentPane(child) && isChild(child, parent))
                    {
                        nextNode = new AppTreeNode(child, i, true);
                        return true;

Original comment by per.ole...@gmail.com on 29 Mar 2010 at 11:29

GoogleCodeExporter commented 8 years ago

Original comment by per.ole...@gmail.com on 31 Mar 2010 at 1:34

GoogleCodeExporter commented 8 years ago
Is this code fixed in any of the SWC files? Could you please point me to swc 
file having these code changes.
it will be really very helpful

Original comment by shinings...@gmail.com on 8 Feb 2012 at 5:14