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

user event with no data

已解决!
转到解答

I am just starting out using custom user events.  It seems straightforward to create one, but it seems that the "Create User Event" block diagram object rather presumptiously assume that I must want to have some data associated with the event.  Sometimes one does, of course, but other times, it is sufficient to merely know that the event occured.

 

I think it's rather silly for me to create a bunch of dummy datatypes for events that don't require data.  Is there a way to do this?

 

Thanks.

0 项奖励
1 条消息(共 3 条)
3,561 次查看

Personally, I use an event to stop my applications usually. When I register this stop event, I just use a boolean even though I never read that value of boolean.

 

You don't have to create a bunch of dummy datatypes, you can just use a boolean (or whatever you want) for them all.

Cheers


--------,       Unofficial Forum Rules and Guidelines                                           ,--------

          '---   >The shortest distance between two nodes is a straight wire>   ---'


0 项奖励
2 条消息(共 3 条)
3,560 次查看
解答
接受人 rothloup

You never know when you might want to pass data, or maybe pass more data than you already are.  So in my designs I usually have an empty variant as the default data, but have this variant be a type def.  That way in the future if I have some settings I want I can update the type def (that is a variant) with the real data I care about.  Or even pass data in the variant as variant attributes.  Maybe I want to tell my exit command to have a timeout on killing some other tasks, or maybe I want to tell my exit to do a taskkill, or who knows.  And if that variant attributes aren't there then just exit like normal.  My point is in the future I may want to send some kind of data along with the command to do stuff.  

 

There have been times in the past when I throught "I'm never going to need to send any extra data".  Like one time I sent a command back to a caller VI to close a floating window, and insert it into a subpanel.  Then I realized I might want to send a command to pull the VI out of the subpanel and make it floating so I added a boolean.  True means pull it out, False means put it in.  Then I realized I may want to command the window a position and size to pull it out to.  Eventually I made it into a type def, but in this case I should have done this from the start.

3 条消息(共 3 条)
3,549 次查看