Oxygen Basic

Programming => Example Code => User Interface => Topic started by: Arnold on October 10, 2015, 05:18:12 AM

Title: The Oxygen-BCX project
Post by: Arnold on October 10, 2015, 05:18:12 AM
Edit: Until there is not a more complete version of the BCXgui library available I will attach an updated snapshot with my latest postings.


this is one of the coolest tasks I have ever started. It is a fascinating feeling to see the two worlds of Oxygenbasic and BCX working hand in hand. Often this happens almost out of the box with only minimal modifications.

Of course this project is far from being complete. The code is not yet tested and there is at least a small bug in it. But hopefully this will be resolved soon.

Any help or suggestion will be gratefully appreciated.


[attachment deleted by admin]
Title: Re: The Oxygen-BCX project
Post by: Arnold on October 18, 2015, 06:22:04 AM

I updated the BcxGui library with some more functions and demos. I tried to work out a better MAKEWPARAM, MAKELPARAM, HIBYTE and LOBYTE macro which could be useful sometimes. I also tried out some demos which use a more low-level programming. Last but least this is also a strength test for the flexibility of Oxygen's BASIC syntax capabilities.

Included also is a batch file which runs the demos. Possibly the path for Oxygenbasic must be edited in the file RunDemos.bat.

Of course at the moment I cannot achieve as much with BCX as I can do e.g. with Iup. But hopefully this will change soon. Currently I am working on the BCX_TOOLBAR and BCX_SPLITTER functions which refuse a little bit to behave the way I would like.


[attachment deleted by admin]
Title: Re: The Oxygen-BCX project
Post by: Arnold on October 31, 2015, 07:29:10 AM

this is a new update of the Oxygen-BCX library with some more demos. I improved RunDemos.bat a little bit to show the title of the running demos. I also grouped the demos in several sections, starting also a section Tutor which uses a more OxygenBasic style and which will serve as a kind of test case for me. Maybe the path for OxygenBasic must be corrected in Getpath.bat, as I use gxo2.exe (or co2.exe), GoRC.exe and LinkRes2.exe. When starting RunDemos.bat the first step then should be to select number 1 for building the necessary resource dlls.

BTW: the BCXgui folder is intended to be installed separately. I always try to leave my OxygenBasic installation untouched.

Although there is still much to add to the BCXgui library, some very interesting things are already possible now.


Title: Re: The Oxygen-BCX project
Post by: John on October 31, 2015, 11:24:06 AM
Are you done with IUP?

I thought BCX was a BASIC to C translator. How does BCX help OyxgenBasic?
Title: Re: The Oxygen-BCX project
Post by: Arnold on November 01, 2015, 04:25:36 AM
Hi John,

I am not done with IUP, I only take a break at the moment. But I think I will then concentrate only on Iup.dll. Iupcontrols.dll depends on some more dlls, which results in using a lot of ballast even for small applications. BCX is especially developed for Windows and therefore much more compact.

In my view OxygenBasic would be another compiler for which BCX programs could be translated. The only difference would be that the BCX code could be run directly. Independant executables can be created nevertheless. (Currently I am only doing this with 32-bit and only with Windows Vista).

I do not know if BCX is of help for OxygenBasic but it is of great help for me to understand some more internals of OxygenBasic.  For instance using the integer divison operator \ to get an integer result in a compound expression whithin a WinApi function solved many problems for me. Using BCXgui will also help me to see the differences between BCX and OxygenBasic in some cases to get the same result. I am convinced that a BCX programmer would see at once the small changes which would be necessary to run BCX code with OxygenBasic and that a C programmer would recognize the differences of the runtime functions done in C and my attempt with OxygenBasic. Last but least I think BCX is very well suited to learn about using a gui for Windows and still give the freedom to develop new ideas.

At the moment the BCXgui library must be completed which will take some time. Maybe this project is a little bit too ambitious for me as I am only a hobby programmer, but at least I have fun.


Title: Re: The Oxygen-BCX project
Post by: Aurel on November 01, 2015, 07:05:55 AM
As far as i know Iup primary target is Linux not Windows...
so ..i dont see real value in this gui lib...maybe for creating simple web browser ::)
And there is no better way on Windows then use native WINapi gui functions.
Title: Re: The Oxygen-BCX project
Post by: Mike Lobanovsky on November 01, 2015, 07:35:13 AM

