There:Avata wrote: ↑Aug 02, 2022 12:14 Thanks, Now it is clear that two methold call a forms.
I remember that there is a optional button for automatical creat the "Common Shared As Form1Type Ptr fForm1". but now it was removed. Maybe it is important and should restore it.
But it is the same as the first one which need code "#include once "Form3.frm" before show the form3.
You told me that the code working.Code: Select all
Common Shared As Form Ptr fForm1,fForm2,fForm3, fForm4 #include once "Form2.frm" #include once "Form3.frm" #include once "Form4.frm"
I wanta the code like this of a sample. Maybe it is no working so far.
Form1.frm:
Code: Select all
#ifdef __FB_WIN32__
#cmdline "Form1.rc"
#endif
'#Region "Form"
#include once "mff/Form.bi"
#include once "mff/Menus.bi"
#include once "mff/Panel.bi"
Using My.Sys.Forms
Type Form1Type Extends Form
Declare Static Sub _MenuItem2_Click(ByRef Sender As MenuItem)
Declare Sub MenuItem2_Click(ByRef Sender As MenuItem)
Declare Constructor
Dim As MainMenu MainMenu1
Dim As MenuItem MenuItem1, MenuItem2
Dim As Panel Panel1
End Type
Constructor Form1Type
' Form1
With This
.Name = "Form1"
.Text = "Form1"
.Designer = @This
.Menu = @MainMenu1
.FormStyle = FormStyles.fsMDIForm
.WindowState = WindowStates.wsMaximized
.SetBounds 0, 0, 350, 319
End With
' MainMenu1
With MainMenu1
.Name = "MainMenu1"
.SetBounds 65, 111, 16, 16
.Designer = @This
.Parent = @This
End With
' MenuItem1
With MenuItem1
.Name = "MenuItem1"
.Designer = @This
.Caption = "File"
.ParentMenu = @MainMenu1
End With
' MenuItem2
With MenuItem2
.Name = "MenuItem2"
.Designer = @This
.Caption = "Open"
.OnClick = @_MenuItem2_Click
.Parent = @MenuItem1
End With
' Panel1
With Panel1
.Name = "Panel1"
.Text = "Panel1"
.TabIndex = 0
.Align = DockStyle.alLeft
.SetBounds 0, 0, 34, 261
.Designer = @This
.Parent = @This
End With
End Constructor
Private Sub Form1Type._MenuItem2_Click(ByRef Sender As MenuItem)
*Cast(Form1Type Ptr, Sender.Designer).MenuItem2_Click(Sender)
End Sub
Dim Shared Form1 As Form1Type
Common Shared As Form Ptr fForm1,fForm2,fForm3, fForm4
#ifndef _NOT_AUTORUN_FORMS_
#define _NOT_AUTORUN_FORMS_
#include once "Form2.frm"
#include once "Form3.frm"
#include once "Form4.frm"
fForm1 = @Form1
fForm2 = @Form2
fForm3 = @Form3
fForm4 = @Form4
Form1.Show
App.Run
#endif
'#End Region
Private Sub Form1Type.MenuItem2_Click(ByRef Sender As MenuItem)
fForm2->Show Form1
End Sub
Code: Select all
#ifdef __FB_WIN32__
#cmdline "Form1.rc"
#endif
'#Region "Form"
#include once "mff/Form.bi"
#include once "mff/CommandButton.bi"
Using My.Sys.Forms
Type Form2Type Extends Form
Declare Static Sub _CommandButton1_Click(ByRef Sender As Control)
Declare Sub CommandButton1_Click(ByRef Sender As Control)
Declare Static Sub _Form_Click(ByRef Sender As Control)
Declare Sub Form_Click(ByRef Sender As Control)
Declare Constructor
Dim As CommandButton CommandButton1
End Type
Constructor Form2Type
' Form2
With This
.Name = "Form2"
.Text = "Form2"
.FormStyle = FormStyles.fsMDIChild
.Designer = @This
.OnClick = @_Form_Click
.SetBounds 0, 0, 350, 300
End With
' CommandButton1
With CommandButton1
.Name = "CommandButton1"
.Text = "CommandButton1"
.TabIndex = 0
.SetBounds 100, 66, 144, 52
.Designer = @This
.OnClick = @_CommandButton1_Click
.Parent = @This
End With
End Constructor
Private Sub Form2Type._Form_Click(ByRef Sender As Control)
*Cast(Form2Type Ptr, Sender.Designer).Form_Click(Sender)
End Sub
Private Sub Form2Type._CommandButton1_Click(ByRef Sender As Control)
*Cast(Form2Type Ptr, Sender.Designer).CommandButton1_Click(Sender)
End Sub
Dim Shared Form2 As Form2Type
#ifndef _NOT_AUTORUN_FORMS_
#define _NOT_AUTORUN_FORMS_
Form2.Show
App.Run
#endif
'#End Region
#include once "Form3.frm"
Private Sub Form2Type.CommandButton1_Click(ByRef Sender As Control)
Form3.Show Form1
End Sub
Private Sub Form2Type.Form_Click(ByRef Sender As Control)
MsgBox "This is form2"
fForm3->Show Form1
End Sub
Code: Select all
#ifdef __FB_WIN32__
#cmdline "Form1.rc"
#endif
'#Region "Form"
#include once "mff/Form.bi"
Using My.Sys.Forms
Type Form3Type Extends Form
Declare Static Sub _Form_Click(ByRef Sender As Control)
Declare Sub Form_Click(ByRef Sender As Control)
Declare Constructor
End Type
Constructor Form3Type
' Form3
With This
.Name = "Form3"
.Text = "Form3"
.FormStyle = FormStyles.fsMDIChild
.Designer = @This
.OnClick = @_Form_Click
.SetBounds 0, 0, 350, 300
End With
End Constructor
Private Sub Form3Type._Form_Click(ByRef Sender As Control)
*Cast(Form3Type Ptr, Sender.Designer).Form_Click(Sender)
End Sub
Dim Shared Form3 As Form3Type
#ifndef _NOT_AUTORUN_FORMS_
#define _NOT_AUTORUN_FORMS_
Form3.Show
App.Run
#endif
'#End Region
#include once "Form4.frm"
Private Sub Form3Type.Form_Click(ByRef Sender As Control)
fForm4->Show Form1
End Sub
Code: Select all
#ifdef __FB_WIN32__
#cmdline "Form1.rc"
#endif
'#Region "Form"
#include once "mff/Form.bi"
Using My.Sys.Forms
Type Form4Type Extends Form
Declare Constructor
End Type
Constructor Form4Type
' Form4
With This
.Name = "Form4"
.Text = "Form4"
.FormStyle = FormStyles.fsMDIChild
.Designer = @This
.SetBounds 0, 0, 350, 300
End With
End Constructor
Dim Shared Form4 As Form4Type
#ifndef _NOT_AUTORUN_FORMS_
#define _NOT_AUTORUN_FORMS_
Form4.Show
App.Run
#endif
'#End Region