ll_libload user, "user32.dll"
ll_getproc CreateWindowEx, "CreateWindowExA", user
ll_getproc SendMessage, "SendMessageA", user
#module
#deffunc comedit_limit int
mref max, 0
prm = comid.comid, 0x0141, (max = 0) * 64 + max, 0
ll_callfunc prm, 4, SendMessage@
return
#deffunc comedit int, int
mref max, 0 : mref height, 1
mref bmscr, 67
prm = 0, 0, 0, 0x50000202, bmscr.27, bmscr.28, bmscr.29, height = 0 * 100 + height, bmscr.13, 0xFF00, bmscr.14, 0
s = "combobox" : ll_getptr s : ll_ret prm.1
ll_callfunc prm, 12, CreateWindowEx@ : ll_ret prm
comid = 0
repeat 15, 1
if comid.cnt = 0 : comid = cnt : break
loop
if comid = 0 : return
comid.comid = prm
comedit_limit max
prm = comid.comid, 0x0030, bmscr.38, 1
ll_callfunc prm, 4, SendMessage@
return
#deffunc comedit_destroy int
mref id, 0
id++
if id > 0 | (id < 16) {
prm = comid.id, 0x0010, 0, 0
ll_callfunc prm, 4, SendMessage@
comid.id = 0
}
return
#deffunc comedit_cnt int
mref id, 0
mref stt, 64
if id < 0 | (id + 1 >= 16) : stt = comid.comid : else : comid = id + 1
return
#deffunc comedit_max val
mref max, 16
prm = comid.comid, 0x0146, 0, 0
ll_callfunc prm, 4, SendMessage@
ll_ret max
return
#deffunc comedit_index val
mref index, 16
prm = comid.comid, 0x0147, 0, 0
ll_callfunc prm, 4, SendMessage@
ll_ret index
return
#deffunc comedit_sel int
mref index, 0
comedit_max max
if index >= 0 & (index < max) : i = index : else : i = max - 1
prm = comid.comid, 0x014E, i, 0
ll_callfunc prm, 4, SendMessage@
return
#deffunc comedit_add str
mref msg, 32
ll_getptr s : ll_ret i
prm = comid.comid, 0x0143, 0, i
repeat
getstr s, msg
if strsize = 0 : break
strlen i, msg
memcpy msg, msg, i - strsize, , strsize
poke msg, i - strsize
ll_callfunc prm, 4, SendMessage@
if i - strsize <= 0 : break
loop
comedit_sel -1
return
#deffunc comedit_get int, val, int
mref index, 0 : mref msg, 25 : mref size, 2
ll_getptr msg : ll_ret i
if index = -1 {
prm = comid.comid, 0x000D, size = 0 * 64 + size, i
} else {
prm = comid.comid, 0x0148, index, i
}
ll_callfunc prm, 4, SendMessage@
return
#deffunc comedit_del int
mref index, 0
prm = comid.comid, index = -1 * 7 + 0x0144, index ! -1 * index, 0
ll_callfunc prm, 4, SendMessage@
return
#deffunc comedit_ins int, str
mref index, 0 : mref msg, 33
ll_getptr msg : ll_ret i
prm = comid.comid, 0x014A, index, i
ll_callfunc prm, 4, SendMessage@
return
#deffunc comedit_chg int, str
mref index, 0 : mref msg, 33
comedit_del index
comedit_ins index, msg
return
#global
font msmincho, 12 : objmode 2 : objsize 120, 20
pos 10, 10 : comedit 10
pos 10, 40 : button "追加", *add
pos 10, 70 : button "取得", *get
pos 10, 100 : button "削除", *del
pos 10, 130 : button "変更", *chg
comedit_add "abc\ndef\nghi\njkl\nmno"
sdim selrow, 64
comedit_max max
repeat max
if cnt : selrow += "\n"
selrow += "" + cnt + "行目"
loop
comedit_sel 0
pos 150, 10 : combox index, , selrow
pos 150, 40 : button "選択", *sel
stop
*add
comedit_get -1, tmp
comedit_add tmp
stop
*get
comedit_index index
comedit_max max
if index ! -1 {
comedit_get index, tmp
objprm 4, index
dialog "行数:" + max + "\n選択:" + index + "\n内容:" + tmp
} else {
comedit_get -1, tmp
dialog "行数:" + max + "\n表示:\n" + tmp
}
stop
*del
comedit_index index
comedit_max max
comedit_get index, tmp
if index = -1 {
dialog "削除行が選択されていません"
} else {
dialog "" + index + "行目「" + tmp + "」を削除しますか?", 2
if stat = 6 {
comedit_del index
if index >= max : index = max - 1
comedit_sel index
}
objprm 4, index
}
stop
*sel
comedit_sel index // 選択行変更
stop
*chg
comedit_get index, tmp // 最後に選択していた行取得
comedit_get -1, tmp2 // 現在の表示テキスト取得
dialog "「" + tmp + "」を「" + tmp2 + "」に変更しますか?", 2
if stat = 6 : comedit_chg index, tmp2 // テキスト変更
stop
|