VisualFBEditor - IDE for FreeBasic

User projects written in or related to FreeBASIC.
Post Reply
UEZ
Posts: 999
Joined: May 05, 2017 19:59
Location: Germany

Re: VisualFBEditor - IDE for FreeBasic

Post by UEZ »

Thank you very much for your quick support. :)
Xusinboy Bekchanov
Posts: 806
Joined: Jul 26, 2018 18:28

Re: VisualFBEditor - IDE for FreeBasic

Post by Xusinboy Bekchanov »

UEZ wrote: Mar 11, 2024 12:44 Thank you very much for your quick support. :)
You're welcome.
PeterHu
Posts: 161
Joined: Jul 24, 2022 4:57

Re: VisualFBEditor - IDE for FreeBasic

Post by PeterHu »

May I ask is there any barcode related component/example in mff or VisualFBEditor?
Xusinboy Bekchanov
Posts: 806
Joined: Jul 26, 2018 18:28

Re: VisualFBEditor - IDE for FreeBasic

Post by Xusinboy Bekchanov »

PeterHu wrote: Apr 24, 2024 4:57 May I ask is there any barcode related component/example in mff or VisualFBEditor?
Here is an example barcode:

Code: Select all

'#Region "Form"
	#if defined(__FB_MAIN__) AndAlso Not defined(__MAIN_FILE__)
		#define __MAIN_FILE__
		#ifdef __FB_WIN32__
			#cmdline "Form1.rc"
		#endif
		Const _MAIN_FILE_ = __FILE__
	#endif
	#include once "mff/Form.bi"
	
	Using My.Sys.Forms
	
	Type Form1Type Extends Form
		Declare Sub Form_Paint(ByRef Sender As Control, ByRef Canvas As My.Sys.Drawing.Canvas)
		Declare Constructor
		
	End Type
	
	Constructor Form1Type
		#if _MAIN_FILE_ = __FILE__
			With App
				.CurLanguagePath = ExePath & "/Languages/"
				.CurLanguage = .Language
			End With
		#endif
		' Form1
		With This
			.Name = "Form1"
			.Text = "Form1"
			.Designer = @This
			.OnPaint = Cast(Sub(ByRef Designer As My.Sys.Object, ByRef Sender As Control, ByRef Canvas As My.Sys.Drawing.Canvas), @Form_Paint)
			.SetBounds 0, 0, 799, 599
		End With
	End Constructor
	
	Dim Shared Form1 As Form1Type
	
	#if _MAIN_FILE_ = __FILE__
		App.DarkMode = False
		Form1.MainForm = True
		Form1.Show
		App.Run
	#endif
'#End Region

