User Tools

Site Tools


creating_20child_20controls_20in_20a_20loop

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

creating_20child_20controls_20in_20a_20loop [2018/03/31 13:19]
127.0.0.1 external edit
creating_20child_20controls_20in_20a_20loop [2018/04/17 15:25] (current)
tbest3112 Added syntax highlighting
Line 2: Line 2:
  
 //by Richard Russell, March 2013//\\ \\  In Liberty BASIC 4.04 you can use the **MAPHANDLE** statement to, for example, reuse the same code to open multiple windows. The LB4 documentation illustrates how to open three windows using this technique:​\\ ​ //by Richard Russell, March 2013//\\ \\  In Liberty BASIC 4.04 you can use the **MAPHANDLE** statement to, for example, reuse the same code to open multiple windows. The LB4 documentation illustrates how to open three windows using this technique:​\\ ​
 +<code lb>
     winName$ = "first second third"     winName$ = "first second third"
     for x = 1 to 3     for x = 1 to 3
Line 21: Line 22:
     if answer = 1 then close #handle$     if answer = 1 then close #handle$
   end sub   end sub
 +</​code>​
 It would be extremely useful to be able to use MAPHANDLE in a similar fashion to create multiple **child controls**, but for some reason LB4 will not let you do so. Fortunately this is one of the many limitations that is removed in **LB Booster**.\\ \\  The code below is adapted from the Alphabet Buttons example on the [[http://​basic.wikispaces.com/​Alphabet+Buttons|Liberty BASIC Community Wiki]] but instead of using a separate BUTTON statement for each button, all 26 are created in a loop:​\\ ​ It would be extremely useful to be able to use MAPHANDLE in a similar fashion to create multiple **child controls**, but for some reason LB4 will not let you do so. Fortunately this is one of the many limitations that is removed in **LB Booster**.\\ \\  The code below is adapted from the Alphabet Buttons example on the [[http://​basic.wikispaces.com/​Alphabet+Buttons|Liberty BASIC Community Wiki]] but instead of using a separate BUTTON statement for each button, all 26 are created in a loop:​\\ ​
 +<code lb>
       Stylebits #win, 0,​_WS_MAXIMIZEBOX,​0,​0       Stylebits #win, 0,​_WS_MAXIMIZEBOX,​0,​0
       WindowWidth = 230       WindowWidth = 230
Line 47: Line 50:
       end       end
   end sub   end sub
 +</​code>​
 If you click a button and watch the mainwin you can see that each button has a separate handle, exactly as was the case in the original program. If you click a button and watch the mainwin you can see that each button has a separate handle, exactly as was the case in the original program.
creating_20child_20controls_20in_20a_20loop.txt ยท Last modified: 2018/04/17 15:25 by tbest3112