Get window from WeifenLuo WinFormsUI Docking

Oct 28, 2010 at 8:11 AM
Edited Nov 2, 2010 at 7:49 AM

I'm a new member of white! Today i have a problem with white while getting a window form is contained by WeifenLuo WinFormsUI Docking control!

Are there anyone can show me how to get my window? 

Oct 28, 2010 at 1:17 PM
Edited Oct 28, 2010 at 1:17 PM

Hi

can you please show what UISpy or UIAVerify shows for these control and the containing elements?

 

What way have you tried?

Throndorin

Oct 28, 2010 at 5:32 PM
Edited Oct 28, 2010 at 5:36 PM

I have used function GetElement to get automation element but i dont know how to cast it to window type. This is my code:

 AutomationElement ownerWindow =  main.GetElement(SearchCriteria.ByText("MyTitle"));



And this is my UISpy properties of the container:

AutomationElement
  General Accessibility
    AccessKey: ""
    AcceleratorKey: ""
    IsKeyboardFocusable: "True"
    LabeledBy: "(null)"
    HelpText: ""

  State
    IsEnabled: "True"
    HasKeyboardFocus: "False"

  Identification
    ClassName: "WindowsForms10.MDICLIENT.app.0.25bb5ff_r12_ad1"
    ControlType: "ControlType.Pane"
    Culture: "(null)"
    AutomationId: "197374"
    LocalizedControlType: "pane"
    Name: ""
    ProcessId: "4312 (ECM)"
    RuntimeId: "42 197374"
    IsPassword: "False"
    IsControlElement: "True"
    IsContentElement: "True"

  Visibility
    BoundingRectangle: "(874, 377, 479, 490)"
    ClickablePoint: "(null)"
    IsOffscreen: "False"

ControlPatterns

And this is my UISpy properties of the window:

 AutomationElement
  General Accessibility
    AccessKey: ""
    AcceleratorKey: ""
    IsKeyboardFocusable: "True"
    LabeledBy: "(null)"
    HelpText: ""

  State
    IsEnabled: "True"
    HasKeyboardFocus: "False"

  Identification
    ClassName: "WindowsForms10.Window.8.app.0.25bb5ff_r12_ad1"
    ControlType: "ControlType.Window"
    Culture: "(null)"
    AutomationId: "frmExaminationSheetManagement"
    LocalizedControlType: "window"
    Name: "DS phiếu khám"
    ProcessId: "4312 (ECM)"
    RuntimeId: "42 722086"
    IsPassword: "False"
    IsControlElement: "True"
    IsContentElement: "True"

  Visibility
    BoundingRectangle: "(Infinity, Infinity, -Infinity, -Infinity)"
    ClickablePoint: "(null)"
    IsOffscreen: "True"

ControlPatterns
  Window
    CanMaximize: "True"
    CanMinimize: "False"
    IsModal: "False"
    WindowVisualState: "Normal"
    WindowInteractionState: "ReadyForUserInteraction"
    IsTopmost: "False"

 

This is what i want: 


Oct 29, 2010 at 8:04 AM

Hi

is the window ("DS phi.......") a real window or embedded into the other window?

 

Window elements will be get from Application object in all cases I know

 

can yoy please try

 

List<Window> myWindows  = app.GetWindows();

 

casting from AutomationElement to a White element is not possible in a normal way. UIItems can be generated by using constructor (UIItem item = new UIItem(myAutomationElement, window.ActionListener)) but Window does not have a constructor.

 

Throndorin

 

Nov 2, 2010 at 7:35 AM
Edited Nov 2, 2010 at 7:38 AM

I have inherited from Window object and override the constructor to use. After that i new an instance of my Inherited Window object from an automation element and now it done!

Can anyone tell me is it right and are there any better ways?

Thanks for your attention

Nov 2, 2010 at 8:53 AM
Edited Nov 2, 2010 at 8:55 AM

Hi

I' have read something about a Factory class, maybe you should have a look into white code to be sure that your class don't miss something important.

 

have you also tried this : MDI Child

 

Throndorin

Nov 2, 2010 at 9:09 AM

Hi Mr. Throndorin!

I will look into white code to check Factory class. But my application does not have any MDI childs!

Thanks for your attention

Nov 2, 2010 at 9:19 AM
onlin85 wrote:

Hi Mr. Throndorin!

I will look into white code to check Factory class. But my application does not have any MDI childs!

Thanks for your attention

are you sure there is no mdi??

ClassName: "WindowsForms10.MDICLIENT.app.0.25bb5ff_r12_ad1"

Throndorin

Nov 2, 2010 at 9:42 AM

Ok I'm wrong! I will recheck now.