Sub fb_barcode(ByRef Canvas As My.Sys.Drawing.Canvas, x_pos As Integer, y_pos As Integer, txt As String, img_h As Integer, col As ULong, mult As Integer)
	Dim As String char(0 To 44) = {" ","$","%","*","+","-",".","/", _
								   "0","1","2","3","4","5","6","7","8","9", _
								   "A","B","C","D","E","F","G","H","I","J","K","L","M", _
								   "N","O","P","Q","R","S","T","U","V","W","X","Y","Z","_"}
	Dim As UByte bars_data(0 To 44, 0 To 15) = {{1,0,0,0,1,1,1,0,1,0,1,1,1,0,1,0}, _
												{1,0,0,0,1,0,0,0,1,0,0,0,1,0,1,0}, _
												{1,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0}, _
												{1,0,0,0,1,0,1,1,1,0,1,1,1,0,1,0}, _
												{1,0,0,0,1,0,1,0,0,0,1,0,0,0,1,0}, _
												{1,0,0,0,1,0,1,0,1,1,1,0,1,1,1,0}, _
												{1,1,1,0,0,0,1,0,1,0,1,1,1,0,1,0}, _
												{1,0,0,0,1,0,0,0,1,0,1,0,0,0,1,0}, _
												{1,0,1,0,0,0,1,1,1,0,1,1,1,0,1,0}, _
												{1,1,1,0,1,0,0,0,1,0,1,0,1,1,1,0}, _
												{1,0,1,1,1,0,0,0,1,0,1,0,1,1,1,0}, _
												{1,1,1,0,1,1,1,0,0,0,1,0,1,0,1,0}, _
												{1,0,1,0,0,0,1,1,1,0,1,0,1,1,1,0}, _
												{1,1,1,0,1,0,0,0,1,1,1,0,1,0,1,0}, _
												{1,0,1,1,1,0,0,0,1,1,1,0,1,0,1,0}, _
												{1,0,1,0,0,0,1,0,1,1,1,0,1,1,1,0}, _
												{1,1,1,0,1,0,0,0,1,0,1,1,1,0,1,0}, _
												{1,0,1,1,1,0,0,0,1,0,1,1,1,0,1,0}, _
												{1,1,1,0,1,0,1,0,0,0,1,0,1,1,1,0}, _
												{1,0,1,1,1,0,1,0,0,0,1,0,1,1,1,0}, _
												{1,1,1,0,1,1,1,0,1,0,0,0,1,0,1,0}, _
												{1,0,1,0,1,1,1,0,0,0,1,0,1,1,1,0}, _
												{1,1,1,0,1,0,1,1,1,0,0,0,1,0,1,0}, _
												{1,0,1,1,1,0,1,1,1,0,0,0,1,0,1,0}, _
												{1,0,1,0,1,0,0,0,1,1,1,0,1,1,1,0}, _
												{1,1,1,0,1,0,1,0,0,0,1,1,1,0,1,0}, _
												{1,0,1,1,1,0,1,0,0,0,1,1,1,0,1,0}, _
												{1,0,1,0,1,1,1,0,0,0,1,1,1,0,1,0}, _
												{1,1,1,0,1,0,1,0,1,0,0,0,1,1,1,0}, _
												{1,0,1,1,1,0,1,0,1,0,0,0,1,1,1,0}, _
												{1,1,1,0,1,1,1,0,1,0,1,0,0,0,1,0}, _
												{1,0,1,0,1,1,1,0,1,0,0,0,1,1,1,0}, _
												{1,1,1,0,1,0,1,1,1,0,1,0,0,0,1,0}, _
												{1,0,1,1,1,0,1,1,1,0,1,0,0,0,1,0}, _
												{1,0,1,0,1,0,0,1,1,0,0,0,1,1,1,0}, _
												{1,1,1,0,1,0,1,0,1,1,1,0,0,0,1,0}, _
												{1,0,1,1,1,0,1,0,1,1,1,0,0,0,1,0}, _
												{1,0,1,0,1,1,1,0,1,1,1,0,0,0,1,0}, _
												{1,1,1,0,0,0,1,0,1,0,1,0,1,1,1,0}, _
												{1,0,0,0,1,1,1,0,1,0,1,0,1,1,1,0}, _
												{1,1,1,0,0,0,1,1,1,0,1,0,1,0,1,0}, _
												{1,0,0,0,1,0,1,1,1,0,1,0,1,1,1,0}, _
												{1,1,1,0,0,0,1,0,1,1,1,0,1,0,1,0}, _
												{1,0,0,0,1,1,1,0,1,1,1,0,1,0,1,0}, _
												{1,0,0,0,1,1,1,0,1,0,1,1,1,0,1,0}}
	Dim As Integer i, j, x, y, z, img_w = (16 * mult)
	Dim As String txt_str = "*" + UCase(txt) + "*"
	
	If mult < 1 Then
		mult = 1
	End If
	img_h *= mult
	
	For y = 1 To Len(txt_str)
		For x = 0 To 44
			If char(x) = Mid(txt_str, y, 1) Then
				If mult > 1 Then
					j = 0
					For z = 0 To 15
						If bars_data(x, z) = 1 Then
							For i = 1 To mult
								Canvas.Line x_pos + ((y - 1) * img_w) + (z + j), y_pos + 0, x_pos + ((y - 1) * img_w) + z + j, y_pos + img_h - 1, col
								j += 1
							Next i
							j -= 1
						Else
							j += (mult - 1)
						End If
					Next z
				Else
					For z = 0 To 15
						If bars_data(x, z) = 1 Then
							Canvas.Line x_pos + ((y - 1) * img_w) + (z + j), y_pos + 0, x_pos + ((y - 1) * img_w) + z + j, y_pos + img_h - 1, col
						End If
					Next z
				End If
			End If
		Next x
	Next y
