MyFbFramework - My FreeBasic Framework
-
- Posts: 789
- Joined: Jul 26, 2018 18:28
MyFbFramework - My FreeBasic Framework
At the suggestion of oyster, I created this topic. The continuation of this VisualFBEditor topic in terms of MyFbFramework: https://freebasic.net/forum/viewtopic.p ... 4&start=90
In Github MyFbFramework there is: https://github.com/XusinboyBekchanov/MyFbFramework
In Github MyFbFramework there is: https://github.com/XusinboyBekchanov/MyFbFramework
Re: MyFbFramework - My FreeBasic Framework
Code: Select all
'#Compile -exx "Form1.rc"
#include once "C:\XUSI\MyFbFramework-1.2.2\mff\Form.bi"
#Include "C:\XUSI\MyFbFramework-1.2.2\mff\CommandButton.bi"
Using My.Sys.Forms
Type Form1 Extends Form
Declare Static Sub Form_Paint(ByRef Sender As Form, DC As HDC, R As Rect)
Declare Constructor
End Type
Constructor Form1
' Form1
With This
.Name = "Form1"
.Text = "Form1"
.OnPaint = @Form_Paint
.SetBounds 0, 0, 350, 300
End With
End Constructor
Dim Shared As Form1 fForm1
Dim Shared As CommandButton cmd1
Sub cmd_Click1(ByRef Sender As Control)
fForm1.Canvas.Ellipse 150, 100, 270, 250
End Sub
Private Sub Form1.Form_Paint(ByRef Sender As Form, DC As HDC, R As Rect)
fForm1.Canvas.Line 315, 315, 25, 40
fForm1.Canvas.MoveTo 145, 245: fForm1.Canvas.LineTo 145, 145
fForm1.Canvas.LineTo 45, 125
fForm1.Canvas.Rectangle 750, 10, 870, 150
fForm1.Canvas.TextOut 160, 160, "Hello World", 0, -1
End Sub
#ifndef _NOT_AUTORUN_FORMS_
cmd1.Text = "Draw Ellipse"
cmd1.SetBounds 10, 10, 150, 30
cmd1.OnClick = @cmd_Click1
fForm1.Add @cmd1
fForm1.SetBounds 0, 0, 1000, 700
fForm1.Center
fForm1.Show
App.Run
#endif
Re: MyFbFramework - My FreeBasic Framework
Code: Select all
#Include "C:\XUSI\MyFbFramework-1.2.2\mff\Form.bi"
#Include "C:\XUSI\MyFbFramework-1.2.2\mff\CommandButton.bi"
#Include "C:\XUSI\MyFbFramework-1.2.2\mff\CheckBox.bi"
#Include "C:\XUSI\MyFbFramework-1.2.2\mff\ListControl.bi"
#Include "C:\XUSI\MyFbFramework-1.2.2\mff\TextBox.bi"
Using My.Sys.Forms
Dim Shared frm As Form
Dim As CommandButton cmd, cmd2, cmd3
Dim Shared As TextBox tb1
Dim Shared As CheckBox cb1, cb2
Dim Shared as ListControl lc1
Sub cmd_Click1(ByRef Sender As Control)
lc1.AddItem("Italy")
lc1.AddItem("Austria")
lc1.AddItem("Slovenia")
print lc1.ItemCount
print lc1.Text
End Sub
Sub cmd_Click2(ByRef Sender As Control)
print "aa"
print cb1.checked
End Sub
Sub cmd_Click3(ByRef Sender As Control)
print tb1.Text
End Sub
cmd.Text = "Test ListBox"
cmd.SetBounds 10, 10, 150, 30
cmd.OnClick = @cmd_Click1
frm.Add @cmd
lc1.SetBounds 10, 50, 150, 500
frm.Add @lc1
cmd2.Text = "Test CheckBox"
cmd2.SetBounds 200, 10, 150, 30
cmd2.OnClick = @cmd_Click2
frm.Add @cmd2
cmd3.Text = "Test TextBox"
cmd3.SetBounds 400, 10, 150, 30
cmd3.OnClick = @cmd_Click3
frm.Add @cmd3
tb1.SetBounds 400, 50, 150, 30
tb1.Text = "7.77"
frm.Add @tb1
cb1.Text = "Apples"
cb1.SetBounds 200, 50, 150, 30
frm.Add @cb1
cb2.Text = "Banannas"
cb2.SetBounds 200, 100, 150, 30
frm.Add @cb2
frm.SetBounds 0, 0, 1000, 700
frm.Center
frm.Show
App.Run
-
- Posts: 789
- Joined: Jul 26, 2018 18:28
Re: MyFbFramework - My FreeBasic Framework
Updated to version 1.2.3 (May 18, 2020)
- Added: UString
- Added: FontDialog (in Linux)
- Added: ColorDialog (in Linux)
- Added: TAB and SHIFT+TAB support
and others.
- Added: UString
- Added: FontDialog (in Linux)
- Added: ColorDialog (in Linux)
- Added: TAB and SHIFT+TAB support
and others.
-
- Posts: 789
- Joined: Jul 26, 2018 18:28
Re: MyFbFramework - My FreeBasic Framework
Updated to version 1.2.4 (May 24, 2020)
- Added: Canvas Example (in Windows and Linux)
- Added: Canvas Support (in Linux)
- Added: FullTypeName function in Object type (Thanks to fxm)
- Fixed: ComboBoxEx Text property (in Linux)
- Fixed: ShowModal (in gtk2)
- Fixed: Scroll in widgets without native scrolling capabilities (in gtk2)
- Fixed: TimerComponent properties (in ReadProperty and WriteProperty function)
- Added: Canvas Example (in Windows and Linux)
- Added: Canvas Support (in Linux)
- Added: FullTypeName function in Object type (Thanks to fxm)
- Fixed: ComboBoxEx Text property (in Linux)
- Fixed: ShowModal (in gtk2)
- Fixed: Scroll in widgets without native scrolling capabilities (in gtk2)
- Fixed: TimerComponent properties (in ReadProperty and WriteProperty function)
-
- Posts: 789
- Joined: Jul 26, 2018 18:28
Re: MyFbFramework - My FreeBasic Framework
Updated to new version:
Version 1.2.5 (August 2, 2020)
- Added: ActivateApp And DeActivateApp events to Form
- Added: KeyRemove Function in IniFile
- Added: TreeView events: OnSelChanging, OnNodeExpanding, OnNodeExpanded
- Added: TreeNode.Bold property
- Fixed: TreeNode.ImageKey and TreeNode.SelectedImageKey properties
- Fixed: TabControl in Windows Classic Theme
- Fixed: StatusBar functionality on 64-bit Windows
- Fixed: OpenFileDialog and SaveFileDialog Filter property
- Fixed: Deleted Menu update on Enable menu item
- Fixed: ComboBoxEdit Esc and Return key events
- Fixed: PageSetupDialog and PrintDialog execute crash
- Fixed: HotKey.Text property
- Fixed: Delete objects, clear lists and etc.
- Fixed: TimerComponent OnTimer event
Version 1.2.5 (August 2, 2020)
- Added: ActivateApp And DeActivateApp events to Form
- Added: KeyRemove Function in IniFile
- Added: TreeView events: OnSelChanging, OnNodeExpanding, OnNodeExpanded
- Added: TreeNode.Bold property
- Fixed: TreeNode.ImageKey and TreeNode.SelectedImageKey properties
- Fixed: TabControl in Windows Classic Theme
- Fixed: StatusBar functionality on 64-bit Windows
- Fixed: OpenFileDialog and SaveFileDialog Filter property
- Fixed: Deleted Menu update on Enable menu item
- Fixed: ComboBoxEdit Esc and Return key events
- Fixed: PageSetupDialog and PrintDialog execute crash
- Fixed: HotKey.Text property
- Fixed: Delete objects, clear lists and etc.
- Fixed: TimerComponent OnTimer event
-
- Posts: 507
- Joined: Jan 13, 2009 19:23
Re: MyFbFramework - My FreeBasic Framework
a suggestion
you have to make some virtual functions in Form class, here is an example :
you have to make some virtual functions in Form class, here is an example :
Code: Select all
type Form
...
Declare virtual Sub Form_MouseUp (ByRef sender As OBJECT,MouseButton As Integer,Shift As Integer,x As Integer,y As Integer)
end type
Sub Form.Form_MouseUp(ByRef sender As OBJECT,MouseButton As Integer,Shift As Integer,x As Integer,y As Integer)
If OnMouseUp Then OnMouseUp(sender,MouseButton,Shift ,x ,y)
End Sub
in the wndproc:
Case WM_LBUTTONUP
'If onClick Then onClick(This)
Form_MouseUp(This,leftbutton,wParam AND &HFFFF,Loword(lparam),Hiword(lparam))
Case WM_.......
-
- Posts: 789
- Joined: Jul 26, 2018 18:28
Re: MyFbFramework - My FreeBasic Framework
The ProcessMessage procedure is a virtual method. All events can be regulated from here. It is more convenient than for each event a separate function:
Code: Select all
Type Control Extends Component
...
Declare Virtual Sub ProcessMessage(ByRef message As Message)
...
End Type
-
- Posts: 507
- Joined: Jan 13, 2009 19:23
Re: MyFbFramework - My FreeBasic Framework
I'm not asking to change processmessage.
the advantage is this:
the advantage is this:
Code: Select all
#Include Once "../guis.1.0.bi"
Type CFlexGridCombo extends CFORM
public:
Declare Constructor
Declare Destructor
As CComboBox m_cCombo
As CFlexGrid m_FlexGrid
Declare Static Sub Combo1_SelChange(BYREF Sender As object)
Declare Static Sub FlexGrid_MouseDown(ByRef sender As object,MouseButton As Integer,Shift As Integer,x As Integer,y As Integer)
Private:
Declare Sub Form_Click(BYREF Sender As object) ' instead of Declare Static
Declare Sub Form_load(BYREF Sender As object) ' instead of Declare Static
End Type
Dim Shared Form1 As CFlexGridCombo
Sub CFlexGridCombo.Form_Click(BYREF Sender As object)
If m_cCombo.visible Then m_cCombo.visible=FALSE
End Sub
Sub CFlexGridCombo.Form_load(BYREF Sender As object)
m_FlexGrid.Cols = 5 ' nombre total de colonnes
m_FlexGrid.Rows = 9
For i As Integer=0 To m_FlexGrid.FixedRows -1
m_FlexGrid.RowHeight(i) = 40
Next
m_FlexGrid.ColWidth(0)= 100
m_FlexGrid.ColWidth(1)= 100
m_FlexGrid.ColWidth(2)= 100
end sub
' instead of :
Form1.OnClick =@ Form_Click
Sub CFlexGridCombo.Form_Click(BYREF Sender As object)
If Form1.m_cCombo.visible Then Form1.m_cCombo.visible=FALSE
End Sub
'but you can still use the latter form of code
This only concerns Form callbacks not othres controls callbacks
-
- Posts: 789
- Joined: Jul 26, 2018 18:28
Re: MyFbFramework - My FreeBasic Framework
Thank you.
Now the events of the form and other controls will be different.
I'll see.
Now the events of the form and other controls will be different.
I'll see.
-
- Posts: 507
- Joined: Jan 13, 2009 19:23
Re: MyFbFramework - My FreeBasic Framework
Yes for form or usercontrol( if you implement this) but not for other controls I thinkXusinboy Bekchanov wrote:Thank you.
Now the events of the form and other controls will be different.
I'll see.
I repeat it even for the forms, the old style events will always be supported.
-
- Posts: 789
- Joined: Jul 26, 2018 18:28
Re: MyFbFramework - My FreeBasic Framework
Over time, we will make UserControl too.aloberoger wrote:Yes for form or usercontrol( if you implement this) but not for other controls I think
-
- Posts: 789
- Joined: Jul 26, 2018 18:28
Re: MyFbFramework - My FreeBasic Framework
I load new version:
Version 1.2.6 (December 14, 2020)
- Added: UserControl type
- Changed: KeyExists function to Public
- Added: Designer property to My.Sys.Object
- Added: DraggedNode function to TreeView
- Added: FBMemCheck.bi to check memory leaks
- Fixed: MemLeaks
- Fixed: ListView View property
- Fixed: SaveFileDialog FilterIndex function
- Fixed: Text Property of Control
Version 1.2.6 (December 14, 2020)
- Added: UserControl type
- Changed: KeyExists function to Public
- Added: Designer property to My.Sys.Object
- Added: DraggedNode function to TreeView
- Added: FBMemCheck.bi to check memory leaks
- Fixed: MemLeaks
- Fixed: ListView View property
- Fixed: SaveFileDialog FilterIndex function
- Fixed: Text Property of Control
-
- Posts: 789
- Joined: Jul 26, 2018 18:28
Re: MyFbFramework - My FreeBasic Framework
I did it differently. It is now possible to create non-static event handlersaloberoger wrote:Yes for form or usercontrol( if you implement this) but not for other controls I thinkXusinboy Bekchanov wrote:Thank you.
Now the events of the form and other controls will be different.
I'll see.
I repeat it even for the forms, the old style events will always be supported.
-
- Posts: 789
- Joined: Jul 26, 2018 18:28
Re: MyFbFramework - My FreeBasic Framework
New version:
Version 1.2.7 (March 6, 2021)
- Added: __USE_WEBKITGTK__ definition
- Added: Chart control
- Added: MouseHover event to Control
- Fixed: GTK window move on Windows
- Added: TimerComponent on Linux
- Fixed: RichTextBox crash
- Fixed: ReadOnly property of RichTextBox in Design Mode
- Improved: Replace function
- Fixed: GTK critical warning messages
- Fixed: MenuItem.Clear
- Added: OnMessage event to Control
- Added: Set ListView.ImageIndex And ImageKey
- Fixed: ComboBoxEdit in Designer on Linux not Disabled
- Fixed: Icons are now visible in Linux if the path to the editor is in Unicode
- Fixed: Open and Close files
- Fixed: GroupBox paint
- Fixed: Font size
- Fixed: Menu item icons draws without background
- Added: Alignment property to controls Label, TextBox, CheckBox, RadioButton
- Fixed: SetFocus with UI state
- Added: TabIndex to Controls
- Fixed: Type changing in SaveFileDialog
Version 1.2.7 (March 6, 2021)
- Added: __USE_WEBKITGTK__ definition
- Added: Chart control
- Added: MouseHover event to Control
- Fixed: GTK window move on Windows
- Added: TimerComponent on Linux
- Fixed: RichTextBox crash
- Fixed: ReadOnly property of RichTextBox in Design Mode
- Improved: Replace function
- Fixed: GTK critical warning messages
- Fixed: MenuItem.Clear
- Added: OnMessage event to Control
- Added: Set ListView.ImageIndex And ImageKey
- Fixed: ComboBoxEdit in Designer on Linux not Disabled
- Fixed: Icons are now visible in Linux if the path to the editor is in Unicode
- Fixed: Open and Close files
- Fixed: GroupBox paint
- Fixed: Font size
- Fixed: Menu item icons draws without background
- Added: Alignment property to controls Label, TextBox, CheckBox, RadioButton
- Fixed: SetFocus with UI state
- Added: TabIndex to Controls
- Fixed: Type changing in SaveFileDialog