On each respective platform, IUP internally uses native GUI functions, which would be WinAPI under MS Windows. When under Linux, IUP would use GTK+. Regretfully, IUP cannot yet efficiently use the modern Cocoa GUI of latest Mac OS X versions and has to utilize a Mac build of GTK+.

The beauty of multi-platform GUI libraries like IUP, wxWidgets, Qt and others is that the programmer can use the same library functions to create their visual interfaces that look absolutely native to each OS the library is used under. It's like using Ruben's window command that would create an ordinary Windows frame form, when under XP, but a beautiful dialog window, when under e.g. Mac OS X Mountain Lion or the latest Yosemite.

Regretfully, well developed multi-platform GUI libraries with lots of controls tend to be unreasonably large. IUP would be the smallest of the three, and Qt, the hugest if not entirely absurd.
Title: Re: The Oxygen-BCX project
Post by: Arnold on November 14, 2015, 02:25:01 AM

this is another update of the BCXGui library with more functions and demos. The original code of the demos is provided in the full BCX installation which can be downloaded at www.bcxbasic.com. At the website you can also find a BCX Programmers Reference Online and some more links. The demos are invaluable for me to see what must be coded a little bit different in OxygenBasic. They are in fact some kind of test cases. Many demos are really impressive.

For some demos I created a resource dll. By modifying a few places in the main code the resources could be linked directly to the executable. But this is not my main purpose at the moment. For editing the resource.rc files I used ResEd.exe (not ResEdit.exe), for checking the dlls I used Resource Hacker. Resource.rc files can also be edited by hand, some infos can be found in the file \OxygenBasic\tools\ResourceNotes.txt.

The tutor section (my personal test case) is a work in progress. Perhaps I can add a textviewer next time to inspect the code of the apps.


Title: Re: The Oxygen-BCX project
Post by: Arnold on December 17, 2015, 01:20:16 AM

this is the latest snapshot of the BCXgui library with some more functions and working examples.

Some small changes were applied to this version. I renamed the underlying files for bcxgui.inc, as they can be used for other projects too:
BCXConsts.inc -> o2WinConsts.inc
BCXTypes.inc  -> o2WinTypes.inc
BCXFuncs.inc  -> o2WinFuncs.inc
I renamed the folder Tutor as Samples and added a new folder VTotle which includes the beginning of a small textviewer.

in bcxgui.inc there is a small difference in some bcx grapics functions where I added the parameter instance in order to be able to use resources from a dll. Currently these functions are:
There is also a small difference in BCX_Toolbar, where the optional base values of Bstyles and imgidx is set to -1 instead of 0.

After unzipping the files into a separate directory, the path for o2hdir must be edited in the file Getpath.bat if Oxygen is not located in c:\OxygenBasic.
Then if running RunDemos.bat the first step should be the first option which builds some necessary dlls and compiles VTotle.o2bas to an independant executable. Also some oxygen.cfg files are created.

VTotle is intended to be a small textviewer which also allows running the loaded files either with gxo2.exe or co2.exe. You can also create executables which run with oxygen.dll. There is also an option to start an own editor which is set to Wordpad.exe in VTotle.cfg. In VTotle.cfg one can change the value for the prefered editor.

I ran the demos in Windows Vista and Windows7. I do not yet know if they work with Windows 8.1 or Windows 10.

The next step will be to add BCX_Tab, BCX_Splitter and accelerator functionality. But this will not happen until next year.


Title: Re: The Oxygen-BCX project
Post by: Arnold on January 22, 2016, 11:05:07 AM

this is the sixth revision of the BCXgui library including some more demos. I added the functions for bcx_fontdlg and bcx_colordlg. I also tried to add accelerator table functionality to allow using key shortcuts.

I also enhanced the Textviewer a little bit with some more options. It should be possible now to create a listing of assembly code, o2 machine script or o2 intermediate code.
Note: this option seems to be disabled with gxo2.exe in the current OxygenBasic distribution therefore I used co2.exe as default compiler. The compiler can be changed within the options menu.
Also applied is a workaround for Listview columns - LVM_SETCOLUMN seems not to work correctly the way I call it. I think I do something wrong with pszText in LVCOLUMN.

