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

Boxes Functions
plus
plus

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

Multiple Items and the Boxes Functions

Keywords: boxes	   

Here's an example of multiple items and the boxes functions:
;Version 1.95   2/10/97

BoxCaption(1, "Pick items out of a hat.")

BoxesUp("1,0,1000,1000", @zoomed)

BoxColor(1,"255,0,0",4)
BoxDrawRect(1,"0,0,1000,1000",2)
BoxTextColor(1,"255,255,0")

cr=Num2Char(13)
newlist = StrCat("Dad",@tab,"Mom",@tab,"Barbara",@tab,"Katherine",@tab,"Rebecca",@tab,"Jimmy")
list = newlist
:top

hatFormat=`WWWDLGED,5.0`

hatCaption=`Pick an item from a hat.`
hatX=54
hatY=68
hatWidth=204
hatHeight=114
hatNumControls=6

hat01=`97,62,88,DEFAULT,PUSHBUTTON,DEFAULT,"&Start",1`
hat02=`97,78,88,DEFAULT,PUSHBUTTON,DEFAULT,"&Cancel",8`
hat03=`16,20,72,80,ITEMBOX,list,DEFAULT`
hat04=`8,4,124,DEFAULT,STATICTEXT,DEFAULT,"Select items to be put into a hat."`
hat05=`97,30,88,DEFAULT,PUSHBUTTON,DEFAULT,"&Add another item.",2`
hat06=`97,46,88,DEFAULT,PUSHBUTTON,DEFAULT,"&Empty the hat",5`

ButtonPushed=Dialog("hat")

switch buttonpushed
    case 8
        display(1,"Don't want to play anymore?","Good Bye!")
        goto cancel

    case 5
        newlist = list
        goto top

    case 2
        goto add

    case 1
        if list == ""
            display(1,"Ooops!","You must select some items.")
            list = newlist
            goto top
        endif
endswitch

:Start
;BoxCaption(1, "Mixing up the items!")
b = StrReplace(list, @tab, @CR)
num_names = ItemCount(b, cr)
BoxDataTag(1,"Tag1")
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 BoxUpdates(1,3)


loopcnt = Random(num_names-1) + 1
name_a = ItemExtract(loopcnt,b, cr)


loopcnt=0
for i = 1 to Random(1000)+ 1
    loopcnt=loopcnt+1
    if loopcnt > num_names
        loopcnt=1
    endif
    name_a = ItemExtract(loopcnt,b, cr)
BoxCaption(1, "	    %name_a%")
    BoxTextFont(1,"",99,0,16)
    BoxDrawText(1, "0,120,1000,1000", "Mixing up the items...", @False,1)
    BoxDrawText(1, "0,250,1000,1000", "%name_a%", @true, 1)
    BoxDataClear(1,"Tag1")
next i

BoxTextFont(1,"",99,0,16)
BoxCaption(1, "We have a winner!")
BoxDrawText(1, "0,120,1000,1000", "And the winner is...", @true, 1)
Playwaveform("C:\Waves\drum.wav",0)

BoxDrawText(1, "0,250,1000,1000", "%name_a%!", @true, 1)
timedelay(1)

        q = AskYesNo('Try again?', 'Want to try again with the same list?')
        If q == @YES 
                BoxDrawText(1, "0,100,1000,1000", "%cr%%cr%		   ", @true, 1)
                goto Start
        else
                BoxCaption(1, "Good Bye!")
                display(1,"That was fun!","See you next time!")
                exit
        
:add

newnameFormat=`WWWDLGED,5.0`
newnameCaption=`Add an item to the list.`
newnameX=84
newnameY=86
newnameWidth=165
newnameHeight=62
newnameNumControls=3
newname01=`16,11,136,DEFAULT,STATICTEXT,DEFAULT,"Enter the item you wish to put on the list."`
newname02=`40,27,88,DEFAULT,EDITBOX,newname,""`
newname03=`60,41,49,DEFAULT,PUSHBUTTON,DEFAULT,"&OK",4`
ButtonPushed=Dialog("newname")


if newname == "" 
                list=newlist
                goto top
endif



list=strcat(newname,@tab,newlist)
newlist = list
Goto top

:Cancel
BoxCaption(1, "Good Bye!")
display(1,"That was fun!","See you next time!")

Article ID:   W12765
Filename:   Multiple Items and the Boxes Functions Example.txt
File Created: 2000:12:26:14:09:04
Last Updated: 2000:12:26:14:09:04