Sign in to follow this  
Followers 0
Novice

Selectable "Drop down" menu in Citect scada 7.20

3 posts in this topic

Hi Am am working with Citect scada hmi 7.20, have made a few projects, not skilled in cicode or that advanced but learning! What I am trying to do is a drop down menu with selectable values, for example if I would to press on a decimal number in running mode, I would like drop down menu to appear with selectable numbers 1 to 10 and depending on which I select, I want that value to be written to the tag I am using or if I press a button, I would like a list to appear with a number of different selections that I have made, either they will activate a bit or write a value to an word, I have tried to find out how to do this by reading the manual but I am getting stuck when reading about how to do a form and write to a string and that is not entirely what I want to do here. Would appreciate any help or pointers, Edit: I have tryed this but cant get it to work; FormNew("Recipe",30,5,0); FormInput(2,3,"Recipe",test2,20); FormRead(0); From what I can se, I need to use an "Cicode variabel" for "test2", how do i make an Cicode variabel? Edited by Novice

Share this post


Link to post
Share on other sites
I have tried using the Form method of creating popups in the past but find it awkward to use. Maybe its just me but I find remembering the co-ordinates to place the inputs a pain. Its much easier to use SuperGenie instead. This way, you can create your pop-up graphically as you would with any page. Suppose I wanted a popup to control a pump. Heres an example how I'd do it... The popup has 3 buttons. A 'ON', 'OFF' and "CLOSE" button. It also has a numerical number showing the speed setpoint for the speed inverter. 1) I don't know what PLC or Device you are using so we will assume you have already created a device from the Citect Project Editor/Communications/Express Wizard. 2) In the Variable Tags, create: dPumpOnOff (Digital) iPumpSpeed (INT) 3) From your project screen, the icon input that triggers the popup, you would call a cicode function. example: fnPumpCtrl() 4) Create a cicode function using the cicode editor. The AssVarTags cicode function allows up to 8 tags with a Super Genie. The function below uses 2. FUNCTION fnPumpCtrl() INT XPos = 100; ! This is the X Co-ordinates of the top left corner of your popup being shown. INT YPos = 100; ! This is the Y Co-ordinates of the top left corner of your popup being shown. STRING sPumpOnOffTag = "dPumpOnOff"; ! This holds the name of the Variable Tag "dPumpOnOff" STRING sPumpSpeed = "iPumpSpeed"; ! This holds the name of the Variable Tag "iPumpSpeed" AssVarTags(-2, 0, sPumpOnOffTag, sPumpSpeed); WinNewAt("!PumpPopup", XPos, YPos, 1+2+8+128+256); END When this function is called, it will call a screen to appear on top of the screen that called it. 5) Create a new screen page and save it with the name !PumpPopup From the 'Citect Graphics Builder/File/Properties' change the screens View Area Width & Height to suit the size of the popup. Place a BUTTON onto the screen. From the 'Button Properties/Appearance/General/Text', type in the text ON From the Button Properties/Input/Touch/Up command', type in ?1?=1 Click the OK button below. Place a BUTTON onto the screen. From the 'Button Properties/Appearance/General/Text', type in the text OFF From the Button Properties/Input/Touch/Up command', type in ?1?=0 Click the OK button below. Place a BUTTON onto the screen. From the 'Button Properties/Appearance/General/Text', type in the text CLOSE From the Button Properties/Input/Touch/Up command', type in Winfree() Click the OK button below. Place a NUMERIC onto the screen. From the 'Text Properties/Appearance/Display Value/Numeric expression', type in ?2? From the 'Text Properties/Input/Touch/Up command', type in ?2?= FormNumPad("Speed Setpoint",?2?,0) Click the OK button below. Note that we use ?1? and ?2? as the substitutions for the tag names when we assigned them using the AssVarTags() from the fnPumpCtrl() function. 6) Save the screen Compile and Run the project. Using a Super Genie page allows you to create some fancy popups such as your own popup keyboards.

Share this post


Link to post
Share on other sites
Here is another little tip to allow the above example popup to appear at the position on the screen where it was pressed. 1) Remove the 2 lines from the fnPumpCtrl() function. INT XPos = 100; INT YPos = 100; 2) Create these 2 Tags either in the 'Variable Tags' or 'Local Variables' so it can be accessed anywhere within the SCADA environment. 3) Create a cicode function using the cicode editor.. FUNCTION MouseCoOrd() INT iXPos; INT iYPos; DspGetMouse(iXPos,iYPos); XPos = iXPos; YPos = iYPos; END 4) From the Citect Graphics Builder, Load the screen where the popup will appear. Select 'File/Properties/Events/While page shown command', type in MouseCoOrd() This will cause the MouseCoOrd() function to be called whenever the screen is displayed. The function call rate is now based on the screen update rate(default 250 msec). If you have popups throughout every screen in your project, you can just put this in the template used by all your screens. 5) Re-compile & Run the project. The popup will now appear on the screen from the position it was called from.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0