Página 1 de 1

ListboxEx VS Listbox

Publicado: 20 Jun 2012 16:44
por Drag
Hi all I'm a new user registered just now, please help me with this code.
Note that this code is created by Rafax Player.
I want it working using a simple Listbox Object instead of ListBoxEx.
I tried with my poor skills without success.
I think my errors are in
ListBox.DeleteItem("Plugin1", -1);
instead of
ListBoxEx.DeleteAllItems("Plugin1");
nSel = ListBox.GetItemText("Plugin1", 1);
instead of
nSel = ListBoxEx.GetItemText("Plugin1", e_Index, true);
sUrl = ListBox.GetItemData("Plugin1", 1);
instead of
sUrl = ListBoxEx.GetItemData("Plugin1", e_Index);

These are the codes, Please HELP me!

On Global Functions
function loadBookmarks()
Total = INIFile.GetValueNames("Bookmarks.dat", "Bookmarks");
if #Total ~= 0 then
	ListBoxEx.DeleteAllItems("Plugin1");

	for i,v in pairs(Total) do
		fav = INIFile.GetValue("Bookmarks.dat", "Bookmarks",v );		
		result = ListBoxEx.AddItem("Plugin1", v, "", fav, "", 0, LBXITEM_HTML, 0, nil, nil, nil);

	end

end

end

On Button (On Click)
ret =DialogEx.Show("Bookmarks", true, nil, nil);
if ret == 1 then
IExplorer.Navigate("Web1", sUrl);
Input.SetText("Input1", sUrl);

end

On Show (Bookmarks DialogEx)
nSel = ListBoxEx.GetItemText("Plugin1", e_Index, true);
if nSel ~= 0 then
	sUrl=ListBoxEx.GetItemData("Plugin1", e_Index);
	DialogEx.Close(1);
end

On DoubleClick (ListBoxEx Plugin1)
nSel = ListBoxEx.GetItemText("Plugin1", e_Index, true);
if nSel ~= 0 then
	sUrl=ListBoxEx.GetItemData("Plugin1", e_Index);
	DialogEx.Close(1);
end

Thank you ALL!

Re: ListboxEx VS Listbox

Publicado: 20 Jun 2012 17:17
por rafaxplayer
The first case would look like, if you read the help of the subject will find many answers
ListBox.DeleteItem("ListBox1", LB_ALLITEMS);
--instead of
ListBoxEx.DeleteAllItems("Plugin1");
The object listboxex is much more complete than the simple listbox therefore has variables such as e_index event that listbox does not have, this index gives the action item according to the event, onselect see that listbox does not show variables event so se-lected to see the item we need more code.

On select (select) events:
tbSelect = ListBox.GetSelected("ListBox1");
if tbSelect then
sText = ListBox.GetItemText("ListBox1", tbSelect[1]);
end
--listboxEx
sText = ListBoxEx.GetItemText("Plugin1", e_Index, true);
With the following is the same.

Hope this helps

Re: ListboxEx VS Listbox

Publicado: 20 Jun 2012 18:11
por Drag
Hi Rafax, nice to meet you.
I tried to insert your conde into my simple project, but it doesn't woek.
Obviously your code is good but I've no skills.

This http://www.filefactory.com/file/6gzrd6h ... MyProj.apz is my project, please could you insert your code in the right way?
Thank you so much for the big help on this forum.
I've discovered it just today!

Re: ListboxEx VS Listbox

Publicado: 22 Jun 2012 17:57
por Drag
Is there anyone that can help me with this code?
I'm alone here!
Some Staff Member can listen to me?
THX People.

Re: ListboxEx VS Listbox

Publicado: 23 Jun 2012 14:50
por abood1987
Can you explain what is the problem ?

I did not understand exactly what you want maybe I can help

Re: ListboxEx VS Listbox

Publicado: 23 Jun 2012 16:02
por Drag
Hi abood1987, finally anyone listen to me!
My simple project is based on ListBoxEx plugin.
I need the same project but with a normal ListBox Object.
Rafax previously suggest me some code, but I'm a beginner so I need an extra help.
Please continue to help me, Thanks a lot!

Here you can find the sample, Ive created a DropBox account instead of uploading sites.

