VisualFBEditor - IDE for FreeBasic

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

Re: VisualFBEditor - IDE for FreeBasic

Post by Xusinboy Bekchanov »

Added: UNICODE to Windows Application Form1.bas:
https://github.com/XusinboyBekchanov/Vi ... edd806ce8c

Here's how to work with the SDK for the new templates:
Form1.bas:

Code: Select all

'#Compile "Form1.rc"
#define UNICODE
#define __MAIN_FILE__
Const _MAIN_FILE_ = __FILE__
#include once "windows.bi"
#include once "win\commctrl.bi"
#include once "Form1.frm"
Form1.MainForm = False

Dim msg As MSG
Dim As WNDCLASSEX wc
Dim As WString * 100 NameClass = "MyClass"
Dim As HINSTANCE HInst = GetModuleHandle(0)

Function WndProc(ByVal hwnd As HWND, ByVal msg As UINT, ByVal wparam As WPARAM, ByVal lparam As LPARAM) As LRESULT
	Select Case msg
	Case WM_CREATE
		
	Case WM_COMMAND
		
	Case WM_LBUTTONDOWN
		Form1.Show
	Case WM_DESTROY
		PostQuitMessage(0)
	End Select
	Return DefWindowProc(hwnd, msg, wparam, lparam)
End Function

With wc
	.cbSize = SizeOf(WNDCLASSEX)
	.style = CS_HREDRAW Or CS_VREDRAW
	.lpfnWndProc = @WndProc
	.hInstance = HInst
	.hIcon = LoadIcon(0, IDI_QUESTION)
	.hCursor = LoadCursor(0, IDC_ARROW)
	.hbrBackground = Cast(HBRUSH, COLOR_WINDOW)
	.lpszClassName = StrPtr(NameClass)
	.hIconSm = .hIcon
End With

If RegisterClassEx(@wc) = 0 Then
	Print "Register error, press any key"
	Sleep
	End
EndIf

InitCommonControls

CreateWindowEx(0, NameClass, "Main Window", WS_VISIBLE Or WS_OVERLAPPEDWINDOW, 10, 10, 300, 300, 0, 0, HInst, 0)

While GetMessage(@msg, 0, 0, 0)
	TranslateMessage(@msg)
	DispatchMessage(@msg)
Wend
Form1.frm:

Code: Select all

'#Region "Form"
	#if defined(__FB_MAIN__) AndAlso Not defined(__MAIN_FILE__)
		#define __MAIN_FILE__
		Const _MAIN_FILE_ = __FILE__
		#ifdef __FB_WIN32__
			#cmdline "Form1.rc"
		#endif
	#endif
	#include once "mff/Form.bi"
	
	Using My.Sys.Forms
	
	Type Form1Type Extends Form
		
	End Type
	
	Dim Shared Form1 As Form1Type
	
	#if _MAIN_FILE_ = __FILE__
		Form1.MainForm = True
		Form1.Show
		App.Run
	#endif
'#End Region
PeterHu
Posts: 148
Joined: Jul 24, 2022 4:57

Re: VisualFBEditor - IDE for FreeBasic

Post by PeterHu »

In my example, I added #include once "Form1.frm" before #include once "windows.bi". Because, #define UNICODE is defined in the framework. And it is not in the Form1.bas file. If you write #include once "windows.bi" first, then all WinAPI functions use "A" variants, not "W" variants, i.e. ascii variants, not unicode variants. Or you can add #define UNICODE before #include once "windows.bi" yourself, then there will be no errors.

Until yesterday we included the second form after "'End Region". Then the first form was called correctly.
I changed the form template yesterday:
https://github.com/XusinboyBekchanov/Vi ... b39da882a2

Now you can include the second form as in your example. To do this, change the top #if #endif to this (in two forms):

Code: Select all

	#if defined(__FB_MAIN__) AndAlso Not defined(__MAIN_FILE__)
		#define __MAIN_FILE__
		Const _MAIN_FILE_ = __FILE__
		#ifdef __FB_WIN32__
			#cmdline "Form1.rc"
		#endif
	#endif
Bottom #if #endif to this (in the second form, respectively, will be Form2 or secondform):

Code: Select all

	#if _MAIN_FILE_ = __FILE__
		Form1.MainForm = True
		Form1.Show
		App.Run
	#endif
Or download the unreleased version from github.
Get it,learning...


For a simple execise,I only modified property Name and Text in the properties window,no touched any source code in the editer area which was generated by the IDE designer.
I can't find it now. I also tried changing the properties several times. But it didn't happen to me.
And,when creating a new project,trying to save the source file and the project to another location rather than the current position the save as file dialog pops up,this issue could happen.I've encountered a couple of times.Just mention to let you know,for now I am happy with the functionalities the IDE and the Framework provide.

As a personal preferable hobbie,once upon a time I have been dreamig if there is a drag & drop and also auto event generation(I mean when double click on a control say a command button in the designer,it will generate a event procedure awaiting to complete,and the like)visual designer for pure C+SDK in the world so I can learn and play with it without bear too much burden in mindset (yeah,languages like c++ is powerful and almost provides everything which I don't hate and once was dreaming also someday to conquer,but I just cannot afford the mind burden on it day after day,years after years;hope the FreeBasic designers will not create another monster ^_^),now I think FreeBasic and all these great and wonderful frameworks,the MyFM,the Afx...are gifts to me.

Another thing I am seeking guideline is the libraries---When in C,people know which library to chose for a specific area,for example,sqlite3 for database,zlib,openssl,...,so he/she can integrate all these to set up his/her workshop,learning piece by piece,then write whatever he/she want...In FreeBasic we have many choices too on every specific erea and the FreeBasic.net would not force to choose any among these choices.Yeah it is open mindset it is great,but for beginners ,I would be much appreciate if anyone would like to guide me to set up my own "Integrated Learning Workshop".

Regards,
Peter
Last edited by PeterHu on Sep 27, 2022 8:08, edited 1 time in total.
PeterHu
Posts: 148
Joined: Jul 24, 2022 4:57

Re: VisualFBEditor - IDE for FreeBasic

Post by PeterHu »

oyster wrote: Sep 27, 2022 2:21
PeterHu wrote: Sep 27, 2022 1:57 One more thing---
When I tried to study the examples\MDIForm,I noticed this code:

Code: Select all

!"Visual FB Editor MDI Demo\r\nBy Cm Wang"

there is a ! at the beginning, please read https://www.freebasic.net/wiki/TblEscapeSequences
Got it and thanks a lot.I am loving to have this in FB.
PeterHu
Posts: 148
Joined: Jul 24, 2022 4:57

Re: VisualFBEditor - IDE for FreeBasic

Post by PeterHu »

Sorry,once more---
In the IDE I compiled and run the app ,due to some wrong code,the app(Win form)started but it is invisible,now I have to correct it and recompile,but got this--

Code: Select all

[/code13:15:24: Cannot compile - the program is now running E:\Learning\FreeBasic\VisualFBEditor\Projects\ex03\Form1.exe]

I have to kill the app in the Windows Task Manager,it turned out it is easy to catch the app.

So I am just wondering whether there is such functionality in the IDE one can kill the process.
Xusinboy Bekchanov
Posts: 783
Joined: Jul 26, 2018 18:28

Re: VisualFBEditor - IDE for FreeBasic

Post by Xusinboy Bekchanov »

PeterHu wrote: Sep 27, 2022 5:20 I have to kill the app in the Windows Task Manager,it turned out it is easy to catch the app.

So I am just wondering whether there is such functionality in the IDE one can kill the process.
Not yet, but we will add the option to end the process.
oyster
Posts: 274
Joined: Oct 11, 2005 10:46

Re: VisualFBEditor - IDE for FreeBasic

Post by oyster »

if there is error, how to copy the errors, line and file?
Xusinboy Bekchanov
Posts: 783
Joined: Jul 26, 2018 18:28

Re: VisualFBEditor - IDE for FreeBasic

Post by Xusinboy Bekchanov »

oyster wrote: Sep 29, 2022 15:44 if there is error, how to copy the errors, line and file?
Can be copied from the Output tab
oyster
Posts: 274
Joined: Oct 11, 2005 10:46

Re: VisualFBEditor - IDE for FreeBasic

Post by oyster »

Avata wrote: Jun 14, 2022 13:46 I think that it's time to import the webView2 or webkit2 now.
[English version]
Although https://www.aardio.com/ is a lesser known language and can only develop 32-bit EXE, one has to admit that its encapsulation of webview2; the way it calls .NET DLLs; the means to embed resources, DLLs, .NET DLLs in the final EXE; the registration-free calls to OCX, the Plus controls, all of which are beautiful. I hope to see other development environments that offer these features as well - although they shouldn't really be the IDE's job!

Note that the programs compiled by https://www.aardio.com/ and the aardio updater are often reported as viruses by my McAfee. aardio itself has never been reported as a virus.

btw, there is a webview2 binding for vb6 on https://www.vbforums.com/showthread.php ... -Chromium)



[Chinese version]
尽管 https://www.aardio.com/ 是一个名气不大的语言,只能开发32位EXE。但是不得不承认,它封装的webview2;调用.NET DLL的方式;在最终exe中嵌入资源、DLL、.NET DLL的手段;免注册调用ocx,提供的Plus控件,都是很漂亮的。希望能看到有其它的开发环境,也提供这些功能吧——尽管这些功能,其实应该不是IDE要做的事

注意,https://www.aardio.com/ 编译的程序、aardio的升级程序,我的McAfee经常有错误的病毒报告。aardio自身倒是从没有被报过毒。

https://www.vbforums.com/showthread.php ... -Chromium) 说是一个VB6的webview2 库。不清楚完成度咋样
PeterHu
Posts: 148
Joined: Jul 24, 2022 4:57

Re: VisualFBEditor - IDE for FreeBasic

Post by PeterHu »

Does VisualFBEditor use UTF8(BOM) as defualt character set for source editor?Would there be an option to set?In my pc UTF8(BOM) does not work properly with FreeBasic when there is Asia characters in app,esp.when win32 api been using.Below ,the title of the MessageBox will be "标",while "题" is lost.When opening this source(*.bas) with notepad.exe (Win10) and choose "Ansi " when "Save As",recompile the source in VisualFBEditor,the title works ok.

Code: Select all

MessageBox(NULL,"主要信息","标题",MB_OK)
Xusinboy Bekchanov
Posts: 783
Joined: Jul 26, 2018 18:28

Re: VisualFBEditor - IDE for FreeBasic

Post by Xusinboy Bekchanov »

PeterHu wrote: Oct 06, 2022 10:42 Does VisualFBEditor use UTF8(BOM) as defualt character set for source editor?Would there be an option to set?In my pc UTF8(BOM) does not work properly with FreeBasic when there is Asia characters in app,esp.when win32 api been using.Below ,the title of the MessageBox will be "标",while "题" is lost.When opening this source(*.bas) with notepad.exe (Win10) and choose "Ansi " when "Save As",recompile the source in VisualFBEditor,the title works ok.

Code: Select all

MessageBox(NULL,"主要信息","标题",MB_OK)
Yes. In File menu there is File format menu item. Choose from this Plain text.
PeterHu
Posts: 148
Joined: Jul 24, 2022 4:57

Re: VisualFBEditor - IDE for FreeBasic

Post by PeterHu »

Xusinboy Bekchanov wrote: Oct 06, 2022 11:00
PeterHu wrote: Oct 06, 2022 10:42 Does VisualFBEditor use UTF8(BOM) as defualt character set for source editor?Would there be an option to set?In my pc UTF8(BOM) does not work properly with FreeBasic when there is Asia characters in app,esp.when win32 api been using.Below ,the title of the MessageBox will be "标",while "题" is lost.When opening this source(*.bas) with notepad.exe (Win10) and choose "Ansi " when "Save As",recompile the source in VisualFBEditor,the title works ok.

Code: Select all

MessageBox(NULL,"主要信息","标题",MB_OK)
Yes. In File menu there is File format menu item. Choose from this Plain text.
Got you.Plain Text format works in my pc,the others don't.

Thanks.
Xusinboy Bekchanov
Posts: 783
Joined: Jul 26, 2018 18:28

Re: VisualFBEditor - IDE for FreeBasic

Post by Xusinboy Bekchanov »

PeterHu wrote: Oct 06, 2022 13:56
Xusinboy Bekchanov wrote: Oct 06, 2022 11:00
PeterHu wrote: Oct 06, 2022 10:42 Does VisualFBEditor use UTF8(BOM) as defualt character set for source editor?Would there be an option to set?In my pc UTF8(BOM) does not work properly with FreeBasic when there is Asia characters in app,esp.when win32 api been using.Below ,the title of the MessageBox will be "标",while "题" is lost.When opening this source(*.bas) with notepad.exe (Win10) and choose "Ansi " when "Save As",recompile the source in VisualFBEditor,the title works ok.

Code: Select all

MessageBox(NULL,"主要信息","标题",MB_OK)
Yes. In File menu there is File format menu item. Choose from this Plain text.
Got you.Plain Text format works in my pc,the others don't.

Thanks.
Here it works fine for me in UTF-8 (BOM):
Image
oyster
Posts: 274
Joined: Oct 11, 2005 10:46

Re: VisualFBEditor - IDE for FreeBasic

Post by oyster »

PeterHu wrote: Oct 06, 2022 10:42 Does VisualFBEditor use UTF8(BOM) as defualt character set for source editor?Would there be an option to set?In my pc UTF8(BOM) does not work properly with FreeBasic when there is Asia characters in app,esp.when win32 api been using.Below ,the title of the MessageBox will be "标",while "题" is lost.When opening this source(*.bas) with notepad.exe (Win10) and choose "Ansi " when "Save As",recompile the source in VisualFBEditor,the title works ok.

Code: Select all

MessageBox(NULL,"主要信息","标题",MB_OK)
what if you try another fb with different version?
PeterHu
Posts: 148
Joined: Jul 24, 2022 4:57

Re: VisualFBEditor - IDE for FreeBasic

Post by PeterHu »

Xusinboy Bekchanov wrote: Oct 06, 2022 14:38
PeterHu wrote: Oct 06, 2022 13:56
Xusinboy Bekchanov wrote: Oct 06, 2022 11:00
Yes. In File menu there is File format menu item. Choose from this Plain text.
Got you.Plain Text format works in my pc,the others don't.

Thanks.
Here it works fine for me in UTF-8 (BOM):
Image
#define UNICODE then works in UTF-8(BOM).IIRC under windows console sometimes does not work well for asian charaters when UNICODE is defined.
Now I believe this is an issue of my own pc configuration.
Xusinboy Bekchanov
Posts: 783
Joined: Jul 26, 2018 18:28

Re: VisualFBEditor - IDE for FreeBasic

Post by Xusinboy Bekchanov »

PeterHu wrote: Oct 07, 2022 5:38 #define UNICODE then works in UTF-8(BOM).IIRC under windows console sometimes does not work well for asian charaters when UNICODE is defined.
Now I believe this is an issue of my own pc configuration.
Concerning the console all Windows is identical. For example, mine doesn't show Unicode characters either.
Post Reply