Thanks a lot...
I've downloaded FBX from github,got the WINFBX.chm,at the meanwhile,I found there is another FBX help file(s)(folder) in the all-in-one WinFBE package which I've installed & using to learn FB.I am a bit confused so which one should I learn,or both should be learned?
Besides SDK references(I knew it is core and so important to learn),at this moment I also need some basic guides on how to add code to controls I've added in the form,not saying just a simple & easy Button Click.So I am wondering whether there is such a help document.Or,the SDK includes everything I need to know.
==================================================
Questions & asking help from the exercise:
A form,a Button, a Textbox,when the Button been clicked,the Textbox's text changed,that's all about the app/Form.
The ex03.bas source file contains one line
besides the #includes... and using,
then I found there are other files generated by the IDE,among those frmMain.inc & WinFBE_VD_MAIN.bas attracted me the most.I think I am a bit closer to the whole picture on how a GUI program sources is organized.
But soon I am confused with this line in WINFBE_VD_MAIN.bas,at the bottom of the file,ie.,the last line:
Code: Select all
#include once "E:\Learning\FreeBasic\ex\03\frmMain.inc"
Q1:I am confused because the codes in frmMain.inc are almost exactly the same already exist in WINFBE_VD_MAIN.bas,so why #include frmMain.inc again,doesn't this cause a compiler error?
Q2:Why frmMain_btn1Click has to be a normal procedure rather than type(class) frmMainType's member procedure?
Code: Select all
Declare Function frmMain_btn1_Click( ByRef sender As wfxButton, ByRef e As EventArgs ) As LRESULT
Q3:Why type(class)member function FormInitializeComponent has to have a pointer parameter points to itself?
Code: Select all
declare static function FormInitializeComponent( byval pForm as frmMainType ptr ) as LRESULT
Code: Select all
constructor frmMainType
InitializeComponent = cast( any ptr, @FormInitializeComponent )
this.FormInitializeComponent( @this )
end constructor
Your help would be alway much appreciated.
==========================
Code list below:
1). ex03.bas:
Code: Select all
#Include Once "Afx\AfxFile.inc"
#Include Once "Afx\AfxStr.inc"
#Include Once "Afx\AfxTime.inc"
#Include Once "Afx\CIniFile.inc"
#Include Once "Afx\CMoney.inc"
#Include Once "Afx\CPrint.inc"
' #include once "afx"
#include once "afx\cwstr.inc"
#include once "windows.bi"
using afx
Application.Run(frmMain)
2).frmMain.inc:
Code: Select all
' WINFBE FORM
' WINFBE VERSION 3.0.1
' LOCKCONTROLS=False
' SNAPLINES=True
' WINFBE FORM_START
' WINFBE CONTROL_START Form
' PROPERTIES_START
' PROP_NAME=Name
' PROP_VALUE=frmMain
' PROP_NAME=Left
' PROP_VALUE=10
' PROP_NAME=Top
' PROP_VALUE=10
' PROP_NAME=Width
' PROP_VALUE=500
' PROP_NAME=Height
' PROP_VALUE=300
' PROP_NAME=ChildForm
' PROP_VALUE=False
' PROP_NAME=Text
' PROP_VALUE=Form1
' PROP_NAME=WindowState
' PROP_VALUE=FormWindowState.Normal
' PROP_NAME=StartPosition
' PROP_VALUE=FormStartPosition.Manual
' PROP_NAME=BorderStyle
' PROP_VALUE=FormBorderStyle.Sizable
' PROP_NAME=MinimizeBox
' PROP_VALUE=True
' PROP_NAME=MaximizeBox
' PROP_VALUE=True
' PROP_NAME=ControlBox
' PROP_VALUE=True
' PROP_NAME=Enabled
' PROP_VALUE=True
' PROP_NAME=Visible
' PROP_VALUE=True
' PROP_NAME=BackColor
' PROP_VALUE=SYSTEM|Control
' PROP_NAME=AcceptButton
' PROP_VALUE=
' PROP_NAME=AllowDrop
' PROP_VALUE=False
' PROP_NAME=KeyPreview
' PROP_VALUE=False
' PROP_NAME=CancelButton
' PROP_VALUE=
' PROP_NAME=Icon
' PROP_VALUE=
' PROP_NAME=Locked
' PROP_VALUE=False
' PROP_NAME=MaximumHeight
' PROP_VALUE=0
' PROP_NAME=MaximumWidth
' PROP_VALUE=0
' PROP_NAME=MinimumHeight
' PROP_VALUE=0
' PROP_NAME=MinimumWidth
' PROP_VALUE=0
' PROP_NAME=Tag
' PROP_VALUE=
' PROPERTIES_END
' EVENTS_START
' EVENTS_END
' WINFBE CONTROL_END
' WINFBE CONTROL_START Button
' PROPERTIES_START
' PROP_NAME=Name
' PROP_VALUE=btn1
' PROP_NAME=Left
' PROP_VALUE=230
' PROP_NAME=Top
' PROP_VALUE=163
' PROP_NAME=Width
' PROP_VALUE=116
' PROP_NAME=Height
' PROP_VALUE=33
' PROP_NAME=AllowDrop
' PROP_VALUE=False
' PROP_NAME=BackColor
' PROP_VALUE=SYSTEM|Control
' PROP_NAME=BackColorDown
' PROP_VALUE=SYSTEM|Control
' PROP_NAME=BackColorHot
' PROP_VALUE=SYSTEM|Control
' PROP_NAME=Font
' PROP_VALUE=Segoe UI,9,400,0,0,0,1
' PROP_NAME=TextForeColor
' PROP_VALUE=SYSTEM|ControlText
' PROP_NAME=TextBackColor
' PROP_VALUE=SYSTEM|Control
' PROP_NAME=TextForeColorDown
' PROP_VALUE=SYSTEM|ControlText
' PROP_NAME=TextBackColorDown
' PROP_VALUE=SYSTEM|Control
' PROP_NAME=Image
' PROP_VALUE=
' PROP_NAME=ImageWidth
' PROP_VALUE=16
' PROP_NAME=ImageHeight
' PROP_VALUE=16
' PROP_NAME=ImageMargin
' PROP_VALUE=4
' PROP_NAME=ImageHighDPI
' PROP_VALUE=True
' PROP_NAME=Text
' PROP_VALUE=(&S)显示
' PROP_NAME=TextAlign
' PROP_VALUE=ButtonAlignment.MiddleCenter
' PROP_NAME=TextMargin
' PROP_VALUE=4
' PROP_NAME=UseMnemonic
' PROP_VALUE=True
' PROP_NAME=ThemeSupport
' PROP_VALUE=True
' PROP_NAME=ToggleMode
' PROP_VALUE=False
' PROP_NAME=Enabled
' PROP_VALUE=True
' PROP_NAME=TabIndex
' PROP_VALUE=1
' PROP_NAME=TabStop
' PROP_VALUE=True
' PROP_NAME=Locked
' PROP_VALUE=False
' PROP_NAME=Tag
' PROP_VALUE=
' PROP_NAME=ToolTip
' PROP_VALUE=
' PROP_NAME=ToolTipBalloon
' PROP_VALUE=False
' PROP_NAME=Visible
' PROP_VALUE=True
' PROPERTIES_END
' EVENTS_START
' EVENT_NAME=Click
' EVENTS_END
' WINFBE CONTROL_END
' WINFBE CONTROL_START TextBox
' PROPERTIES_START
' PROP_NAME=Name
' PROP_VALUE=Text1
' PROP_NAME=Left
' PROP_VALUE=124
' PROP_NAME=Top
' PROP_VALUE=98
' PROP_NAME=Width
' PROP_VALUE=289
' PROP_NAME=Height
' PROP_VALUE=40
' PROP_NAME=AcceptsReturn
' PROP_VALUE=False
' PROP_NAME=AcceptsTab
' PROP_VALUE=False
' PROP_NAME=AllowDrop
' PROP_VALUE=False
' PROP_NAME=BackColor
' PROP_VALUE=SYSTEM|Window
' PROP_NAME=BorderStyle
' PROP_VALUE=ControlBorderStyle.Fixed3D
' PROP_NAME=CharacterCasing
' PROP_VALUE=CharacterCase.Normal
' PROP_NAME=CueBannerText
' PROP_VALUE=
' PROP_NAME=Enabled
' PROP_VALUE=True
' PROP_NAME=Font
' PROP_VALUE=Segoe UI,9,400,0,0,0,1
' PROP_NAME=ForeColor
' PROP_VALUE=SYSTEM|WindowText
' PROP_NAME=HideSelection
' PROP_VALUE=True
' PROP_NAME=Locked
' PROP_VALUE=False
' PROP_NAME=Multiline
' PROP_VALUE=False
' PROP_NAME=PasswordChar
' PROP_VALUE=
' PROP_NAME=ReadOnly
' PROP_VALUE=False
' PROP_NAME=TextScrollBars
' PROP_VALUE=ScrollBars.None
' PROP_NAME=TabIndex
' PROP_VALUE=2
' PROP_NAME=TabStop
' PROP_VALUE=True
' PROP_NAME=Tag
' PROP_VALUE=
' PROP_NAME=ToolTip
' PROP_VALUE=
' PROP_NAME=ToolTipBalloon
' PROP_VALUE=False
' PROP_NAME=Text
' PROP_VALUE=Text1
' PROP_NAME=TextAlign
' PROP_VALUE=TextAlignment.Left
' PROP_NAME=Visible
' PROP_VALUE=True
' PROP_NAME=WordWrap
' PROP_VALUE=False
' PROPERTIES_END
' EVENTS_START
' EVENTS_END
' WINFBE CONTROL_END
' WINFBE FORM_END
' WINFBE_CODEGEN_START
#if 0
Declare Function frmMain_btn1_Click( ByRef sender As wfxButton, ByRef e As EventArgs ) As LRESULT
type frmMainType extends wfxForm
private:
temp as byte
public:
declare static function FormInitializeComponent( byval pForm as frmMainType ptr ) as LRESULT
declare constructor
' Controls
btn1 As wfxButton
Text1 As wfxTextBox
end type
function frmMainType.FormInitializeComponent( byval pForm as frmMainType ptr ) as LRESULT
dim as long nClientOffset
pForm->Name = "frmMain"
pForm->Text = "Form1"
pForm->SetBounds(10,10,500,300)
pForm->btn1.Parent = pForm
pForm->btn1.Name = "btn1"
pForm->btn1.Text = "(&S)显示"
pForm->btn1.SetBounds(230,163-nClientOffset,116,33)
pForm->btn1.OnClick = @frmMain_btn1_Click
pForm->Text1.Parent = pForm
pForm->Text1.Name = "Text1"
pForm->Text1.Text = "Text1"
pForm->Text1.SetBounds(124,98-nClientOffset,289,40)
pForm->Controls.Add(ControlType.Button, @(pForm->btn1))
pForm->Controls.Add(ControlType.TextBox, @(pForm->Text1))
Application.Forms.Add(ControlType.Form, pForm)
function = 0
end function
constructor frmMainType
InitializeComponent = cast( any ptr, @FormInitializeComponent )
this.FormInitializeComponent( @this )
end constructor
dim shared frmMain as frmMainType
#endif
' WINFBE_CODEGEN_END
' frmMain form code file
''
''
Function frmMain_btn1_Click( ByRef sender As wfxButton, ByRef e As EventArgs ) As LRESULT
MessageBox(null,"FreeBasic 很好很强大!","你好!",MB_OK or MB_ICONINFORMATION)
'MessageBox(null, "Hello World", "FreeBASIC", MB_OK)
frmmain.text1.text="文本框字体改变啦~~~"
Function = 0
End Function
3). WINFBE_VD_MAIN.bas:
Code: Select all
#Define UNICODE
#Define _WIN32_WINNT &h0602
#Include Once "windows.bi"
#Include Once "Afx\CWindow.inc"
#define CODEGEN_FORM
#define CODEGEN_BUTTON
#define CODEGEN_TEXTBOX
#Include once "WinFormsX\WinFormsX.bi"
Using Afx
' WINFBE_CODEGEN_START
Declare Function frmMain_Button1_Click( ByRef sender As wfxButton, ByRef e As EventArgs ) As LRESULT
type frmMainType extends wfxForm
private:
temp as byte
public:
declare static function FormInitializeComponent( byval pForm as frmMainType ptr ) as LRESULT
declare constructor
' Controls
Button1 As wfxButton
Text1 As wfxTextBox
end type
function frmMainType.FormInitializeComponent( byval pForm as frmMainType ptr ) as LRESULT
dim as long nClientOffset
pForm->Name = "frmMain"
pForm->Text = "Form1"
pForm->SetBounds(10,10,500,300)
pForm->Button1.Parent = pForm
pForm->Button1.Name = "Button1"
pForm->Button1.Text = "(&S)显示"
pForm->Button1.SetBounds(315,185-nClientOffset,105,30)
pForm->Button1.OnClick = @frmMain_Button1_Click
pForm->Text1.Parent = pForm
pForm->Text1.Name = "Text1"
pForm->Text1.Text = "Text1"
pForm->Text1.SetBounds(114,101-nClientOffset,264,26)
pForm->Controls.Add(ControlType.Button, @(pForm->Button1))
pForm->Controls.Add(ControlType.TextBox, @(pForm->Text1))
Application.Forms.Add(ControlType.Form, pForm)
function = 0
end function
constructor frmMainType
InitializeComponent = cast( any ptr, @FormInitializeComponent )
this.FormInitializeComponent( @this )
end constructor
dim shared frmMain as frmMainType
' WINFBE_CODEGEN_END
' ========================================================================================
' WinFBE - FreeBASIC Editor (Windows 32/64 bit)
' Visual Designer auto generated project
' ========================================================================================
' Main application entry point.
' Place any additional global variables or #include files here.
' For your convenience, below are some of the most commonly used WinFBX library
' include files. Uncomment the files that you wish to use in the project or add
' additional ones. Refer to the WinFBX Framework Help documentation for information
' on how to use the various functions.
' #Include Once "Afx\AfxFile.inc"
' #Include Once "Afx\AfxStr.inc"
' #Include Once "Afx\AfxTime.inc"
' #Include Once "Afx\CIniFile.inc"
' #Include Once "Afx\CMoney.inc"
' #Include Once "Afx\CPrint.inc"
Application.Run(frmMain)
#include once "E:\Learning\FreeBasic\ex\03\frmMain.inc"
Best Regards,
Peter