白色 - 文件打开对话框
这是我的问题。我有一个应用程序,它打开一个文件打开对话框,我尝试在“文件名:”组合框部分中输入文件路径和文件名。
应用程序会加载一个您登录的表单。这将打开另一个表单,其中有许多按钮。选择这些按钮之一会打开另一个窗体。在这种形式中,有一个用于选择文件的按钮。在此阶段打开了 3 个表格。这将打开标准文件打开对话框。我似乎无法处理此文件打开对话框。
这是我正在使用的代码。
Window LoginForm = application.GetWindow("LoginForm");
LoginForm.Get<Button>("btnSelectFiles").Click(); // This is from the 3rd form that is opened
由于某种原因,我可以使用 LoginForm 变量访问其他表单中的所有按钮。 我已经尝试过以下方法。
Window FileOpenDialog = application.GetWindow("Open", InitializeOption.NoCache);
这是行不通的。
我也尝试过以下操作,但这返回 null。我认为我可以使用 LoginForm 变量来访问它。
Win32ComboBox comboBox = LoginForm.Get<Win32ComboBox>("Filename");
有什么想法吗?谢谢
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
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
打开文件对话框是一个模式窗口。您将需要使用
LoginForm.ModalWindows()
函数。来自 白色项目 wiki:The open file dialog is a modal window. You will need to use the
LoginForm.ModalWindows()
function. From white project wiki:另一个解决方案是
我一直使用它,因为当显示时(并且考虑到它是模态的),
OpenFileDialog
是您在应用程序中打开的最后一个窗口;我想不出更好的单行解决方案来解决这个问题。Another solution is just
I use that all the time, since when shown (and given that it's modal), the
OpenFileDialog
is the last window you opened in your application; I can't think of a better one-liner solution for this problem.