My issues about freebasic

For other topics related to the FreeBASIC project or its community.
Posts: 6687
Joined: Jan 10, 2006 20:30
Location: Scotland

Re: My issues about freebasic

Postby dodicat » Mar 11, 2020 17:27

Last edited by dodicat on Mar 11, 2020 18:07, edited 1 time in total.
Posts: 1131
Joined: May 27, 2005 7:15
Location: FRANCE

Re: My issues about freebasic

Postby SARG » Mar 11, 2020 17:50

Be carefull it seems to change fonts for other windows. Need to restart my box to get the normal ones.
Posts: 6687
Joined: Jan 10, 2006 20:30
Location: Scotland

Re: My issues about freebasic

Postby dodicat » Mar 11, 2020 18:08

SARG wrote:@dodicat
Be carefull it seems to change fonts for other windows. Need to restart my box to get the normal ones.

I have removed it.
Thank you.
Posts: 2139
Joined: May 24, 2007 22:10
Location: The Netherlands

Re: My issues about freebasic

Postby badidea » Mar 11, 2020 22:57

A start for the 'library review' I had in mind for the wiki.

=== true type font ===

Name: FBTrueType static Win/Lin 32/64-bit
Url: viewtopic.php?f=14&t=25083
Tested: 11-03-2020, Ubuntu 18.04 linux 64-bit, fbc 1.07.1 32-bit gas & 64-bit gcc
Result: All examples compile & run as expected

Name: Freetype2
Url: ... bfreetype2
Tested: 11-03-2020, Ubuntu 18.04 linux 64-bit, fbc 1.07.1 32-bit gas & 64-bit gcc
Result: Problems
* 32-bit fbc: Linker can not freetype library, although installed on system
* 64-bit fbc: ft2_test.bas: Ok, ft2_print.bas: Crash. Both needs conversion integer to long.

Name: CharSet2FBFont
Url: ... nt-88.html
Tested: 11-03-2020, Ubuntu 18.04 linux 64-bit, fbc 1.07.1 32-bit gas & 64-bit gcc
Result: Converter not working, only small fixes needed?

Name: Simple and Fast Multimedia Library
Url: viewtopic.php?f=14&t=26678
Tested: Not yet
Remark: Larger library (system, window, graphics, audio, network)

List is far from complete, this 'review' will definitely be a lot of work.
* Cairo graphics can also do truetype font rendering
* And I forgot this one: ... =8&t=12078. Available here with some bug fixes: This uses xf-files, not sure how this relates to ttf-files.
* And raylib: viewtopic.php?f=14&t=28380
Posts: 38
Joined: Jun 21, 2016 13:06

Re: My issues about freebasic

Postby Helium5793 » Mar 13, 2020 18:27

I need to review those links, and will get back to you.
Posts: 38
Joined: Jun 21, 2016 13:06

Re: My issues about freebasic

Postby Helium5793 » Mar 14, 2020 14:40

Where did you see the program maybe someone here can help you to get it to work?
The program was in the freebasic forums from about 2010.

I personally have never used ttf in a FreeBASIC program but surely someone has?

They talk about using TTF with FreeBASIC's Draw String statement here in the Graphics and Games section?

The few times I have used fonts I just roll my own using bitmap images as there is no innate support for them in FreeBASIC.
When you say "rolled your own" do you have a process, or one that works that I can see?

Some google results: ... Drawstring

I read these, and it certainly sounds doable. I could use a sample one that works. Then I might be able to take it from there.
Posts: 38
Joined: Jun 21, 2016 13:06

Re: My issues about freebasic

Postby Helium5793 » Apr 01, 2020 18:06

I have pretty much solved my issues by learning window9. While the google translated .chm file is pretty good, and they give a ton of simple examples, I would love to see the examples more fully explained. (This is not a complaint; one can figure them out, but it would be faster with a statement about what each number means) For example
1 is the item number, 30,30, is x, y upper left corner. 100,100, is the size of the window.
#Include ""
Dim As HWND hwnd,hwnd1


This is a simple example, but a few of the examples can confuse. Anyway look carefully at the line to make a window, simple, elegant, and if python programmers are "pythonic" window9 programmers are "basiconic" (pronounced base-iconic) It works under windows and it works under linux. Looks nice and is simple to program. I am hoping to upload an example soon. Thanks window9 programmers, I have what I need now!

Posts: 34
Joined: Dec 14, 2018 11:11

Re: My issues about freebasic

Postby thebigh » Apr 02, 2020 9:53

Yes. What I love about this language is that it combines the performance and flexibility and performance of C with the readability of traditional forms of BASIC, but without being as gimmicky as things like python. I'm an old C curmudgeon at heart so some of the new C++ inspired features are taking a while to seep into my brain but I am getting there.
Tourist Trap
Posts: 2904
Joined: Jun 02, 2015 16:24

Re: My issues about freebasic

Postby Tourist Trap » Apr 03, 2020 19:18

Helium5793 wrote: The basic part works great, but when it comes to displaying things I am having difficulties.

Hi John.