End Sub

Private Sub Form1Type.Form_Paint(ByRef Sender As Control, ByRef Canvas As My.Sys.Drawing.Canvas)
	fb_barcode(Canvas, 10, 10, "freebasic", 34, BGR(0, 0, 0), 1)
	fb_barcode(Canvas, 10, 60, "freebasic", 34, BGR(0, 0, 0), 2)
	fb_barcode(Canvas, 10, 155, "freebasic", 34, BGR(0, 0, 0), 3)
	fb_barcode(Canvas, 10, 280, "freebasic", 34, BGR(0, 0, 0), 4)
End Sub
Avata
Posts: 107
Joined: Jan 17, 2021 7:27

Re: VisualFBEditor - IDE for FreeBasic

Post by Avata »

Here are the URLs of some commonly used barcode recognition libraries.

ZBar:https://github.com/mchehab/zbar

ZXing:https://github.com/zxing/zxing
Xusinboy Bekchanov
Posts: 806
Joined: Jul 26, 2018 18:28

Re: VisualFBEditor - IDE for FreeBasic

Post by Xusinboy Bekchanov »

This topic also has a barcode reader:
https://freebasic.net/forum/viewtopic.php?p=171446
PeterHu
Posts: 161
Joined: Jul 24, 2022 4:57

Re: VisualFBEditor - IDE for FreeBasic

Post by PeterHu »

Thank you both very much!
PeterHu
Posts: 161
Joined: Jul 24, 2022 4:57

Re: VisualFBEditor - IDE for FreeBasic

Post by PeterHu »

Just noticed VFBeditor has a 'use->wasm' option,may I also ask is there a simple example to learn wasm in FreeBasic?Thanks again.
Xusinboy Bekchanov
Posts: 806
Joined: Jul 26, 2018 18:28

Re: VisualFBEditor - IDE for FreeBasic

Post by Xusinboy Bekchanov »

PeterHu wrote: Apr 28, 2024 2:31 Just noticed VFBeditor has a 'use->wasm' option,may I also ask is there a simple example to learn wasm in FreeBasic?Thanks again.
You can look at this example:
https://github.com/XusinboyBekchanov/Vi ... ebPage.frm
PeterHu
Posts: 161
Joined: Jul 24, 2022 4:57

Re: VisualFBEditor - IDE for FreeBasic

Post by PeterHu »

Xusinboy Bekchanov wrote: Apr 28, 2024 6:26
PeterHu wrote: Apr 28, 2024 2:31 Just noticed VFBeditor has a 'use->wasm' option,may I also ask is there a simple example to learn wasm in FreeBasic?Thanks again.
You can look at this example:
https://github.com/XusinboyBekchanov/Vi ... ebPage.frm
Thank you for the information!
xiaoyao
Posts: 138
Joined: May 05, 2020 2:01

Re: VisualFBEditor - IDE for FreeBasic

Post by xiaoyao »

