08-22-2006 02:14 PM
08-22-2006 02:33 PM
You can create a user event which takes a cluster of 2 value events. Register this event and fire it when ever needed. Inside of the event handle put your equality test. I have done something like this in the past, and user events are very useful. Conversly you can handle both control value changes events and compare the values inside here, there is no poling and this can be dynamically unregistered if needed.
Paul
08-28-2006 08:07 AM
Hey falk,
I couldn't quite understand where to go with your suggestion. Here is a pic of what I got, it isn't far. I can't figure out how, after I cluster two sliders together, to specify that the event fires when slider 1 equals slider 2.
08-28-2006 08:42 AM
Better yet, this is what I came up with... but is there any way to get away from the case statement and make the comparison (equal) an actual event?
Isn't there any way to create an event of a comparison?
Thanks
08-28-2006 08:48 AM
Attached is a simple user event structure that I was thinking about. Using this you can decouple the control from the comparison, it just works on valye comparisons. Since it uses the event structure there is no polling and is very CPU friendly. I have allowedfor the comparison to be linked to the "Value 1:value change event" and the compare button true event. I hope this is what you were looking at. Also since it is a user event which is dynamically registered you can register/unregister it at will durring execution making it a flexable event handler. It might be alittle buggy because I have spent about 3 minutes developing it (particularry when passing values into the event structure there might be a state issue from the data flow so local variables are a better choice)
Paul
08-28-2006 09:27 AM
Thanks for the reply falk,
Your method, though, isn't it just the same as the one I attached where the slider values are retrieved inside the event structure and compared there? Or is there something fundamental I'm missing...
Thanks again,
Jonathan
08-28-2006 09:42 AM
It might be I am working here with 7.0 so I cant open the code to check. What I did is common in windows event handeling where you make a common method which is chainde from multiple different sources. Like the OnPaint is a common place to call a render event function and can also be envoked from other places like a 30Hz timmer event.
Paul
08-28-2006 09:46 AM
08-28-2006 09:56 AM
So... you brought up something which I didn't think about that I know I will have to use. The '30Hz timmer event' comment.
How do I make such a regularly timmed event?
I will be using two CCD Cameras in my programming and it would be nice to setup such an event so that I can perform a frame grab at set intervals.
Thanks
Jonathan
I just tried making ref's to a timer but that didn't work
08-28-2006 11:27 AM
To fire the event at 30 hz, you can create a separate loop which runs at 30Hz (wait /time elapsed function) then fire the user event to handle the capture, just have a timed toop and no events. I disagree with the statement that there is no compelling reason to have a user event. While just lumping value1 change and value 2 change together you have much less control over when this event fires. By decoupling this comparison form the control you can fire it when more complex logic events happen. I do agree that the simplist answer is to just lump both events together and call it one time, but thsi was not the original question as I interpreted it.
Paul