The BUTTON window class is the base windows class for the Command, Frame, Option, and CheckBox Ocx controls. These different OCX controls are created by passing a special BUTTON window style (BS_) in the style parameter of the CreateWindowExA() Windows API.
|GFABASIC 32 Ocx||BUTTON window Style|
|CheckBox||BS_CHECKBOX, BS_AUTOCHECKBOX, BS_3STATE, and BS_AUTO3STATE|
|Option||BS_RADIOBUTTON and BS_AUTORADIOBUTTON|
As you can see the names of the Ocx controls conform to VB control names, which was one of the main changes in the GFA-BASIC 32 development. Another thing adapted from VB is the ability to change the controls behavior and appearance through properties. These are either changed in the Properties sidebar in the form-editor or in source code using the COM properties interfaces. In this case it doesn't matter how the appearance is changed, but how GFA-BASIC 32 implements the VB compatible behavior.
First of all, the implementation is VB compatible, but totally different. In most case (if not all) the GB32 implementation of properties and methods is much faster and cleaner. VB and VB.NET are snakes compared to the fast performance of GB32 applications. Currently, performance doesn't count as strong as in previous decades, but still. Maybe with Windows 7 for Tablets performance and size counts again. Who knows?
The BUTTON control sends the WM_CTLCOLORBTN message to the parent window of a button when the button is about to be drawn. By responding to this message, the parent window can set a button's text and background colors. In GFA-BASIC 32 applications without the Visual Styles enabled this works as documented. However, when an application is accompanied with a manifest the new Visual Styles are applied and take precedence over the GFA-BASIC implementation.
When the Windows OS encounters a manifest file, the OS uses a different version of the common control library and globally subclasses all Windows controls, including the 'old standard' controls like the BUTTON class. GFA-BASIC 32 wasn't developed when the Visual Styles were around and uses a speedy drawing algorithm based on the classic behavior of the BUTTON class drawing. As a result, the Visual Styles improvement is not applied to the text color of the BUTTON class.
ForeColor cannot be set
Thus, the text color of Command, CheckBox, Option, and Frame Ocx cannot be changed by changing their ForeColor property when using a manifest file.
When you really need to change the text color I'm not sure how to proceed, so you are your own there...
I'am interesting in change of the button style in GFA Basic 32.
I ask the in the mailing list but non of the member answered.
1) I downloaded the latest version of GFA. In the interpreter the buttons are in roundstyle, but after running the code as exe the button have the old style.
Here you can see the difference between the too styles. How can I get the roundsytle buttons in the runtime exe too?
Use the Manifest File, the GFABASIC32 package includes a GfaWin32.Exe.Manifest file. When the IDE is started this file forces the program to use the Windows XP Visual styles. To support visual styles in your own programs you must supply a manifest file as well. You can simply copy the GfaWin32.Exe.Manifest and replace the first part of the manifest's filename ('GfaWin32') with the name of your own executable.ReplyDelete