New feature suggestions and BUG feedback:
1. If the code is moved, there will be an extra TAB symbol and it cannot be compiled.
I moved the process from the bottom to the top, and the compilation failed. It prompted that the compilation was completed and the process could not be created.
2. The control properties should add a default value
TextBox2.Text="2"
TextBox2. = 2 'Wrong
TextBox2.Text = 2 'Wrong
3. The default form.load event could not be found. I used Form_Create instead.
It is best to add: other events in the right-click menu of an event code
4. The text in the default color is not clear, especially the TAB symbol.
Select theme color: night-owl
5. The default display of the form should be in the center of the screen.
startPosition=1
6. Options》Code Editor? Treat tabs as spaces, select "Anywhere"
7. When F5 compiles, it prompts whether to forcefully end the last opened process.
8. A forum link for this IDE project should be added to the help in item 3 of the menu.
https://www.freebasic.net/forum/viewtopic.php?t=27284
9. When the project is opened, the status of the last compilation should be automatically displayed, such as which form is displayed and which code page is opened.
10. Double-click the form tab (file name Form1.frm) to switch between code and form, which is much more convenient.
11. The code in the module cannot be used, what should I do? It crashes after adding another module
12. Reopen the IDE and cannot see the recently used projects.
Now there are a few steps: switch tabs>recently opened>projects>, it’s too troublesome
13. How to prevent the IDE navigation title from displaying the complete path and only displaying the project name
14. There is no need to put the link to the GITHUB homepage in the help menu, only https://github.com/freebasic/fbc
15. If you choose the LINUX version of the compiler, you can automatically download the relevant compiler plug-in, making automatic compilation more convenient.
For example, the default is 32-bit, 64-bit, and 32-bit LINUX. There are 4 options for compiling into 64-bit Linux. Whichever one you choose will be automatically compiled into the corresponding program.
xiaoyao
Posts: 138
Joined: May 05, 2020 2:01

Re: VisualFBEditor - IDE for FreeBasic

Post by xiaoyao »

16. Double-click '#End Region, it is best to automatically collapse the header project-related attribute code
17. If the button event code in the form is manually deleted, compilation errors will occur. It is best to automatically remove the relevant event binding code.
--------------------------
Declare Sub CommandButton3_Click(ByRef Sender As Control)
'CommandButton3
With CommandButton3
.OnClick = Cast(Sub(ByRef Designer As My.Sys.Object, ByRef Sender As Control), @CommandButton3_Click)

End With
Private Sub Form1Type.CommandButton3_Click(ByRef Sender As Control)

