Control style in Basic4ppc

ExcludeReality

Active Member
Licensed User
I use Basic4ppc mostly to create desktop applications, and there is something that's always been annoying me.
All the controls on desktop have the visual style of Windows 2000 (Or some other early windows-version).

When you run an application on a phone the control style changes to the Windows-mobile style.
Why doesen't the same thing happend with Vista?
 

Cableguy

Expert
Licensed User
Longtime User
I use Basic4ppc mostly to create desktop applications, and there is something that's always been annoying me.
All the controls on desktop have the visual style of Windows 2000 (Or some other early windows-version).

When you run an application on a phone the control style changes to the Windows-mobile style.
Why doesen't the same thing happend with Vista?

I believe your apps use native B4p Form...
Try to use a FormEx control, from Agraham's dll, and you'll seem the diference..
 

ExcludeReality

Active Member
Licensed User
None of the suggestions worked.
The manifest thing didn't do anything at all.
Cableguy, I do not fully understand how to add a control from the FormExDesktop library.
Don't you mean ControlExDesktop?
:sign0085:
 

Pachuquin

Member
Licensed User
Longtime User
I think that you have not understand it well.

Try this utility to create the manifest file easier.


XP Look 1.0

You have to select your exe file and the utility will create the manifest file.
 

ExcludeReality

Active Member
Licensed User
First of all I'm using Vista. Consequently I fail to see why I should make an XP manifest file.
And also, I wanted an answer from someone who could tell me why Basic4ppc doesn't adjust the style of basic controls (Buttons, Combo boxes, Check boxes...) depending on how thoose controls should look like!
 

agraham

Expert
Licensed User
Longtime User
First of all I'm using Vista. Consequently I fail to see why I should make an XP manifest file.
Getting shirty when people are trying to help is not a good idea. :(

You DO need a manifest file, there are other options if you have Visual Studio or the SDK but manifests are easiest.

Most controls adapt automatically but you also need to use the Door library to set the FlatStyle property of Buttons, CheckBoxes And RadioButtons to "System" to get them drawn according to a theme.
 

Attachments

  • manifests.zip
    34.9 KB · Views: 314
Last edited:

ExcludeReality

Active Member
Licensed User
It works! Thank you so much Agraham and Pachuquin! :sign0060:
I didn't even think it was possible.

And :sign0013: if i was disrespectful
 

agraham

Expert
Licensed User
Longtime User
A bit of research later and using the Door library I got it to work without a manifest file. :) This works on .NET 2.0 and later.

EDIT:- Note that on .NET 2.0 Buttons, CheckBoxes and RadioButtons no longer need their FlatStyle properties altered to support visual styles. I have amended the attachment accordingly
 

Attachments

  • testapp.sbp
    1.1 KB · Views: 307
Last edited:

Zenerdiode

Active Member
Licensed User
This works on .NET 2.0 and later.

...and these four lines of code are burned into all of my desktop applications. :sign0060:

Will it throw an exception if this is run on a Windows 2000 platform?

Interestingly, when run in the IDE, the IDE itself adopts the Windows XP style.
 

Attachments

  • IDEStyle.JPG
    IDEStyle.JPG
    43.6 KB · Views: 305

agraham

Expert
Licensed User
Longtime User
Will it throw an exception if this is run on a Windows 2000 platform?
I don''t know, probably not as it is a .NET Framework facility which I would hope would find out if the the OS supported visual styles and fail gracefully if not. You could always ErrorLabel it to make sure.

B4X:
Sub SetAppStyle
  ErrorLabel(StyleErr)
  obj1.New1(False)
  obj1.CreateNew("System.Windows.Forms.Application" & obj1.System_Windows_Forms)
  obj1.RunMethod("EnableVisualStyles")
  obj1.SetProperty("VisualStyleState", "ClientAndNonClientAreasEnabled")
StyleErr:
End Sub
 
Top