QControl Enthusiasts

取消
显示结果 
搜索替代 
您的意思是: 

Fire an event based on indicator value change

已解决!
转到解答

Hi,

I trying to make a QControl similar to the tutorial QControl with the string control but for a Numeric indicator.
The idea is, after measured data and extracted some informations, I have to test these informations with logicals tests like:
- Greater than ?
- Lower than ?
- In range ?
- Etc.

It could be useful for me to have an numeric QControl as an indicator which when his value change, have is background color change. (Green/Red for exemple).
We just having to wrap the test logical in the event handler.

But how detect a indicator value change without use the property node "value signalisation" ?

 

Loïc.W

0 项奖励
1 条消息(共 14 条)
8,377 次查看
解答
接受人 Loïc.W

Unfortunately you can't:

 

https://knowledge.ni.com/KnowledgeArticleDetails?id=kA00Z0000019N6xSAE&l=en-US

 

What you CAN do is to create a QControl accessor method to write to the indicator. Inside that method, write the user's value to the Value property and do all of your logic on background colors there as well.

 

Basically, instead of writing a value to the indicator's terminal you write it to a method on your QControl's class.

0 项奖励
2 条消息(共 14 条)
8,364 次查看

Thx,

 

That's what I though...

I would like minimize the work for other developer when using it but I though that's fine if it just use a method to writte the data.

 

Loic.W

0 项奖励
3 条消息(共 14 条)
8,359 次查看

A somewhat janky way to do it could be to poll the value of the indicator every 100ms or so, updating the background if there's a value change.

0 项奖励
4 条消息(共 14 条)
8,351 次查看
Switch between acount again... --' Hum... that's doesn't seems to be a good idea ^^ I'm embarassed because if I have to create a lot of indicators, I'll have to use tables of QControl or call many constructor/destructor/methods. That's look a bit boring for an end user =/ May be for that case, an XControl is more appropriate ? Loic.W
0 项奖励
5 条消息(共 14 条)
8,347 次查看

Sounds right, but I've never made an XControl so I'm not actually sure.

0 项奖励
6 条消息(共 14 条)
8,343 次查看

If you have many string indicators you could build the references into an array. Then in a loop call the constructor and destructor. Then pass the array of QControl wires around. 

Or maybe better yet, put them in a Map (or Variant Lookup Table) so you can retrieve the right one easily later.

Quentin "Q" Alldredge

Chief LabVIEW Architect, Testeract | Owner, Q Software Innovations, LLC (QSI)
Director, GCentral | Admin, LabVIEW Wiki | Creator, The QControl Toolkit
Certified LabVIEW Architect | LabVIEW Champion | NI Alliance Partner



0 项奖励
7 条消息(共 14 条)
8,340 次查看

An example in attachment.

QControl=>XControl PassFailNumeric =>Tester

 

Business logic in facade.vi

 

Loïc.W

0 项奖励
8 条消息(共 14 条)
8,339 次查看

Hi Q,

 


If you have many string indicators you could build the references into an array. Then in a loop call the constructor and destructor. Then pass the array of QControl wires around. 


I was thinking about that when I talked about table ^^

 



Or maybe better yet, put them in a Map (or Variant Lookup Table) so you can retrieve the right one easily later.



Already saw but never used before, need to try that someday !

 

For now, I'll probably use QControl and area with two instances :

- Single

- Multi

 

If I have time, I'll try using a Map ^^

 

Loïc.W

0 项奖励
9 条消息(共 14 条)
8,324 次查看

Here is an example of using an array of QControls.  However, I did use Value (Signaling) to cause the event to occur. 

 

An alternative is to override the Value property with your own VI that causes the color formatting.  I think value signaling is the right way to go here.

 

Array of QControls.png

Quentin "Q" Alldredge

Chief LabVIEW Architect, Testeract | Owner, Q Software Innovations, LLC (QSI)
Director, GCentral | Admin, LabVIEW Wiki | Creator, The QControl Toolkit
Certified LabVIEW Architect | LabVIEW Champion | NI Alliance Partner



0 项奖励
10 条消息(共 14 条)
8,305 次查看