ll_libload user, "user32.dll"
ll_getproc CreateWindowEx, "CreateWindowExA", user
ll_getproc SendMessage, "SendMessageA", user
#module ultimate_combo
#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_open int
mref flg, 0
prm = comid.comid, 0x014F, flg, 0
ll_callfunc prm, 4, SendMessage@
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_dataget int, val
mref index, 0 : mref value, 17
prm = comid.comid, 0x0150, index
ll_callfunc prm, 4, SendMessage@
ll_ret value
return
#deffunc comedit_dataset int, int
mref index, 0 : mref value, 1
prm = comid.comid, 0x0151, index, value
ll_callfunc prm, 4, SendMessage@
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
comedit_add "abc\ndef\nghi\njkl\nmno"
comedit_sel 0
pos 140, 10 : input value
pos 140, 40 : button "値の関連付け", *setv
pos 140, 70 : button "関連付け値取得", *getv
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 5, index
}
stop
*getv
comedit_index index
comedit_get index, tmp
comedit_dataget index, value
dialog "「" + tmp + "」に関連付けられた値は「" + value + "」です"
stop
*setv
comedit_index index
comedit_get index, tmp
comedit_dataset index, value
dialog "「" + tmp + "」に「" + value + "」を関連付けました"
stop
|