End Sub
--------------------------
ld.exe: Form1.o:fake:(.text+0x1c0f): undefined reference to `FORM1TYPE::COMMANDBUTTON3_CLICK(MY::SYS::FORMS::CONTROL&)@8'

17:27:44: Found errors (1).
17:27:44: No generated files. Time taken: 2.54 seconds
===================
18. The project file uses forms or modules external to other projects. The path cannot be seen in the IDE. It can only be opened with Notepad software to view or modify.
When the mouse moves over the form file name of the project tree control, if it is outside the project, the corresponding path will be automatically displayed.
If it is a form in a subdirectory, it can be displayed: Form1.frm(\Folder2)
19. Select the UI mode as GTK4, and the result is wrong.

compiler\bin\win32\ld.exe: cannot find -lglib-2.0: No such file or directory
compiler\bin\win32\ld.exe: cannot find -lgthread-2.0: No such file or directory

20. Project templates should be added: GTK ui interface project, WINDOWS form program project
Xusinboy Bekchanov
Posts: 806
Joined: Jul 26, 2018 18:28

Re: VisualFBEditor - IDE for FreeBasic

Post by Xusinboy Bekchanov »

xiaoyao wrote: Jun 08, 2024 9:17 New feature suggestions and BUG feedback:
1. If the code is moved, there will be an extra TAB symbol and it cannot be compiled.
Tabs compile without problems.
xiaoyao wrote: Jun 08, 2024 9:17 I moved the process from the bottom to the top, and the compilation failed. It prompted that the compilation was completed and the process could not be created.
Have you set a priority for the process?
xiaoyao wrote: Jun 08, 2024 9:17 2. The control properties should add a default value
TextBox2.Text="2"
TextBox2. = 2 'Wrong
TextBox2.Text = 2 'Wrong
FreeBasic loves precision, just like the C language. With extra code we can make it work, but why would we need to add more code to do it?
xiaoyao wrote: Jun 08, 2024 9:17 3. The default form.load event could not be found. I used Form_Create instead.
First it is made as Create event, I didn't change it.
xiaoyao wrote: Jun 08, 2024 9:17 It is best to add: other events in the right-click menu of an event code
We can add them to the context menu of controls.
xiaoyao wrote: Jun 08, 2024 9:17 4. The text in the default color is not clear, especially the TAB symbol.
Select theme color: night-owl
I did this on purpose so that it would not distract attention. Spaces and tabs are empty space.
xiaoyao wrote: Jun 08, 2024 9:17 5. The default display of the form should be in the center of the screen.
startPosition=1
In VB6, the default value for the StartUpPosition property is also Windows Default.
xiaoyao wrote: Jun 08, 2024 9:17 6. Options》Code Editor? Treat tabs as spaces, select "Anywhere"
"Only after the words" is the best option.
xiaoyao wrote: Jun 08, 2024 9:17 7. When F5 compiles, it prompts whether to forcefully end the last opened process.
I'll take a look at this.
xiaoyao wrote: Jun 08, 2024 9:17 8. A forum link for this IDE project should be added to the help in item 3 of the menu.
https://www.freebasic.net/forum/viewtopic.php?t=27284
It is too.
xiaoyao wrote: Jun 08, 2024 9:17 9. When the project is opened, the status of the last compilation should be automatically displayed, such as which form is displayed and which code page is opened.
I'll look into it, but it was better not to open the files, all files were closed by default.
xiaoyao wrote: Jun 08, 2024 9:17 10. Double-click the form tab (file name Form1.frm) to switch between code and form, which is much more convenient.
I'll take a look at this.
xiaoyao wrote: Jun 08, 2024 9:17 11. The code in the module cannot be used, what should I do?
To use it, you need to include it like this: #include once "your module"
xiaoyao wrote: Jun 08, 2024 9:17 It crashes after adding another module
I also add other modules, but the IDE does not crash. I can't grasp this moment.
xiaoyao wrote: Jun 08, 2024 9:17 12. Reopen the IDE and cannot see the recently used projects. Now there are a few steps: switch tabs>recently opened>projects>, it’s too troublesome
In the General settings there is an Auto Save Session option, and in the "When Visual FB Editor starts" item you can select Open Last Opened Session.
xiaoyao wrote: Jun 08, 2024 9:17 13. How to prevent the IDE navigation title from displaying the complete path and only displaying the project name
We can add this option.
xiaoyao wrote: Jun 08, 2024 9:17 14. There is no need to put the link to the GITHUB homepage in the help menu, only https://github.com/freebasic/fbc
Removed Github WebSite:
https://github.com/XusinboyBekchanov/Vi ... 8836a8992d
xiaoyao wrote: Jun 08, 2024 9:17 15. If you choose the LINUX version of the compiler, you can automatically download the relevant compiler plug-in, making automatic compilation more convenient.
For example, the default is 32-bit, 64-bit, and 32-bit LINUX. There are 4 options for compiling into 64-bit Linux. Whichever one you choose will be automatically compiled into the corresponding program.
To do this, we need to build cross-compilers.
xiaoyao wrote: Jun 08, 2024 10:13 16. Double-click '#End Region, it is best to automatically collapse the header project-related attribute code
I'll see.
xiaoyao wrote: Jun 08, 2024 9:17 17. If the button event code in the form is manually deleted, compilation errors will occur. It is best to automatically remove the relevant event binding code.

--------------------------
Declare Sub CommandButton3_Click(ByRef Sender As Control)
'CommandButton3
With CommandButton3
.OnClick = Cast(Sub(ByRef Designer As My.Sys.Object, ByRef Sender As Control), @CommandButton3_Click)

End With
Private Sub Form1Type.CommandButton3_Click(ByRef Sender As Control)

End Sub
--------------------------
ld.exe: Form1.o:fake:(.text+0x1c0f): undefined reference to `FORM1TYPE::COMMANDBUTTON3_CLICK(MY::SYS::FORMS::CONTROL&)@8'

