Move Items From One Item Listbox to Another
Keywords: ITEMBOX
Question:
I want to put 2 itemlist boxes in a dialog, when I select some items in one box , these selected items will disapear from this box and appear at another box, how can I write the program with dynamic editor, will you gave me an example?Answer:
MSG_Initialization=0 MSG_ItemBoxSelect=7 DC_ItemBoxContents=5 DC_ItemBoxSelection=6 #DefineSubRoutine MyProc(MyHandle,MyAction,MyControl,MyRes1,MyRes2) Switch MyAction Case MSG_Initialization DialogProcOptions(MyHandle,MSG_ItemBoxSelect,@TRUE) Break Case MSG_ItemBoxSelect Switch MyControl Case 001 Selected1=DialogControlGet(MyHandle,001,DC_ItemBoxSelection) BoxList1=ItemRemove(ItemLocate(Selected1,BoxList1,@TAB),BoxList1,@TAB) BoxList2=ItemInsert(Selected1,-1,BoxList2,@TAB) Continue Case 002 Selected2=DialogControlGet(MyHandle,002,DC_ItemBoxSelection) BoxList2=ItemRemove(ItemLocate(Selected2,BoxList2,@TAB),BoxList2,@TAB) BoxList1=ItemInsert(Selected2,-1,BoxList1,@TAB) Continue Case 001 Case 002 DialogControlSet(MyHandle,001,DC_ItemBoxContents,BoxList1) DialogControlSet(MyHandle,002,DC_ItemBoxContents,BoxList2) Break EndSwitch ; MyControl in MSG_ItemBoxSelect EndSwitch ; MyAction Return -1 #EndSubRoutine BoxList1=StrReplace("Yankees,Red Sox,Orioles,Blue Jays,Devil Rays",",",@TAB) BoxList2=StrReplace("Braves,Mets,Marlins,Expos,Phillies",",",@TAB) MyDialogFormat=`WWWDLGED,6.1` MyDialogCaption="MyDialog" MyDialogNumControls=003 MyDialogX=-1 MyDialogY=-1 MyDialogWidth=160 MyDialogHeight=100 MyDialogFont=`Default` MyDialogTextColor=`Default` MyDialogBackground=`Default` MyDialogProcedure="MyProc" MyDialog001=`020,002,050,070,ItemBox ,BoxList1,Default ,Default,1,Default,Default,Default,Default` MyDialog002=`090,002,050,070,ItemBox ,BoxList2,Default ,Default,2,Default,Default,Default,Default` MyDialog003=`050,080,060,012,PushButton ,Default,"Done" ,99 ,3,Default,Default,Default,Default` Dialog("MyDialog") Exit