My opinion is that what you find lacking today is not bound to freebasic core. Freebasic core language is really clean and powerful. It has basic syntax with the power of C.
I use in a regular basis now other languages, like VBA,, Python, PyQt, a little of PHP, Javascript that I've come to learn for professional matter. They are all the same, there is a time when you'll need more control and efficiency, without starting coding in assembly. (more control means also using your own choosen coding paradigms) Then you'll have C maybe, but its syntax is not as easy as freebasic's one for me.

In one word, for me freebasic was a good investment for the future that still helps me a lot everyday when I use other languages. - Not mentionning that the community will virtually answer any technical question you can find in an out.

Wait I have a good word. I would say that freebasic is not the kind of language where you search in a catalog of library which one could do something for you, if you comply to its paradigm. Freebasic is more a what you can do for yourseflf with a tool that offer all the freedom you may dream of.

Now, how to solve most of the issues you mentioned? In my opinion again, it's a simple question of finding what library you want to bind to your programs. When I use Python or Javascript, I rather never use them pure. That's always tons of imports and other includes. If I compare freebasic pure, to those languages without any external libs, then FB wins.

Of course, the problem remains. What library could fit to FB to make it more useful for ones specific needs? I don't know. There is still not really an official guideline about this. This is perfectly possible to have fonts with FB. But time passing, I tend to find the little default ones good enough for most usages. But maybe you're right there could be some gain of attractiveness if we could have an official ready made official font library made avaiable. That would be probably something to include optionnaly. Not a bad idea. But I personnally can live without now, and simply use dodicat's fonts when I want to impress people :)

Not sure it helps, but my humble opinion at the hour.
Posts: 38
Joined: Jun 21, 2016 13:06

Re: My issues about freebasic solved -by windows9

Postby Helium5793 » Apr 16, 2020 1:11

I finished my first program using FB and window9. It was written in linux but probably would compile under windows. I am posting the source code here. The only thing that might not work is the window centering. Since I have 2 monitors I wrote a little program to center the window on the right hand monitor and wrote the info to a file. This program reads the file (which looks like this. If you want to try the program, you will have to disable the file read.
The program is called dilution.bas and it calculates how to dilute various acids and bases to get various molar solutions. What I find interesting is that the program handles a window, 18 buttons, 2 message boxes, 2 input boxes, and 5 textgadgets in 134 lines. So you might want to look at the code to see how easy it is to do windows programs with window9.

Code: Select all

/'Dilution, rewritten in FreeBasic using window9 2020-0408 '/
#Include ""
declare sub messages()
declare sub display()
declare sub calculate()
dim shared as integer xxsize, yysize,num_monitors,i
dim shared as integer monitor(2,2)
Dim shared As integer hwnd,but,event
dim shared as integer xcenter2,ycenter2,xsize,ysize,indx
dim shared as string message1,message2,reagname(20),mil
dim shared as single mLs, molarity,reagconc(20),moles_needed
dim shared as single mls_needed,mls_reagent
hwnd=OpenWindow("The Solution for Dilution",xcenter2,ycenter2,xsize,ysize)




TextGadget(19,1,5,120,20,"Common Acids     ")
TextGadget(20,260,5,120,20,"Common Bases")
TextGadget(21,320,260,120,30,"mLs Desired: ")
EditorGadget(22,440,260,80,30,"   ")
TextGadget(23,290,300,120,30,"Molarity Desired: ")
EditorGadget(24,440,300,80,30,"   ")

 If event=EventClose Then End
 'If event=eventgadget Then MessBox("Russian","You pressed button")
  Select Case event

 case EventGadget
   select case EventNumber
   case 1 to 16
case 17
case 18

 End Select
 End Select
sub calculate()



message2="Take " + mil + " mLs of " + reagname(indx) + " and dilute to " + str(mLs) + " mLs final volume."

end sub

sub display()
Open "Display_setup.csv" for input as #1
input #1, num_monitors
Input #1, xxsize, yysize

for i = 1 to num_monitors
input #1,monitor(i,1),monitor(i,2)
close #1
end sub

sub messages()
message1="Select the reagent you want to dilute. Select the molarity of the solution, and how many mLs you wish to prepare. Then press 'Calculate'."
reagname(1)="Acetic Acid glacial (100%...17.4M)"
reagname(2)="Formic Acid (90%...23.4M)"
reagname(3)="Hydrofluoric Acid (50%...25.7M)"
reagname(4)="Hydrochloric Acid (37%...12.1M)"
reagname(5)="Hydrobromic Acid (48%...8.8M)"
reagname(6)="Hydroiodic Acid (47%...5.5M)"
reagname(7)="Nitric Acid (70%...15.4M)"
reagname(8)="Perchloric Acid (70%...11.6M)"
reagname(9)="Phosphoric Acid (85%...14.7M)"
reagname(10)="Sulfuric Acid (100%...17.6M)"
reagname(11)="Aqueous Ammonia (29%...14.8M)"
reagname(12)="NaOH (50%...19.1M)"
reagname(13)="KOH (45%...11.7M)"
reagname(14)="N(Me)4 OH (25%w/w...2.4M)"
reagname(15)="N(Et)4) OH (35% w/w...2.43M)"
reagname(16)="N(Bu)4 OH (40%w/w...1.57M)"
end sub

Return to “Community Discussion”

Who is online

Users browsing this forum: No registered users and 1 guest