在屏幕上更改属性时触发autoexec查询 [英] fire autoexec query on screen property change

查看:67
本文介绍了在屏幕上更改属性时触发autoexec查询的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

由于在查询的"autoexec"处于关闭状态时网格中的一个错误会弄乱分页,因此我试图为我的搜索表单创建一个启用了autoexec的自定义过滤器.

Because of a bug in the grid that messes up paging when 'autoexec' is turned off for the query I am trying to create a custom filter with autoexec on for my search form.

有关错误说明,请参见此处:

See here for bug description:

http://social.msdn.microsoft.com/Forums/zh-CN/lightswitch/thread/2a413a8c-0a60-4ce7-85ac-e8b2b108b60e

http://social.msdn.microsoft.com/Forums/en-US/lightswitch/thread/2a413a8c-0a60-4ce7-85ac-e8b2b108b60e

基本上,我在表单顶部有一系列字段.对于下拉列表,当我更改它们时,下面的数据网格会自动过滤,这很好.但是,我有两个字段是属性.这些是文本框.有了这些,搜索是 只有在他们失去焦点时才被解雇.这意味着用户必须在框中键入内容,然后单击其他位置才能使搜索生效.

Basically, I have a series of fields at the top of the form. For the drop downs when I change them the data grid below is automatically filtered which is fine. However, I have two fields that are properties. These are text boxes. With these the search is only fired when they lose focus. Which means that the user has to type in the box and then click somewhere else to make the search work.

我可以有一个搜索按钮,但随后会有一些字段自动过滤数据,而有些则没有.不太好.

I could have a search button but then I'd have some fields that auto-filtered the data and some that didn't. Not very nice.

任何人都可以提供解决方案吗?我已经尝试过该属性的_changed事件和_validate事件,但是它们仅在失去焦点时才被触发.

Can anyone provide a solution?  I have tried the _changed event for the property and the _validate event but they are only fired when focus is lost.

如何获取控件的文本更改事件并使用它触发过滤?

How can I get to the text changed event for the control and use this to fire the filtering?

还是有另一种方法?

谢谢

Gus

顺便说一句,我正在使用VS 2012 RTM.

BTW, I am using VS 2012 RTM.

推荐答案

您要做的就是拥有一个不可见的布尔屏幕变量,默认情况下您将其设置为假".

All you need to do is to have a non-visible boolean screen variable, which you set to false by default.

创建/编辑接受布尔屏幕参数值的参数化查询.

Create/edit a parametrised query that accepts your boolean screen parameter value.

将查询的boolean参数绑定到screen变量(如果您不知道要执行此操作,请询问).

Bind the query's boolean parameter to the screen variable (if you don't know hopw to do that, just ask).

在查询的PreProcessQuery方法中,只需添加最终的(AndAlso boolParameter = true)"即可.没有记录匹配的子句.

In the query's PreProcessQuery method, just add a final "(AndAlso boolParameter = true)" clause that causes no records to match.

因此,最初不会显示任何记录(因为您最初传递的是false).选择完条件后,将屏幕变量的值设置为true.

So, initially, no records will be displayed (because you're initially passing false). Whenever you've finished selecting your criteria, set the screen variable's value to true.

很抱歉,如果这没有道理,那么大约是凌晨2:00,这里是墨尔本,&眼睛有点下垂. :-)

Sorry if this doesn't make sense, it's almmost 2:00AM here in Melbourne, & the eyes are drooping a bit. :-)


这篇关于在屏幕上更改属性时触发autoexec查询的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