Sequence reading and passing parammeters to tree list


Andreschrosa

Recommended Posts

Is there any problem in the sequence bellow?

private groupaux
private equipaux
private i
private j
private aux
global grouplist
global projecto = new(project)

for(i=0, i<2, i++)
   groupaux = new(group)
   group.fill(ip,ip)
   aux = page.ConfRede.Component.TreeEquip.InsertItem(ip, 0, 0,i)
   grouplist.append(aux)
   for(j=1, j<6, j++)
	  private fun = function17(ip,i)
	  //verify is fun is empty and retry
	  if(isempty(fun))
		  for (private.y=1, y<RETRY,y++)
			   fun = Funcao17(j,i)
			   if(!isempty(fun))
				   y = RETRY
			   endif
		  endfor 
	  endif
	  if(!isempty(fun))
		 equipaux = new(equipment)
		 page.ConfRede.Component.TreeEquip.InsertItem(equipaux.model, grouplist[numrows(grouplist)-1], 0, equipaux.serialnum)
		 page.ConfRede.Component.TreeEquip.Expand(grouplist[numrows(grouplist)-1])
	  endif
   endfor
projecto.add_group(groupaux)			
endfor

The problem is, it runs right and gets it displayed in the tree list alright, but the double click data on the tree list itens is empty on the second group and on (after "i" is incremented the first time). Probably something simple I cant spot is wrong.

Link to comment
Share on other sites

Is it the data in the parent group or the individual items? If the items, I don't see where you are setting equipaux.serialnum. Since you create equipaux in the line before, I can only assume that this value is 0 or not defined. Its certainly not changing as j increments.

Also, you don't really need to use the itemdata for the groups. You can just use the item itself and use the search() function to search for it in projecto (or, perhaps you'd have to manually search, depends how your classes are setup).

There is one error that I see:

group.fill(ip,ip)

"group" is a class not an object and so you can't call a member function on it. I think you want groupaux. As it happens in DAQFactory, the function is called inside the class, but since there is nothing accessible to work against, it doesn't really do anything (but also doesn't generate an error).

I personally (and most Windows MFC programmers I'd imagine since MFC does this) put a C in front of all classes. So CGroup instead of just Group. That way I don't accidentally do what you did since I know that instantiated objects wouldn't have that C in front.

Link to comment
Share on other sites

I'm getting an error now, with nothing running, there is no channels, the logging set is empty and stoped...

in command/alert window I get this constantly:

11/28/08 08:36:40.590

Socket error: 10060

I checked all connections used in my code, and none is sending anything.

Any thoughts on what may cause that?

Link to comment
Share on other sites

I figured my network addapter has problems, will replace it.

The above sequence works now.

Now when the user clicks on a tree list equipment node, a popup showing the equipment's reading parameters will be show in a series of checkboxes. I'm having some trouble implementing this.

The popup consists of all the readings the equipment does, each with variables named in this fashion in the checkbox:

evaluate("Vmcheck_"+curnet)

curnet is passed when the user clicks on the tree list item.

Those variables are declared when the popup opens like this:

execute("global Vmcheck_"+DoubletoStr(curnet)+"= 0")

The problem is the checkboxes are not checkable, not sure if I'm using execute() right.

Link to comment
Share on other sites

Do you have the evaluate() in the checkbox? If so you can't do this. Only channel or variable names can be there, which is why its not labelled Expression. Why you need to do is programmatically change the checkbox SetChannel variable like such:

component.mycheck.strSetChannel = "Vmcheck_" + curnet

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.