Today I started and configured my little win8 netbook with multitouch display. I connected an USB stick containing OxygenBasic and BCXgui, edited the Oxygenbasic path in Getpath.bat and started Rundemos.bat. Everything worked: building the dlls and VTotle.exe, running the demos and running the Textviewer. Only problem was with Calc.o2bas, because my netbook does not use a Numpad. This must be examined a little bit more. But I was really surprised that I could use my multitouch display to close the windows or to activate the controls. As I will upgrade to Windows 10 this will be my only test with Windows 8.

But somehow I am happy that I already came so far (thanks to BCX and OxygenBasic)


Title: Re: The Oxygen-BCX project
Post by: Arnold on February 25, 2016, 08:06:49 AM

slowly but surely ...
This is the next approach for the BCXgui library. This time I added BCX_SPLITTER and some MDI functionality.
At the moment I am experimenting with tabcontrol and treeview which still refuse to work properly. But I look optimistically into the future.


Title: Re: The Oxygen-BCX project
Post by: Peter on February 25, 2016, 03:02:59 PM
Hi Arnold,

Cool Graphics.  :)
Looks good for me.
Title: Re: The Oxygen-BCX project Version 0.1
Post by: Arnold on April 24, 2016, 02:33:20 AM

this project should now meet the requirements to create all kind of small applications in OxygenBasic. Therefore I gave it a version number though it must be really tested now. With this version basic tabcontrol and treeview functions are added. For the project I use the latest build of OxygenBasic (version A41 15/04/2016).

There is a substantial change. I separated the project into two files:

1) BCXguiLib.zip:
this contains the BCX folder with the necessary include files. BCX is intended to be a subfolder of \OxygenBasic\inc. After moving the BCX folder the structure should be:

The advantage would be that projects can be created outside of OxygenBasic and conforming include statements in the .o2bas files are possible e.g.:

Code: OxygenBasic
  1. #compact
  3. $ filename "filename.exe"
  5. '#include "$/inc/RTL32.inc"
  6. '#include "$/inc/RTL64.inc"
  8. #include "$/inc/bcx/bcxgui.inc"
  9. '#include "$/inc/console.inc"
  10. cr=chr(13,10)
  12. GUI "MyTemplate"

Of course the BCX folder can be installed anywhere else but then the include statements must be adapted.

2) BCXguiApps.zip       
This file contains the folder BCXguiApps which can be extracted anywhere on the harddisk or USB-stick. The structure of the subdirectories should be as stated in Contents.txt. RunDemos.bat can be used to run the demos. Maybe the path of Oxygenbasic in getpath.bat (o2hdir) must be adapted. When starting RunDemos.bat first of all some necessary dlls must be created.

Other changes are:
Integration of minwin.inc into o2WinConsts.inc, o2WinTypes.inc and o2WinFuncs.inc. The purpose is to get rid of doubles in my include files and to use protoyped WinApi functions. In o2WinConsts I commented out many equates to check which constants are really required.

In the future I would like to add some more BCX gui functions to the library.


Title: Re: The Oxygen-BCX project
Post by: Emil_halim on April 25, 2016, 11:02:38 AM
Hi Roland

I have just received your email that posted to BCX yahoo Group , then i follow the link to this page.

It is very good project , i still using BCX till now , more than ten years ago.

BCX is very easy and powerful translator that help basic users to learn c language.

also Oxygen Basic is very powerful and amazing basic language , combining basic , c , pascal and asm features in one package.

my notes are,
  1- you still did not implement all rtl of BCX , it is powerful run time library.
  2- some rtl those found in util have a deferent name from that was implemented in BCX
finally , thank you for that project ,and keep up the good working.


Title: Re: The Oxygen-BCX project
Post by: Arnold on May 02, 2016, 11:28:29 PM
Hi Emil,

please excuse my delayed answer. I had to solve an unexpected problem.

The BCXgui project is a way for me to learn more about the many capabilities of OxygenBasic. Exploring the many provided examples I know that I still have only touched the surface. But Oxygen has indeed helped me to learn more about other Basic dialects, a little bit more about C, Assembler, even a little bit about Lisp or Scheme. And some day I hopefully will start object oriented programming with Oxygen.

I am aware that the project is not yet complete and also not optimized. But as it works quite nice until now I thought that it also could be a matter of more general interest. Therefore I posted to BCX yahoo group - the purpose was also to be sure that everything is correct (leagal) what I am doing.

At the moment I try to add memory based dialogs to the BCXgui library. Which additional BCX gui functions would be interesting to port to OxygenBasic too?