jads


When running a VB6 program on Vista that has checkboxes and/or radio buttons,, and you tab between the fields, you cannot see which of the fields has focus. In XP it showed focus by putting a rectangle around the checkbox and its caption, which does not occur on Vista.

The program is using a manifest embedded as a resource to use xp/vista themes.

You can replicate by placing some checkboxes and a text box on a form and compile as a standard exe. run on XP and you can see which field has focus. Run on Vista and you can only see when the textbox gets focus.



Re: Vista:VB6 Checkboxes and Radio buttons dont show that they get focus when tabbed onto when using MS Windows common controls 6

magic ink


For me behaviour is the same under both OSs. I'm getting no indication of the current checkbox under Vista and XP when XP display style is set with a manifest file. When a manifest file is not present both OSs do show the current checkbox with a rectangluar outline.





Re: Vista:VB6 Checkboxes and Radio buttons dont show that they get focus when tabbed onto when using MS Windows common controls 6

jads

Any idea why the checkbox is not being indicated as the current one The form I am using is pretty basic:

form content is

Code Snippet

VERSION 5.00
Begin VB.Form Form1
Caption = "Form1"
ClientHeight = 3195
ClientLeft = 60
ClientTop = 450
ClientWidth = 5145
LinkTopic = "Form1"
ScaleHeight = 3195
ScaleWidth = 5145
StartUpPosition = 3 'Windows Default
Begin VB.CommandButton Command1
Caption = "Command1"
Height = 375
Left = 3480
TabIndex = 5
Top = 360
Width = 1215
End
Begin VB.CheckBox Check2
Caption = "Check2"
Height = 375
Left = 480
TabIndex = 4
Top = 2520
Width = 1455
End
Begin VB.PictureBox Picture1
BorderStyle = 0 'None
Height = 975
Left = 360
ScaleHeight = 975
ScaleWidth = 2415
TabIndex = 6
TabStop = 0 'False
Top = 960
Width = 2415
Begin VB.OptionButton Option2
Caption = "Option2"
Height = 375
Left = 120
TabIndex = 2
Top = 480
Width = 1575
End
Begin VB.OptionButton Option1
Caption = "Option1"
Height = 375
Left = 120
TabIndex = 1
Top = 120
Width = 1455
End
End
Begin VB.TextBox Text1
Height = 375
Left = 480
TabIndex = 3
Text = "Text1"
Top = 2040
Width = 3735
End
Begin VB.CheckBox Check1
Caption = "Check1"
Height = 375
Left = 480
MaskColor = &H8000000F&
TabIndex = 0
Top = 360
UseMaskColor = -1 'True
Width = 1335
End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
' Init common controls function, so that control styles can be set
Private Type t_Flgs
dwSize As Long
dwICC As Long
End Type
Private Declare Sub InitCommonControlsEx Lib "comctl32.dll" (s As Any)

Private Sub Form_Initialize()
Dim tC As t_Flgs

tC.dwSize = Len(tC)
tC.dwICC = -1
InitCommonControlsEx tC

End Sub

Manifest is

Code Snippet


<ASSEMBLYIDENTITY
version="1.0.0.0"
processorArchitecture="X86"
name="Project1"
type="win32"
/>
Classic


<ASSEMBLYIDENTITY
type="win32"
name="Microsoft.Windows.Common-Controls"
version="6.0.0.0"
processorArchitecture="*"
publicKeyToken="6595b64144ccf1df"
language="*"
/>




And the project file

Code Snippet

Type=Exe
Form=Form1.frm
Reference=*\G{00020430-0000-0000-C000-000000000046}#2.0#0#..\..\..\WINDOWS\system32\stdole2.tlb#OLE Automation
ResFile32="Manifest.res"
IconForm="Form1"
Startup="Form1"
ExeName32="Project1.exe"
Command32=""
Name="Project1"
HelpContextID="0"
CompatibleMode="0"
MajorVer=1
MinorVer=0
RevisionVer=0
AutoIncrementVer=0
ServerSupportFiles=0
VersionCompanyName=""
CompilationType=0
OptimizationType=0
FavorPentiumPro(tm)=0
CodeViewDebugInfo=0
NoAliasing=0
BoundsCheck=0
OverflowCheck=0
FlPointCheck=0
FDIVCheck=0
UnroundedFP=0
StartMode=0
Unattended=0
Retained=0
ThreadPerObject=0
MaxNumberOfThreads=1

[MS Transaction Server]
AutoRefresh=1






Re: Vista:VB6 Checkboxes and Radio buttons dont show that they get focus when tabbed onto when using MS Windows common controls 6

Bruce N. Baker - MSFT

Searching for any possible info on this turned up zippo. My suggestion that if you continue to have issues with VB6 and this to contact VB support.

http://msdn.microsoft.com/vbasic/support/






Re: Vista:VB6 Checkboxes and Radio buttons dont show that they get focus when tabbed onto when using MS Windows common controls 6

magic ink

Yep. VB6 Checkboxes and Radio buttons dont show that they get focus when tabbed onto when using MS Windows common controls 6

but the upside is that in Vista if you have Command buttons on a Frame Control you no longer have to put them within a Picture to avoid the black borders, text in the caption of a Frame Control will also display as intended. Option buttons on a Frame Control also appear to display as intended without placing them into a Picture Control.

Hav'nt experimented myself but may be you could try changing the backcolor of a Control in its Get/Lost Focus events to indicate it is current.





Re: Vista:VB6 Checkboxes and Radio buttons dont show that they get focus when tabbed onto when using MS Windows common controls 6

jads

Yes have tried that and it does work, bit of a pain though when there are many checkboxes and radio buttons.

Also have to run on XP as well as Vista, so cannot remove picture boxes as containers on frames





Re: Vista:VB6 Checkboxes and Radio buttons dont show that they get focus when tabbed onto when using MS Windows common controls 6

Ronny S.

I recently came over the same problem. If you want to have an application that work correct on XP and Vista you have 2 possibilities.

1. Put a Picturebox inside of every Frame that contains radio-buttons.

2. Replace the Frame control with another that does everything ok

If you want your app to display the focus correct (I think you have the same problem with the command-buttons) there is 1 workaround and 1 solution

1. To workaraound you have to turn on the accelerator-keys in windows system settings.

2. you have to subclass every form to capture the keyboard input and then pass a message to your form in case the Alt- or Tab-Keys are pressed. Windows-XP and Vista do only show the focus and accelerator-keys when you press a key.

There are freeware-controls that you can use: http://www.timosoft-software.de

Try the Button-Controls. I think there are code-samples which also include the subclassing to display focus.

Currently I am working on a project to automate the steps of replacing the VB.Frame control with the Framecontrol from timosoft. The project isn't finished jet, because it's harder than I thought....

I hope this helps...






databaseforum