17:27:44: Found errors (1).
17:27:44: No generated files. Time taken: 2.54 seconds
===================
I'll see.
xiaoyao wrote: Jun 08, 2024 9:17 18. The project file uses forms or modules external to other projects. The path cannot be seen in the IDE. It can only be opened with Notepad software to view or modify.
When the mouse moves over the form file name of the project tree control, if it is outside the project, the corresponding path will be automatically displayed.
If it is a form in a subdirectory, it can be displayed: Form1.frm(\Folder2)
I'll see.
xiaoyao wrote: Jun 08, 2024 9:17 19. Select the UI mode as GTK4, and the result is wrong.

compiler\bin\win32\ld.exe: cannot find -lglib-2.0: No such file or directory
compiler\bin\win32\ld.exe: cannot find -lgthread-2.0: No such file or directory

20. Project templates should be added: GTK ui interface project, WINDOWS form program project
here is already a Windows Application project.
xiaoyao
Posts: 138
Joined: May 05, 2020 2:01

Re: VisualFBEditor - IDE for FreeBasic

Post by xiaoyao »

As for the previous question, the compiled EXE is running. If you recompile it, it would be better to prompt whether to terminate the last process.

Question 21: Project:\Examples\Add-In, how to use the plug-in
A new plug-in project was created, and the compilation error was: \compiler\bin\win32\ld.exe: cannot open output file ../AddIns/MyAddin (x32).dll: No such file or directory
22. The vbcrlf function cannot be used and this header file vbcompat.bi needs to be quoted.
23. It is best that when the IDE is run for the first time, it will automatically add the opening method of *.VFP as fbeditor.
24. You can add the concept of control array, textbox1(index)
25. It is best to add a WINDOWS api list, so there is no need to reference it. What APIs are used in the project? An API list module file will be automatically generated during compilation: Project_api.bas
26. Like VB6, if it supports adding OCX controls, COM DLL references, and TLB file references, it would basically be perfect.
27. It is best to add a module management database with 3 basic fields: module file/function (supports Chinese)/module main function list, which can be automatically searched at any time when needed.
For example, if I enter the VBCRlf function, I will be prompted whether I need to quote: vbcompat.bi.
The automatic detection function will be added later. If vbcompat.bi does not use any functions, the file will be automatically excluded during compilation.
vbcompat.bi vb6Function vbcrlf,***
xiaoyao
Posts: 138
Joined: May 05, 2020 2:01

Re: VisualFBEditor - IDE for FreeBasic

Post by xiaoyao »

With the control array, you can write a calculator program with very little code like this

Code: Select all

Private Sub Command1_Click(Index As Integer)
    Dim key As String
    key = Command1(Index).Caption
    If Right(Text1, 1) = "=" Then Text1 = "": Text2 = ""
    If key = "=" Then
        Text2 = Eval(Text1)
        Text1 = Text1 & "="
    Else
        Text1 = Text1 & key
    End If
End Sub
Private Sub Command2_Click() '
    Text1 = "": Text2 = ""
End Sub
Function Eval(s As String) As String
On Error GoTo Err
    Dim scr As Object
    Set scr = CreateObject("MSScriptControl.ScriptControl")
    scr.Language = "vbscript"
    Eval = scr.Eval(s)
    Exit Function
Err:
    MsgBox "err:" & Err.Number & "," & Err.Description
End Function
Post Reply