<commit_before>-- IpuOle and LuaCom example contributed by Kommit

require "iuplua"
require "iupluaole"
require "luacom"

local control = iup.olecontrol{"COMCTL.ListViewCtrl"} -- this control works, but lacks many function
--local control = iup.olecontrol{"MsComCtlLib.ListViewCtrl"}

-- connect it to LuaCOM
control:CreateLuaCOM()

-- Sets production mode
control.designmode= "NO"

control.bgcolor = "0 0 0"  -- if control is not showing, you will see a black window...

-- Create a dialog containing the OLE control

local dlg = iup.dialog{
    title="IupOle",
    size="HALFxHALF",
    iup.vbox{
    control,
    }
}

-- Show the dialog and run the main loop
dlg:show()

control.com.View = 3  -- Report View

-- control.com.FullRowSelect = true -- this property is only support by MsComCtlLib
control.com.ColumnHeaders:Add(nil, nil, "Header 1")
control.com.ColumnHeaders:Add(nil, nil, "Header 2")
control.com.ListItems:Add(nil, nil, "Value 1")
control.com.ListItems:Add(nil, nil, "Value 3")
-- following operations are only support by MsComCtlLib
-- control.com.ListItems:Item(1).ListSubItems:Add(nil, nil, "Value2")
-- control.com.ListItems:Item(2).ListSubItems:Add(nil, nil, "Value4")


-- add events to to the control
list_events = {}

function list_events:ColumnClick(column)
    control.com.Sorted = 1

    iCur = column.Index - 1
    if iCur == iLast then
        if control.com.SortOrder == 0 then
            control.com.SortOrder = 1
        else
            control.com.SortOrder = 0
        end
    end
    control.com.SortKey = iCur
    iLast = iCur
end

luacom.Connect(control.com, list_events)



if (not iup.MainLoopLevel or iup.MainLoopLevel()==0) then
  iup.MainLoop()
end
<commit_msg>*** empty log message ***<commit_after>-- IpuOle and LuaCom example contributed by Kommit <<EMAIL>>

require "iuplua"
require "iupluaole"
require "luacom"

local control = iup.olecontrol{"MsComCtlLib.ListViewCtrl"}

-- Connect it to LuaCOM
control:CreateLuaCOM()

-- Sets production mode
control.designmode= "NO"

control.bgcolor = "255 255 255"

-- Create a dialog containing the OLE control

local dlg = iup.dialog{
    title="IupOle",
    size="150x80",
    iup.vbox{
    control,
    }
}

control.com.View = 3  -- Report View

control.com.FullRowSelect = 1
control.com.ColumnHeaders:Add(nil, nil, "Name")
control.com.ColumnHeaders:Add(nil, nil, "Score")

-- First column
control.com.ListItems:Add(nil, nil, "Daimon")
control.com.ListItems:Add(nil, nil, "Andy")
control.com.ListItems:Add(nil, nil, "Chris")
control.com.ListItems:Add(nil, nil, "Billy")

-- Second column
control.com.ListItems:Item(1).ListSubItems:Add(nil, nil, 16)
control.com.ListItems:Item(2).ListSubItems:Add(nil, nil, 17)
control.com.ListItems:Item(3).ListSubItems:Add(nil, nil, 24)
control.com.ListItems:Item(4).ListSubItems:Add(nil, nil, 11)


-- Add events to to the control
list_events = {}

-- Callback function
function list_events:ColumnClick(column)
    control.com.Sorted = 1

    iCur = column.Index - 1
    if iCur == iLast then
        if control.com.SortOrder == 0 then
            control.com.SortOrder = 1
        else
            control.com.SortOrder = 0
        end
    end
    control.com.SortKey = iCur
    iLast = iCur
end

luacom.Connect(control.com, list_events)

-- Show the dialog and run the main loop
dlg:show()

if (not iup.MainLoopLevel or iup.MainLoopLevel()==0) then
  iup.MainLoop()
end

{'fraction_non_alphanumeric': 0.12481601413011481, 'fraction_numerical': 0.015307624374448043, 'mean_word_length': 3.591891891891892, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2387657', 'n_tokens_mistral': 1212, 'n_tokens_neox': 1166, 'n_words': 306}