最新消息:

nsDialogs在ListBoxes之间移动数据

nsis 永恒心锁 1810浏览 0评论
/*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
永恒心锁,版权所有丨如未注明,均为转载丨本网站采用BY-NC-SA协议进行授权

转载请注明:永恒心锁-分享互联网 » nsDialogs在ListBoxes之间移动数据

您必须 登录 才能发表评论!