View Full Version : ListBox help
T3STY
04-05-2009, 03:45 PM
Hi everyone!
I' m here for ask help with the ListBox object.
In a project (Web browser) I've got a listbox object with some items wich are indexed by the following code:
ListBox.DeleteItem("ListBox1", -1); --Clear list
folder = Registry.GetValue(HKEY_CURRENT_USER, "Software\\Microsoft\\Windows\\CurrentVersion\\Expl orer\\Shell Folders", "Favorites", true); --Get the path for the user Favorites folder
file = File.Find(folder, "*.url", false, false, nil); --Search for .URL files
for j,file_path in file do
ListBox.AddItem("ListBox1", String.SplitPath(file_path).Filename, file_path); --Add the files to the ListBox object
end
Then, when I double click a item in the list, I need to give the complete path for the selected item, to use it with "INIFile.GetValue" and "Web.LoadURL" actions.
The problem is here: I've tried to use
Selected = ListBox.GetSelected("ListBox1");
Seldata = ListBox.GetItemData("ListBox1", Selceted);
Link = INIFile.GetValue(Seldata, "InternetShortcut", "URL");
Web.LoadURL("Web1", Link);
but it doesn't work.
Can anyone help me, please? Thankyou.
Dermot
04-05-2009, 03:54 PM
Selected = ListBox.GetSelected("ListBox1");
Seldata = ListBox.GetItemData("ListBox1", Selected[1]);
Link = INIFile.GetValue(Seldata, "InternetShortcut", "URL");
Web.LoadURL("Web1", Link);
T3STY
04-05-2009, 04:23 PM
Tankyou very very much!!! it works!
But, i've got another question:
How could I make a progressbar (progressbar plugin) that indicates the loading progress?
Thankyou
ButtonMaker
04-06-2009, 12:08 AM
why this code only loads 1 favorite to tree object ???
folder = Registry.GetValue(HKEY_CURRENT_USER, "Software\\Microsoft\\Windows\\CurrentVersion\\Expl orer\\Shell Folders", "Favorites", true); --Get the path for the user Favorites folder
file = File.Find(folder, "*.url", false, false, nil); --Search for .URL files
for j, file_path in file do
FavCount = Tree.GetChildCount("Tree1", "0");
FavNodeData = {};
FavNodeData.Text = String.SplitPath(file_path).Filename;
FavNodeData.Data = file;
FavNodeData.Expanded = true;
FavNodeData.NodeIndex = FavCount+1;
FavNodeData.ImageIndex = 8;
FavNodeData.SelectedImageIndex = 8;
Tree.InsertNode("Tree1", (FavCount), FavNodeData);
end
ShadowUK
04-06-2009, 02:45 AM
why this code only loads 1 favorite to tree object ???
folder = Registry.GetValue(HKEY_CURRENT_USER, "Software\\Microsoft\\Windows\\CurrentVersion\\Expl orer\\Shell Folders", "Favorites", true); --Get the path for the user Favorites folder
file = File.Find(folder, "*.url", false, false, nil); --Search for .URL files
for j, file_path in file do
FavCount = Tree.GetChildCount("Tree1", "0");
FavNodeData = {};
FavNodeData.Text = String.SplitPath(file_path).Filename;
FavNodeData.Data = file;
FavNodeData.Expanded = true;
FavNodeData.NodeIndex = FavCount+1;
FavNodeData.ImageIndex = 8;
FavNodeData.SelectedImageIndex = 8;
Tree.InsertNode("Tree1", (FavCount), FavNodeData);
end
Can't you ask this question in your own thread?
ButtonMaker
04-06-2009, 03:53 AM
Can't you ask this question in your own thread?
no because it was about favorites and also cant u answer it instead of complaning about it... i dont understand why people like u spend thier time about complaning !!!
ShadowUK
04-06-2009, 04:32 AM
no because it was about favorites and also cant u answer it instead of complaning about it... i dont understand why people like u spend thier time about complaning !!!
It may be relevant but you're asking about the Tree in a ListBox thread.
Anyway, it's probably because of this
FavCount = Tree.GetChildCount("Tree1", "0");
try changing it to
FavCount = Tree.GetChildCount("Tree1", "0") + 1;
[/complain]
ButtonMaker
04-06-2009, 04:43 AM
thanks ShadowUK
another small question;
why this code doesnt load the node to web object ???
local infodelarbol = Tree.GetNode("Tree1", e_NodeIndex);
if infodelarbol then
Web.LoadURL("Web1",infodelarbol.Data);
end
mwreyf1
04-06-2009, 07:15 AM
Looks like T3STY got his thread highjacked and he ain't gettin' it back.
Shame on you Button...
ButtonMaker
04-06-2009, 07:44 AM
Looks like T3STY got his thread highjacked and he ain't gettin' it back.
Shame on you Button...
no, actually i am keeping it fresh for him :D
T3STY
04-06-2009, 12:02 PM
Tankyou very very much!!! it works!
But, i've got another question:
How could I make a progressbar (progressbar plugin) that indicates the loading progress?
Thankyou
No one knows help me?
mwreyf1
04-06-2009, 12:39 PM
Maybe you could use an animated flash oject until the browser is up.
Not sure why you would need (other than because) a progress bar for a few second wait.
Anyway...
T3STY
04-06-2009, 12:59 PM
Remember that the web object uses Internet Exporer's engine and anyone knows that IE isn't so faster.
Anyway, the flash animation sounds good.
Thnakyou for help.
Bye!
vBulletin® v3.8.4, Copyright ©2000-2010, Jelsoft Enterprises Ltd.