From Mark.Jacobson@uni.edu Thu Mar 2 12:57:22 2000 Date: Thu, 02 Mar 2000 12:49:02 -0600 (CST) Hi 030 students, The Fill Style menu has a CONTROL ARRAY of menu choices. Every one of the 8 commands has the SAME NAME property, mnuStyle. Each has an index, so we have mnuStyle(0), mnuStyle(1), ..., mnuStyle(7) and the 8 possible Fill Styles for a Shape control are conveniently those values 0, 1, 2, 3, 4, 5, 6 or 7. Nothing else is legal for the FillStyle property value. How convenient! By having a control array, we have ONE mnuStyle_Click event, instead of having to have EIGHT Click events! Here it is: ' This control array mnuStyle(0) through mnuStyle(7) has 8 choices. ' It only needs 1 event procedure. ' Each menu item has an Index property which is conveniently set ' to match the FillStyle property value, which is an Integer ' in range 0, 1, ..., 7 Private Sub mnuStyle_Click(Index As Integer) shpShapes.FillStyle = Index ' Change the Style For s = 0 To 7 ' Uncheck previous selection mnuStyle(s).Checked = False Next s mnuStyle(Index).Checked = True ' Check the current selection End Sub mnuBorderStyle is another control array. Study and understand the code for it. The Index property is set by using the Menu Editor, when you are creating the menu. The NAME will be the same, the CAPTION and the INDEX will be different. ---- --------- There are two control arrays in this program. Probably best to get the program working for the first two menus, then add the 3rd, then when you have some experience with regular menus, you can attempt the 4th menu, mnuFillStyle with its control array of commands. Finally, attempt the 5th and last menu, ONLY when you have the first four done. Its got another control array and its got the Border menu, Width command that calls up frmWidth with the frmWidth.Show statement! File Shape Color Fill Style Border - - - - - No control arrays Control Control for these 1st three array for array for menus. the 4th all commands menu. after the mnuWidth and the mnuSeparator commands. Do File menu first. Test it to see if it works. ----- Do Shape menu 2nd. Then test it and get it all working. Only then proceed to Color menu. Test it and get it working. Now start the last two menus, which are the most complicated, since they involve control arrays. Do Fill Style first, test it, get it working. Finally, do the Border menu, and create your 2nd form, the frmWidth form and your 2nd control array, the mnuBorderStyle control array. 1. Create the menu structure and the commands. 2. Get the mnuBorderStyle control array commands working by creating the code for mnuBorderStyle_Click(Index As Integer) event. 3. Create the 2nd form, the mnuWidth form and get it working. We will talk more about this project on Tuesday in class, so if you have problems and questions, please bring them up then or send me email. Thanks for the great questions in class today. Mark