tags:

views:

14

answers:

1

Hi,

This is my problem. I have an application where it opens a file open dialog box and I'm trying to enter in the file path and file name into the "File name:" combo box section.

The application loads with a form where you log in. This opens another form where there are a number of buttons. Choosing one of these buttons opens another form. It is in this form that there is a button to select a file. At this stage there's 3 forms opened. This will open the standard file open dialog box. I can't seem to get a handle on this file open dialog box.

Here's the code I'm using.

Window LoginForm = application.GetWindow("LoginForm");
LoginForm.Get<Button>("btnSelectFiles").Click(); // This is from the 3rd form that is opened 

For some reason, I can access all buttons from the other forms using the LoginForm variable. I've tried the following.

Window FileOpenDialog = application.GetWindow("Open", InitializeOption.NoCache);

This doesn't work.

I've also tried the following but this returns null. I thought that I would be able to access this using the LoginForm variable.

Win32ComboBox comboBox = LoginForm.Get<Win32ComboBox>("Filename"); 

Any ideas? Thanks

A: 

The open file dialog is a modal window. You will need to use the LoginForm.ModalWindows() function. From white project wiki:

Window mainWindow = application.GetWindow("main");
List<Window> modalWindows = mainWindow.ModalWindows(); //list of all the modal windows belong to the window.
Window childWindow = mainWindow.ModalWindow("child"); //modal window with title "child"
childWindow.IsModal; //returns true
Tom E