nsDialogs在ListBoxes之间移动数据

/*nsDialogs在ListBoxes之间移动数据*/
OutFile listboxes.exe
;Includes
!include nsDialogs.nsh
!include LogicLib.nsh
;Definitions
!define MOVE_BUTTONS
!define COPY_BUTTONS
;Variables
Var Dialog
Var ListBox_left
Var ListBox_right
!ifdef MOVE_BUTTONS
 Var Button_MoveRight
 Var Button_MoveLeft
!endif ;MOVE_BUTTONS
!ifdef COPY_BUTTONS
 Var Button_CopyRight
 Var Button_CopyLeft
!endif ;COPY_BUTTONS
;Pages
Page custom nsDialogsPage
Page InstFiles
;Functions
Function nsDialogsPage
nsDialogs::Create /NOUNLOAD 1018
Pop $Dialog
${If} $Dialog == error
Abort
${EndIf}
${NSD_CreateListBox} 0 5% 33% 90% " "
Pop $ListBox_left
;dummy data
${NSD_LB_AddString} $ListBox_left "111"
${NSD_LB_AddString} $ListBox_left "222"
${NSD_LB_AddString} $ListBox_left "333"
${NSD_CreateListBox} 66% 5% 33% 90% " "
Pop $ListBox_right
;more dummy data
${NSD_LB_AddString} $ListBox_right "AAA"
${NSD_LB_AddString} $ListBox_right "BBB"
${NSD_LB_AddString} $ListBox_right "CCC"
 !ifdef MOVE_BUTTONS
${NSD_CreateButton} 50% 40% 10% 20 "->"
Pop $Button_MoveRight
GetFunctionAddress $0 OnClick_MoveRight
${NSD_OnClick} $Button_MoveRight OnClick_MoveRight
${NSD_CreateButton} 40% 40% 10% 20 "<-"
Pop $Button_MoveLeft
GetFunctionAddress $0 OnClick_MoveLeft
${NSD_OnClick} $Button_MoveLeft OnClick_MoveLeft
 !endif ;MOVE_BUTTONS
 !ifdef COPY_BUTTONS
${NSD_CreateButton} 50% 50% 10% 20 ">>"
Pop $Button_CopyRight
GetFunctionAddress $0 OnClick_CopyRight
${NSD_OnClick} $Button_CopyRight OnClick_CopyRight
${NSD_CreateButton} 40% 50% 10% 20 "<<"
Pop $Button_CopyLeft
GetFunctionAddress $0 OnClick_CopyLeft
${NSD_OnClick} $Button_CopyLeft OnClick_CopyLeft
 !endif ;COPY_BUTTONS
nsDialogs::Show
FunctionEnd
!ifdef MOVE_BUTTONS
 Function OnClick_MoveRight
Pop $R0
SendMessage $ListBox_left ${LB_GETCURSEL} 0 0 $0
${If} $0 >= 0
System::Call user32::SendMessage(i$ListBox_left,i${LB_GETTEXT},i$0,t.r1)
${NSD_LB_AddString} $ListBox_right "$1"
SendMessage $ListBox_left ${LB_DELETESTRING} $0 `STR:$1`
${EndIf}
 FunctionEnd
 Function OnClick_MoveLeft
Pop $R0
SendMessage $ListBox_right ${LB_GETCURSEL} 0 0 $0
${If} $0 >= 0
System::Call user32::SendMessage(i$ListBox_right,i${LB_GETTEXT},i$0,t.r1)
${NSD_LB_AddString} $ListBox_left "$1"
SendMessage $ListBox_right ${LB_DELETESTRING} $0 `STR:$1`
${EndIf}
 FunctionEnd
!endif ;MOVE_BUTTONS
!ifdef COPY_BUTTONS
 Function OnClick_CopyRight
Pop $R0
SendMessage $ListBox_left ${LB_GETCURSEL} 0 0 $0
${If} $0 >= 0
System::Call user32::SendMessage(i$ListBox_left,i${LB_GETTEXT},i$0,t.r1)
${NSD_LB_AddString} $ListBox_right "$1"
${EndIf}
 FunctionEnd
 Function OnClick_CopyLeft
Pop $R0
SendMessage $ListBox_right ${LB_GETCURSEL} 0 0 $0
${If} $0 >= 0
System::Call user32::SendMessage(i$ListBox_right,i${LB_GETTEXT},i$0,t.r1)
${NSD_LB_AddString} $ListBox_left "$1"
${EndIf}
 FunctionEnd
!endif ;COPY_BUTTONS
;Section
Section
Quit
SectionEnd
THE END
喜欢就支持一下吧
点赞8 分享
评论 抢沙发

请登录后发表评论

    暂无评论内容