PDA

View Full Version : what is wrong with my little code ?


ButtonMaker
03-26-2009, 02:52 AM
i want to load every node in tree object 1 by 1 every 15 seconds,,, i only have nodes, no childs

on show :
data = 1
Page.StartTimer(15000)

on timer :
Count = Tree.GetChildCount("Tree1", "");
data = Tree.GetSelectedNode("Tree1");
Web.LoadURL("Web1", data)
data = data+1
if data == Count then
data = 1
else
data = data
end

Kick
03-26-2009, 07:50 AM
May be
Count = Tree.GetChildCount("Tree1", "0");

ButtonMaker
03-26-2009, 08:11 AM
no i tried that before i get that error

Kick
03-26-2009, 08:38 AM
no i tried that before i get that error
data = Tree.GetSelectedNode("Tree1");
Here data as string.
I am not understand what you wanted to write in your code. Try more clearly express what you need to do.

mwreyf1
03-26-2009, 08:38 AM
Tree.GetSelectedNode returns a string value.

You can't do math on a string.

Use something like "varnam = String.ToNumber(data) to convert to number.

ButtonMaker
03-26-2009, 08:40 AM
data = Tree.GetSelectedNode("Tree1");
Here data as string.
I am not understand what you wanted to write in your code. Try more clearly express what you need to do.

well what i am trying is get the count of the nodes in tree object and load them 1 by 1 to web object... jump to next node after 15 seconds...

Kick
03-26-2009, 08:50 AM
well what i am trying is get the count of the nodes in tree object and load them 1 by 1 to web object... jump to next node after 15 seconds...
On Show page:
nInd = 1;
Page.StartTimer(15000);
On Timer page:
nCount = Tree.GetChildCount("Tree1", "0");
if (nCount > 0) then
Web.LoadURL("Web1", "http://"..Tree.GetNode("Tree1", nInd).Text);
nInd = nInd + 1;
if (nInd == nCount) then
nInd = 1;
end
end

ButtonMaker
03-26-2009, 08:55 AM
thanks alot Kick :yes :yes :yes

1 question; how can i select loaded node ? i tried that but it doesnt seem to work !!!

nCount = Tree.GetChildCount("Tab_Panel", "0");
if (nCount > 0) then
Web.LoadURL("Web1", Tree.GetNode("Tree1", nInd).Data);
nInd = nInd + 1;
Tree.SetSelectedNode("Tab_Panel", nInd);
if (nInd == nCount) then
nInd = 1;
end
end

Kick
03-26-2009, 11:01 AM
nCount = Tree.GetChildCount("Tab_Panel", "0");
if (nCount > 0) then
Tree.SetSelectedNode("Tab_Panel", tostring(nInd));
Web.LoadURL("Web1", Tree.GetNode("Tab_Panel", nInd).Data);
nInd = nInd + 1;
if (nInd == nCount) then
nInd = 1;
end
end