1. 程式人生 > 實用技巧 >Skill 兩個 listBox 資料交換的模板

Skill 兩個 listBox 資料交換的模板

https://www.cnblogs.com/yeungchie/

  • code
prog((LBL LBR BL BR tempForm)
    LBL = hiCreateListBoxField(
        ?name       'LBL
        ?choices    list("A" "B" "C")
        ?multipleSelect t
    )
    LBR = hiCreateListBoxField(
        ?name       'LBR
        ?choices    list("D" "E" "F")
        ?multipleSelect t
    )
    BL = hiCreateFormButton(
        ?name       'BL
        ?buttonText "->"
        ?callback   "L2R"
    )
    BR = hiCreateFormButton(
        ?name       'BR
        ?buttonText "<-"
        ?callback   "R2L"
    )
    tempForm = hiCreateAppForm(
        ?name   'tempForm
        ?fields list(LBL LBR BL BR)
    )
    hiDisplayForm(tempForm)
)
procedure(L2R()
    tempForm~>LBR~>choices = append(tempForm~>LBR~>choices tempForm~>LBL~>value)
    tempForm~>LBL~>choices = setof(x tempForm~>LBL~>choices !member(x tempForm~>LBL~>value))
)
procedure(R2L()
    tempForm~>LBL~>choices = append(tempForm~>LBL~>choices tempForm~>LBR~>value)
    tempForm~>LBR~>choices = setof(x tempForm~>LBR~>choices !member(x tempForm~>LBR~>value))
)
  • show