90 likes | 310 Views
VB6 Forms and menus. Forms. Project.. Add form Project Properties – startup object Forms other than startup default to not shown Form2.show Form2.hide Event sequence – life history of a form create = init event load = load event (start-up processes) show (get loose focus) / hide
E N D
Forms • Project.. Add form • Project Properties – startup object • Forms other than startup default to not shown • Form2.show • Form2.hide • Event sequence – life history of a form • create = init event • load = load event (start-up processes) • show (get loose focus) / hide • queryunload (closedown processes) • unload • could then load again • terminate
Or another way.. Dim f As Form2 ' f is of type Object Set f = New Form2 ' causes init f.Show ' causes load then show ' when user closes form2, get queryunload, ' then unload Set f = nothing ' causes terminate
MDI Application • Multiple Document Interface • Add to project MDI Form • Add another form • Set MDIChild property of second form true
Menus • Tools – Menu Editor • Double-click to code
Displaying a popup menu Private Sub MDIForm_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single) If Button = 2 Then PopupMenu popUp End If End Sub
Forms and menu exercise • Make an MDI Form • With a menu File.New.Exit and Help • New produces new child window forms • Give child window a popup menu • Exit ends (use End) • Help displays an About dialog box: