Proficy iFIX 5.8 VBA Object Code

aiki202

Member
Join Date
Aug 2007
Location
Pennsylvania
Posts
178
Regarding Proficy iFIX 5.8...is there a way to access the properties of an object that is located on Picture "A" from the VBA code on Picture "B"? In other words, can you set the .BackgroundColor property (for example) on Rectangle1 object located in Picture "A" from the VBA code in the Picture "B"?

In other VBA applications accessing any object is possible such as in MS Excel...any worksheet (let alone workbook) is accessible from VBA.
Ex: WorksheetName.Object.Property = setting

I cannot find this in the iFIX VBA Help. Any ideas?

Thanks
 
I set the caption property on a header pic from the footer, I would guess its similar. Can't test it this minute.

I create a var on the first pic and use that var to hold the color code.
Use animation to color the background using that var.

Use code in the second pic to write a different color code to the var you created in the first pic.

Let me know if that works.
 
Just to confirm...there is no way to access objects directly from a 'different' Picture's VBA code, correct?

Because I am new to iFIX I am not clear on what you mean by "create a variable on the first picture"? Do you mean a Dim a global variable in the VBA of the first Picture OR somehow add a variable to the front end Picture OR add a User Global variable?

Thanks
 
Try this

Each pic can hold variables, Its just another object in the tree. Look for the paperclip in yellow in the toolbox.

I can't say for sure if you can do it directly as I've never had need to do that. For me each pic would have it's own events to handle its own animations. But its easy enough to test. Only catch is that the pic MUST be open. Can't do anything with closed pic.
(You could open, change,save and close if you wanted I guess)
Put this into a button and try it.
Code:
Dim P as object
Dim C as long
   C = 0 '0 = Black, 255 = Red etc
Set P = System.FindObject("yourpicturenamehere")
   P.BackGroundColor = C
Set P = Nothing
 
Ok...I didn't realize that a Picture could have a Local variable...I do see that assignment now. You pointed me in the right direction...here is what I came up with:

Added a global variable to hold a value that can represent a property of an object (for example 0 = black text, 1 = gray text). On the target object (Text in this case) I assigned the global variable to the animation Foreground Color property setting the values and colors to match the previously mentioned variable values. Next, in the VBA script for the "other" Picture (the one that does not contain the Text object) I added code to modify the global variable's current value. I used a global variable so it does not matter what Picture is open or closed. Also the Text object that I am modifying is on a global footer Picture while the VBA code is within the main Picture.

Thanks for your help! (y)
 
Took your code example from above and tweaked it to fit my needs...this is exactly what I was looking for...much better solution than using global variables.

'Works
Dim P As Object
Dim C As Long
C = 255
Set P = System.FindObject("yourPictureName.yourTextObject")
P.ForegroundColor = C
Set P = Nothing

'Does not work
Dim P As Object
Dim C As Long
C = 255
Set P = System.FindObject("yourPictureName.yourTextObject.ForegroundColor")
P = C
Set P = Nothing

Thanks again.
 

Similar Topics

I have an HMI based on Proficy Ifix 5.5 which contains a header, footer, and main screen. the footer contains a panel of navigating buttons which...
Replies
0
Views
1,351
Hi. I have a Proficy iFIX V5.8 & V5.5 & V3.5. In the iFIX WorkSpace V5.5, V5.8 can open multiple instances of a single picture: OpenPicture &...
Replies
0
Views
3,112
I am trying to simply display a PLC string tag value (text) in a VBA control (msgbox or anything...just to get it working). The following code is...
Replies
2
Views
5,952
I have a Proficy iFIX 5.8 application running on a Win 7 Embedded OS with a touch screen. I am looking for a way to perform a controlled shutdown...
Replies
1
Views
2,810
Hi I want to press a button on the HMI screen and write to a bit within an Integer within a control logix PLC. The iFix version is 5.5 and using...
Replies
3
Views
2,389
Back
Top Bottom