WinBatch Tech Support Home

Database Search

If you can't find the information using the categories below, post a question over in our WinBatch Tech Support Forum.

TechHome

Samples

Can't find the information you are looking for here? Then leave a message over on our WinBatch Tech Support Forum.

Managing a pair of Dynamic ItemBoxes

This example shows a pair of dialog ITEMBOX'es and the code to allow items to be moved back and forth between the boxes just with a single click.
MSG_Initialization=0
MSG_PushButton=2
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)
           DialogProcOptions(MyHandle,MSG_PushButton,@TRUE)
           Break

        Case MSG_PushButton
           Switch MyControl
              Case 003
                  Selected2=DialogControlGet(MyHandle,002,DC_ItemBoxContents)
                  DialogControlSet(MyHandle,002,DC_ItemBoxSelection, Selected2)
                 Break
           EndSwitch
           Break

        Case MSG_ItemBoxSelect
           Switch MyControl
               Case 001
                  Selected1=DialogControlGet(MyHandle,001,DC_ItemBoxSelection)
                  Count1=ItemCount(Selected1,@TAB)
                  For xx=1 To count1
                     thisone=ItemExtract(xx,Selected1,@TAB)
                     BoxList1=ItemRemove(ItemLocate(thisone,BoxList1,@TAB),BoxList1,@TAB)
                     BoxList2=ItemInsert(thisone,-1,BoxList2,@TAB)
                  Next
                  Continue

               Case 002
                  Selected2=DialogControlGet(MyHandle,002,DC_ItemBoxSelection)
                  Count2=ItemCount(Selected2,@TAB)
                  For xx=1 To count2
                     thisone=ItemExtract(xx,Selected2,@TAB)
                     BoxList2=ItemRemove(ItemLocate(thisone,BoxList2,@TAB),BoxList2,@TAB)
                     BoxList1=ItemInsert(thisone,-1,BoxList1,@TAB)
                  Next
                  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)
BoxList2=""

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")

;message ("INFO","Content is:%BoxList2%")
AskItemlist("Selected Items",BoxList2,@TAB,@UNSORTED,@SINGLE)

Exit 

Article ID:   W15919
File Created: 2004:03:30:15:41:42
Last Updated: 2004:03:30:15:41:42