BCX Mini Form Designer 2020

Started by MrBcx, August 17, 2020, 11:36:39 PM

Previous topic - Next topic

MrBcx

#11
Quote from: Chris Boss on April 04, 2024, 04:41:08 PM
BSTR strings have many advantages not found in normal C string types.

First, I find that many indie programming languages support strings but there is a limit to their length. Not sure if BCX has this issue.

BSTRs are great for very huge strings.

Second, they are not null terminated. They can hold binary data. This is something I do a lot. Using pointers I can even embed other data types into a BSTR.

What data type (compared to Powerbasic) does BCX use for strings ?

Is there a limit to their size ?

For starters  ... https://bcxbasiccoders.com/webhelp/html/otherbasics.htm

BSTR's are demonstrably slower than c strings when their contents need to be manipulated.  They are
also generally limited to MS Windows, VB, and the dotNet languages.  Given enough hands-on experience,
the lowly null terminated "c string" might one day surprise you with its capabilities.

I recognize that you have "sunk costs" in your products resulting from your choice to use PB.  That happens.
But if you truly want to explore what BCX can do for you, perhaps to move you into 64-bit land, you'll need to
keep an open mind and make time to try new things.  No better way than with the hundreds of examples and
the frequently celebrated BCX Help file.


Chris Boss

BSTR strings have many advantages not found in normal C string types.

First, I find that many indie programming languages support strings but there is a limit to their length. Not sure if BCX has this issue.

BSTRs are great for very huge strings.

Second, they are not null terminated. They can hold binary data. This is something I do a lot. Using pointers I can even embed other data types into a BSTR.

What data type (compared to Powerbasic) does BCX use for strings ?

Is there a limit to their size ?


Robert

Hi Chris, welcome to BCX.

The BCX COM parser has significant capabilities for dealing with variant data types. For details have a look at

https://bcxbasiccoders.com/webhelp/bcxhelp.htm?page=html%2Fcomcastconv.htm

There is an error on that page which I just noticed in the 'Variable data type declaration suffix' section.



The $ in
   
DIM D$

indicates that D is a double precision float variable.



is incorrect and should read



The $ in
   
DIM D$

indicates that D is string variable.


MrBcx

#8
Quote from: Chris Boss on April 04, 2024, 12:53:06 PM
Just curious:

Have you ever thought of adding the variable string data type used by Powerbasic (BSTR in C) as a native data type in BCX ?

I have found that BSTR's are far more powerful than typical C style null terminated strings. Bob Zale knew what he was doing when he used BSTR's for the string type.

BSTR as a native type would require a duplicate set of string functions and support, so that was never considered.
I believe Bob Zale's motivation in choosing BSTR's for PB's default string type was to appeal to VB programmers
looking to improve VB's notoriously sluggish performance by refactoring parts of their VB apps into speedier DLLs
to achieve this.  That instantly gave Bob a target audience ready to spend some more cash to help speed up
their sluggish apps.  It was a reasonable business decision at that time but it was (and still is) a small market.

It is possible to create BSTR variables directly in BCX and to interoperate with null-terminated C strings via the
built-in BCX functions: SYSSTR(), ANSITOWIDE(), and WIDETOANSI(), and their aliases.  Myself and others have
(in the distant past) written BCX code to interact with both standard dlls and COM dlls that were compiled using
PBWIN, so I know it's possible.  The main limitation is that PowerBasic seems never to enter the 64-bit landscape,
so any interacting with PowerBasic dlls will need to be done in 32-bit.


Chris Boss

My youtube channel if anyone wants to see my visual designer in action:

https://www.youtube.com/@ComputerWorkshopSoft/videos

My designer is by no means perfect, since I spent most of my efforts into designing the GUI framework it uses. I am just one man and can do only so much.

It also is currently only for development with my commercial GUI framework so many features and dialogs are geared towards that. To make something suited to BCX would require significant changes. I made some versions for Powerbasic's DDT years ago, some of which I offered as freeware.


Chris Boss

Just curious:

Have you ever thought of adding the variable string data type used by Powerbasic (BSTR in C) as a native data type in BCX ?

I have found that BSTR's are far more powerful than typical C style null terminated strings. Bob Zale knew what he was doing when he used BSTR's for the string type.

Back to Visual Designers:

Few may realize this, that when I created my GUI framework I built into it everything I learned about drag and drop Visual Designer design. The WIN32 API has no functionality (in a high level API) that does this. This is why many indie BASIC (and other) programming language developers have always had problems when it came to creating a Form editor. You can just use native commands in the compiler to accomplish this and must resort to the WIN32 API low level functions and that is not an easy task since there is no specific API's for this.

My approach was this:

(1) I built into my GUI framework a subclassing engine. This is absolutely required for visual design.
This allowed me to integrate features needed so controls created in a form editor can be dealt with.
In edit mode, the controls need to be mute (not respond to mouse) and pass on their mouse messages to the parent form.

(2) Drag handles are a pain and typically most who write their own code simple draw them on the form. I did differently.
I created my own Drag handle control and its job is to display all the drag handles at one time. The control uses window regions to make it non-rectangular so each drag handle is the only part of the control which is visible. By processing all the non-client and client window messages of the drag handle control I could make it the primary engine for the drag process. The Drag Handle control can be given a buddy control and it attaches itself to that control and will always stay above it in the zorder. If the drag handle control resizes, it automatically resizes its buddy control.

