Hi,
I wrote the following code to insert "item" which is a string into a
wxListCtrl which is ListBox. But at the end no item is added to the List
Control. It works fine on windows though. Basically it places the new item
so the list remains sorted and then places the item. At the first run
itemNum is taken as 0 but there is no element placed. Any ideas why it
doesn't work in Linux?
Thanks
InsertItem = function(ListBox,Item)
-- Check if the Item exists in the list control
local itemNum = -1
while ListBox:GetNextItem(itemNum) ~= -1 do
local prevItemNum = itemNum
itemNum = ListBox:GetNextItem(itemNum)
local itemText = ListBox:GetItemText(itemNum)
if itemText == Item then
return true
end
if itemText > Item then
itemNum = prevItemNum
break
end
end
-- itemNum contains the item before which to place item
if itemNum == -1 then
itemNum = 0
else
itemNum = itemNum + 1
end
local newItem = wx.wxListItem()
newItem:SetId(itemNum)
newItem:SetText(Item)
ListBox:InsertItem(newItem)
return true
end
------------------------------------------------------------------------------
Keep Your Developer Skills Current with LearnDevNow!
The most comprehensive online learning library for Microsoft developers
is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3,
Metro Style Apps, more. Free future releases when you subscribe now!
http://p.sf.net/sfu/learndevnow-d2d
_______________________________________________
wxlua-users mailing list
wxlua-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wxlua-users