MyFbFramework - My FreeBasic Framework

User projects written in or related to FreeBASIC.
Xusinboy Bekchanov
Posts: 254
Joined: Jul 26, 2018 18:28

MyFbFramework - My FreeBasic Framework

Postby Xusinboy Bekchanov » Mar 16, 2020 10:51

At the suggestion of oyster, I created this topic. The continuation of this VisualFBEditor topic in terms of MyFbFramework: https://freebasic.net/forum/viewtopic.php?f=8&t=27284&start=90

In Github MyFbFramework there is: https://github.com/XusinboyBekchanov/MyFbFramework
ike
Posts: 387
Joined: Jan 17, 2011 18:59

Re: MyFbFramework - My FreeBasic Framework

Postby ike » Mar 16, 2020 15:58

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



ike
Posts: 387
Joined: Jan 17, 2011 18:59

Re: MyFbFramework - My FreeBasic Framework

Postby ike » Mar 16, 2020 15:59

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



Xusinboy Bekchanov
Posts: 254
Joined: Jul 26, 2018 18:28

Re: MyFbFramework - My FreeBasic Framework

Postby Xusinboy Bekchanov » May 17, 2020 19:33

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.
Xusinboy Bekchanov
Posts: 254
Joined: Jul 26, 2018 18:28

Re: MyFbFramework - My FreeBasic Framework

Postby Xusinboy Bekchanov » May 24, 2020 12:30

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)
Xusinboy Bekchanov
Posts: 254
Joined: Jul 26, 2018 18:28

Re: MyFbFramework - My FreeBasic Framework

Postby Xusinboy Bekchanov » Aug 02, 2020 17:21

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
aloberoger
Posts: 495
Joined: Jan 13, 2009 19:23

Re: MyFbFramework - My FreeBasic Framework

Postby aloberoger » Aug 07, 2020 16:24

a suggestion
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_.......
Xusinboy Bekchanov
Posts: 254
Joined: Jul 26, 2018 18:28

Re: MyFbFramework - My FreeBasic Framework

Postby Xusinboy Bekchanov » Aug 08, 2020 3:41

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
aloberoger
Posts: 495
Joined: Jan 13, 2009 19:23

Re: MyFbFramework - My FreeBasic Framework

Postby aloberoger » Aug 08, 2020 19:50

I'm not asking to change processmessage.
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
 
Xusinboy Bekchanov
Posts: 254
Joined: Jul 26, 2018 18:28

Re: MyFbFramework - My FreeBasic Framework

Postby Xusinboy Bekchanov » Aug 10, 2020 3:05

Thank you.
Now the events of the form and other controls will be different.
I'll see.
aloberoger
Posts: 495
Joined: Jan 13, 2009 19:23

Re: MyFbFramework - My FreeBasic Framework

Postby aloberoger » Aug 10, 2020 9:00

Xusinboy Bekchanov wrote:Thank you.
Now the events of the form and other controls will be different.
I'll see.


Yes for form or usercontrol( if you implement this) but not for other controls I think

I repeat it even for the forms, the old style events will always be supported.
Xusinboy Bekchanov
Posts: 254
Joined: Jul 26, 2018 18:28

Re: MyFbFramework - My FreeBasic Framework

Postby Xusinboy Bekchanov » Aug 18, 2020 5:34

aloberoger wrote:Yes for form or usercontrol( if you implement this) but not for other controls I think

Over time, we will make UserControl too.

Return to “Projects”

Who is online

Users browsing this forum: No registered users and 5 guests