(3) The subclassing engine is a universal one (not a unique one per control) so the drag hande control can link itself directly into the subclassing engine and do complex stuff like drawing the drag rectangle when a new control is to be drawn. It can also display multiple draw rectangles for multiple controls as if one object. The drag operation moves drag rectangles, not the actual controls until it stops and then the buddy controls are all moved in one action.

I have seen other visual designers (ie. FireFly) where they do it different and while they can handle a few controls being dragged, when the number increased the flicker effect is very obvious.

My subclassing engine does the drag rectangles in one process and it copies the form background to a memory bitmap buffer, draws the drag rectangles for all the controls to that and the bitblts it to the screen. No flicker. I have tested it with literally hundreds of controls being dragged (drag rectangles) at one time. Once the drag process stops, all the drag rectangles are removed and all the buddy controls are moved in one clean step.

(4) Drag handle control has the ability to display handles either inside or outside of the buddy control.
I have seen others who simply draw the drag handles inside the control, since drawing then outside put the drawing onto the form or other controls. IMO drag handles look best outside the controls. Since I use a Drag handle control and it uses window regions it can display itself inside or outside of the buddy control with no problem. Also the drag handles can be made to any size you want (in pixels). The control simply redefines itself internally and the generates a new window region to match and then draws the handles in the appropriate place.

(5) The subclassing engine can turn edit mode of Drag handle controls and the controls on the form ON or off. When ON the controls do not respond to the mouse, but only the drag handle control does. When off, the drag handles are hidden and the controls can act normally. This makes it possible to have a "Test" mode for the form using the same controls.

(6) Lastly, most visual designers use a Property Listbox stype control for editing properties. Since this control does not exist in the standard system controls, I had to create my own. It is not perfect, but it does the job well. It can have properties which are text, numbers, drop down lists, display font dialog, display files dialog and colors dialog. The Property Listbox control has its own child controls which is displays when needed.

Maybe i can pass on some of my experience to others who are interested in building a Visual Designer.


MrBcx

Hi Chris,

I think you'll find the BCX source very easy to read and understand for your designer/editor related projects.
Check out the User Contribution section of this forum too - lots of recent uploads showing off recently
added capabilities.

Sadly, several of original contributors to the Form Designer have passed away and several others are
not active anymore.  There's a lot of life left in the BCX project for those that embrace its way of making apps.

Finally, the BCX Help file (.chm and on the web) is a tremendous resource, as is this forum. 
If you get stuck on anything, or are curious about something, just ask. 

Chris Boss

Very interesting !

If you ever need any help or suggestions on the Visual Designer feel free to ask. It is one of my specialties!

I am impressed with the latest 64 bit IDE and the compiler. Also nice it leaves behind the generated C code.

I am in the process of taking a deeper look into BCX now (checked it out many years ago) and it appears it has come a long way.

I created a few freeware Dialog editors for Powerbasic's DDT command set years ago, but may be worth my time to create one for BCX.

Took me years just to learn how to make Visual Designers. Windows does not have a low level Visual Designer drag and drop engine in the WIN32 API, so had to build one myself. Designed my own custom control called a Drag handle control which is easy to use. Simply supply it with a "buddy" control window handle it handles all the hard work. Also can work in concert with other drag handle controls for dragging multiple controls at one time. I tested it with hundreds of controls at one time and it could drag them all with no flicker.

I downloaded your designer and will check it out.

If BCX is good enough for my needs may even see if I can port EZGUI framework to BCX.

MrBcx

Quote from: airr on December 28, 2022, 01:20:00 PM
I was playing around with the OOP option in this, and in order to compile the output source with MinGW-Nuwen I had to add the '-fpermissive' flag to change errors about 'default arguments' into warnings....

AIR.

FWIW - I can compile without the -fpermissive flag when using the Equation Solutions distro.

airr

I was playing around with the OOP option in this, and in order to compile the output source with MinGW-Nuwen I had to add the '-fpermissive' flag to change errors about 'default arguments' into warnings....

AIR.

MrBcx

#1
I completed some code cleanup on the last version of Mike Henning's BCX Mini Form Designer and got it to build using BCX 752 (and the forthcoming 753) and using Pelles C version 10.  I've included my 3 batch files for rebuilding this with Pelles C.

At one point, I got it to compile with MSVC but it would not run.  I also got it to compile as a 64-bit app using Pelles C, and it initially looked promising, but after using the 64-bit version for a little while, it became obvious that the controls were not responding correctly.  So my recommendation is to use only Pelles C and only compile as a 32-bit app, if you want to tinker.  Be sure to adjust the Pelles paths in _pd32.bat and _pw32.batBuild.bat will take care of the rest.

The attached zip (UPDATED 9/28/2021) contains the executables and dll needed to start using BMFD right away.   Although not extensively tested, it seems stable and appears to be functioning correctly.  Thanks to all the contributors for their effort and talent that went into BCX Mini Form Designer.  I'm pleased that the current generation of build tools will help keep it alive and hopefully moving forward.