|
|
Rank: Newbie Groups: Member
Joined: 7/13/2010 Posts: 3
|
Hello I'm new in using ProcessBook and my manager asked me in ProcessBook if its possible to click on a multistate symbol (the ones giving) to make it stop blinking untill update to state happed. any thing for control the symbols from library will be very useful. now it work properly but not sure how to control it! Thanks in Advance 
|
|
|
|
|
OSIsoft vCampus is a subscription-based, online offering that consists of providing everything people need to develop applications on the PI System. We invite you to take a "tour" of the OSIsoft Virtual Campus - also feel free to consult the FAQ or contact OSIsoft vCampus for more details.
|
|
|
Rank: Administration
 Groups: Administration
Joined: 6/20/2008 Posts: 617 Location: Cheshire, United Kingdom.
|
Hello and welcome From what you describe you need to still multistate a symbol with blinking set but then you need to manipulate the blink property of the multistate via VBA whenever you click on your symbol. In fact, I did something similar for another forum member in this post: http://www.rjksolutionsltd.co.uk/forum/yaf_postst173_Sound-with-multistate.aspxHere is the code snippet: Code: Private Sub AlarmValue_Click(ByVal lvarX As Long, ByVal lvarY As Long) Call ToggleBlink(Symbols("AlarmValue"), False) End Sub
Private Sub AlarmValue_DataUpdate() Call ToggleBlink(Symbols("AlarmValue"), True) End Sub
Private Sub ToggleBlink(ByVal sym As Symbol, ByVal bBlink As Boolean)
If sym.IsMultiState Then Dim MState As MultiState, State As MSState, iState As Integer Set MState = sym.GetMultiState For iState = 1 To MState.StateCount Set State = MState.GetState(iState) State.blink = bBlink Set State = Nothing Next iState Call sym.SetMultiState(MState) Set MState = Nothing End If
End Sub
Should be useful for you too! Cheers. Principal Consultant Real-Time Data Management @ Wipro Technologies
|
|
|
Rank: Newbie Groups: Member
Joined: 7/13/2010 Posts: 3
|
Thanks Aloot that was very usefull,, i've got one more question. is it possible to make a copy of symbol data so instead of making manualy every thing blinking or unblinking . make it like it save the multistate and put it back. i'm trying but i think i did not manage to make a right copy of the multistate varible because every time i change the real one then ask it to return it to the original the orginal been changed :s so i only manage to make a pointer to the realtime one , Thanks Again
|
|
|
Rank: Newbie Groups: Member
Joined: 8/5/2010 Posts: 6
|
I have tried the code given by Rhys. When the value changed as what I have Multistated, my symbol blinked. Then when I clicked the symbol, the blinking stopped. However, after the blinking stopped and when the value changed back to the original state, the Multistate of the symbol failed to update its color and state. The symbol simply got stuck at the previous state. How should I code it so that the symbol's color can stay updated with the current state?
Thank you.
|
|
|
Rank: Administration
 Groups: Administration
Joined: 6/20/2008 Posts: 617 Location: Cheshire, United Kingdom.
|
When you say it failed to update the colour & blinking, did you change the change from what was posted? If so, could you post your code so I can see? Principal Consultant Real-Time Data Management @ Wipro Technologies
|
|
|
Rank: Newbie Groups: Member
Joined: 8/5/2010 Posts: 6
|
I have set the Multistate as follow: Quote:gtg10 >= 3500 ;Rectangle12 turns to green color gtg10 < 3500 ;Rectangle12 turns to red color
After I used the code provided by Rhys, the observations were: 1. Initially, gtg10 >= 3500, Rectangle12 is in green color, no blinking 2. When the gtg10 < 3500, Rectangle12 turns to red color and blinking (correct) 3. I click on Rectangle12, the blinking stops and color remains red (correct) 4. When the gtg10 >= 3500, Rectangle12 did not turn to green color and did not blink (I wanted it to turn green and blink) The code I used is as below, hopefully someone can tell me what's wrong with my code. Thank you very much! Code: Private Sub Rectangle12_StateChanged(bCancelDefault As Boolean) Call ToggleBlink(Symbols("Rectangle12"), True) End Sub Private Sub Rectangle12_Click(ByVal lvarX As Long, ByVal lvarY As Long) Call ToggleBlink(Symbols("Rectangle12"), False) End Sub
Private Sub ToggleBlink(ByVal sym As Symbol, ByVal bBlink As Boolean)
If sym.IsMultiState Then Dim MState As MultiState, State As MSState, iState As Integer Set MState = sym.GetMultiState For iState = 1 To MState.StateCount Set State = MState.GetState(iState) State.Blink = bBlink Set State = Nothing Next iState Call sym.SetMultiState(MState) Set MState = Nothing End If
End Sub
|
|
|
Rank: Administration
 Groups: Administration
Joined: 6/20/2008 Posts: 617 Location: Cheshire, United Kingdom.
|
OK so it seems that there is an issue here, it isn't picking up the second or third or... nth change in state. Looks like you need to call the revert method of a Display. New code is below. Code: Private Sub Rectangle12_StateChanged(bCancelDefault As Boolean) Call ToggleBlink(Symbols("Rectangle12"), True) End Sub Private Sub Rectangle12_Click(ByVal lvarX As Long, ByVal lvarY As Long) Call ToggleBlink(Symbols("Rectangle12"), False) End Sub
Private Sub ToggleBlink(ByVal sym As Symbol, ByVal bBlink As Boolean)
If sym.IsMultiState Then Dim MState As MultiState, State As MSState, iState As Integer Set MState = sym.GetMultiState For iState = 1 To MState.StateCount Set State = MState.GetState(iState) State.Blink = bBlink Set State = Nothing Next iState Call sym.SetMultiState(MState) Set MState = Nothing ThisDisplay.Revert End If
End Sub
I will try and look for a better reason behind this as I would prefer a cleaner approach than using "Revert". Principal Consultant Real-Time Data Management @ Wipro Technologies
|
|
|
|
Guest
|