Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

White - File Open Dialog Box

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

like image 427
Shane Avatar asked Aug 17 '10 11:08

Shane


1 Answers

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
like image 128
Tom E Avatar answered Oct 20 '22 17:10

Tom E