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.

Dynamically Create a Box with more than 16 buttons

 Keywords: Dynamically Create a Box with more than 16 buttons 

Question:

I am attempting to create a Dialog with Winbatch Box Functions. I am attempting to place more than 16 Buttons in a box, or at least make it appear as there is only one box. I've read that more than 16 buttons can be drawn if the boxnew function is used however I have not been successful. I also need the script to read the contents of an ini file, and build the box based on how many items(applications) are listed in my ini file.

Answer:

Here is some code that might help. It reads the contents of the ini file that determines how many buttons will appear. This code dynamically generates a dialog with a number of buttons determined in an INI file:

;INI file that list applications that need to be associated with a button
menuini = "C:\menu.ini"
appz = iniitemizepvt ("Applications", menuini)
headings = iniitemizepvt ("", menuini)
num_of_appz = itemcount (appz, @tab)

space_between = 75  ; amount of space to add between each button

Boxesup ("75, 25, 900, 950", @normal)
BoxDrawText (1, "50, 30, 250, 50", "Application", @false, 1)

for appnum = 0 to num_of_appz-1
   box = (appnum/10)+2
   boxbutton = (appnum mod 10) +1
   if boxbutton == 1
      boxX = ((box-2)*270) + 10
      boxX2=BoxX+280
      Boxnew (box, "%boxX%, 100,%BoxX2%,850", 1)
      ux = 0
      lx = 0
      uy = 800
      ly = 68
   endif
   
   cords = strcat (ux, ",", lx, ",", uy, ",", ly)
   app%appnum% = itemextract (appnum+1, appz, @tab)
   BoxButtonDraw (box, boxbutton, app%appnum%, cords)
   lx = lx + space_between
   ly = ly + space_between
next appnum

BoxButtonwait ()
for buttons = 0 to num_of_appz-1
   box = (buttons/10)+2
   boxbutton = (buttons mod 10)  +1
   if BoxButtonStat (box,boxbutton) then pbutton = buttons
next buttons

Display (1, "Button test", app%pbutton%)










Article ID:   W15111
File Created: 2002:09:05:13:49:44
Last Updated: 2002:09:05:13:49:44