Avatar

Please consider registering
guest

sp_LogInOut Log In sp_Registration Register

Register | Lost password?
Advanced Search

— Forum Scope —




— Match —





— Forum Options —





Minimum search word length is 3 characters - maximum search word length is 84 characters

sp_Feed Topic RSS sp_TopicIcon
Free Links from a TPSOPCConnector
June 25, 2012
14:14, EEST
Avatar
Rainer Versteeg
Member
Members
Forum Posts: 32
Member Since:
March 21, 2012
sp_UserOfflineSmall Offline

Hello !

I create a TPSOPCConnector component at runtime.
Then I fill the OPCConnector with OPC Items like OPCConnector.addItem((c as TPSFloat).Caption, (c as TPSFloat), vpValue);

How can I remove an Item at runtime ?

Br
Rainer

June 26, 2012
14:50, EEST
Avatar
Otso Palonen
Espoo, Finland
Member
Members
Forum Posts: 32
Member Since:
December 21, 2011
sp_UserOfflineSmall Offline

Hi Rainer,

use OPCConnector.Links.Delete() to remove them.

Best regards,
– Otso

June 26, 2012
16:26, EEST
Avatar
Rainer Versteeg
Member
Members
Forum Posts: 32
Member Since:
March 21, 2012
sp_UserOfflineSmall Offline

Hi Otso,

Thank you.

My OPCConnector.links.count shows me 5332.

Now I want to delete the links:

for i:=0 to count-1 do
OPCConnector.links.delete(i);

When i is 2766[5332/2] it throws an error “Listenindex error”.

Why ?

Br,

Rainer

June 26, 2012
17:58, EEST
Avatar
Pyry
Moderator
Moderators
Forum Posts: 1
Member Since:
December 21, 2011
sp_UserOfflineSmall Offline

Hi Rainer,

While it’s a list, the indexes are re-arranged after each insert and delete, so you’re loop goes over index after half of items are deleted.
You can clear the list e.g like this:

for i:=0 to count-1 do
OPCConnector.links.delete(0);

or like this

for i:=1 to count do
OPCConnector.links.delete(count-i);

Forum Timezone: Europe/Helsinki

Most Users Ever Online: 1919

Currently Online:
184 Guest(s)

Currently Browsing this Page:
1 Guest(s)

Top Posters:

Heikki Tahvanainen: 402

hbrackel: 144

rocket science: 88

pramanj: 86

Francesco Zambon: 83

Ibrahim: 78

Sabari: 62

kapsl: 57

gjevremovic: 49

Xavier: 43

Member Stats:

Guest Posters: 0

Members: 749

Moderators: 7

Admins: 1

Forum Stats:

Groups: 3

Forums: 15

Topics: 1529

Posts: 6471

Newest Members:

scvchad954, misty3446453365, KelsonzFu, Kelsonz, lienbelisario, erick34s63346, Kaitlyntvsl, lonaerskine7, KTP21ideft, Georgecotag

Moderators: Jouni Aro: 1026, Pyry: 1, Petri: 0, Bjarne Boström: 1032, Jimmy Ni: 26, Matti Siponen: 349, Lusetti: 0

Administrators: admin: 1