http://dl.dropbox.com/u/87266911/MyProject.apz

Re: ListboxEx VS Listbox

Publicado: 23 Jun 2012 16:53
por abood1987
Look in your ListBox " On Double-Click "

sel = ListBox.GetSelected("ListBox1");
nSel = ListBox.GetItemText("ListBox1", sel[1]);

if nSel ~= nil then
	sUrl=ListBox.GetItemData("ListBox1", sel[1]);

	DialogEx.Close(1);
end
[/b]

Ok ? :)

and in your Function :

function loadBookmarks()
Total = INIFile.GetValueNames("Bookmarks.dat", "Bookmarks");
if #Total ~= 0 then
	ListBox.DeleteItem("ListBox1", LB_ALLITEMS);


	for i,v in pairs(Total) do
		fav = INIFile.GetValue("Bookmarks.dat", "Bookmarks",v );		
		result = ListBox.AddItem("ListBox1", v, fav);
	end
end
end
[/b]

So In LISTBOX you need to this code to To select the index
sel = ListBox.GetSelected("ListBox1");
and in ListBoxEx you can used " e_Index " and you can not work in ListBox this variable oK ?

Hope to be understood :)

In any Way this is apz by changed ListBox :

HIDE: ON
Hidebb Message Hidden Description


Enjoy

Re: ListboxEx VS Listbox

Publicado: 23 Jun 2012 17:24
por Drag
Thank you friend, only a last thing.
On Bookmarks tab the Edit and Delete xButtons don't work.
I tried changing some terms but without success.
Could you apply this changes for me?
This is the last help I ask you.
Thx and excuse me.

Re: ListboxEx VS Listbox

Publicado: 23 Jun 2012 17:53
por mecivic
I tried your apz and works.
But When you edit it creates a new bookmark and Delete also works.

Re: ListboxEx VS Listbox

Publicado: 23 Jun 2012 18:02
por abood1987
mecivic escribió:I tried your apz and works.
But When you edit it creates a new bookmark and Delete also works.
yes i am changed it this time But to avoid the erro

On xButton "Delete" :

local nsel = ListBox.GetSelected("ListBox1");

if nsel ~= nil then
local sName = ListBox.GetItemText("ListBox1", nsel[1]);
	if Dialog.Message("Notice", "Sure you want to delete "..sName, MB_OKCANCEL, MB_ICONINFORMATION, MB_DEFBUTTON1)== IDOK then
    INIFile.DeleteValue("Bookmarks.dat", "Bookmarks",sName);
	ListBox.DeleteItem("ListBox1", nsel[1]);
	
	error = Application.GetLastError();
		if (error ~= 0) then
			Dialog.Message("Error", _tblErrorMessages[error], MB_OK, MB_ICONEXCLAMATION);
		else
			Dialog.Message("Ok", "Bookmark Deleted!", MB_OK, MB_ICONINFORMATION, MB_DEFBUTTON1);
		end
	end
else
	Dialog.Message("Error", "Select Any item", MB_OK, MB_ICONINFORMATION, MB_DEFBUTTON1);

end
[/color]

On xButton "Edit" :

edit = true;
local nsel = ListBox.GetSelected("ListBox1");
   if nsel ~= nil then
     sName = ListBox.GetItemText("ListBox1", nsel[1]);
     sUrl = ListBox.GetItemData("ListBox1", nsel[1]);
     ret = DialogEx.Show("Dialog2", true, nil, nil);
	if ret == 1 then
		INIFile.SetValue("Bookmarks.dat", "Bookmarks", sName, sUrl);
		Dialog.Message("Ok", "Bookmark saved!", MB_OK, MB_ICONINFORMATION, MB_DEFBUTTON1);
		loadBookmarks()
	end
	else
	Dialog.Message("Error", "Select Any item", MB_OK, MB_ICONINFORMATION, MB_DEFBUTTON1);
end
[/color]


this apz :

HIDE: ON
Hidebb Message Hidden Description

Re: ListboxEx VS Listbox

Publicado: 23 Jun 2012 18:25
por Drag
abood1987 you are GREAT!
Thanks!

Re: ListboxEx VS Listbox

Publicado: 05 Sep 2016 08:19
por Juan
you are GREAT! Thanks!
Thanks!