Increase focus rectangle thickness for Ultra-HD screens (1 Viewer)

wisekat

Registered User.
Local time
Today, 03:58
Joined
Feb 16, 2017
Messages
18
I am using an MS Access 2016 database on an Ultra-HD screen with 282ppi. When I move the input focus to a button using the TAB key, it's very hard to recognize the focused button as the focus rectange is just a 1-pixel dotted line. Perhaps, you'll notice the focus rectangle on the first button 'Name' on the picture below easy on an ordinary 96ppi screen, but it's very hard to see on a high-resolution screen:

Is there a way to increase the thickness of the focus rectangle line in MS Access? Perhaps, you can also suggest another solution how to make an active button more noticeable for the user.
 

CJ_London

Super Moderator
Staff member
Local time
Today, 01:58
Joined
Feb 19, 2013
Messages
12,092
you can use the onenter/exit or ongotfocus/lostfocus events to change what the control looks like

create a new module and enter the following

Code:
function changeborder()
    screen.activecontrol.borderwidth=5 '- modify to what is OK for you
end function

function restoreborder()
    screen.activecontrol.borderwidth=1
end function
then in form design, select all the controls you want to apply this effect and on the propertysheet events tab put

=changeborder() against the on enter event and
=restoreborder() against the on exit event
 

wisekat

Registered User.
Local time
Today, 03:58
Joined
Feb 16, 2017
Messages
18
Yes, I know that I can do something with my buttons when they get/lose input focus. I already tried changing the background color in the GotFocus/LostFocus event handlers. Unfortunately, that's a bad idea as we need to duplicate this code this for every (!) button on a form. I am still hoping there is a more elegant solution...
 

CJ_London

Super Moderator
Staff member
Local time
Today, 01:58
Joined
Feb 19, 2013
Messages
12,092
read my post again - there is no code in the form as far as this is concerned
 

CJ_London

Super Moderator
Staff member
Local time
Today, 01:58
Joined
Feb 19, 2013
Messages
12,092
if you don't want to use code, use conditional formatting
 

missinglinq

AWF VIP
Local time
Yesterday, 20:58
Joined
Jun 20, 2003
Messages
6,355
if you don't want to use code, use conditional formatting
You can't use Conditional Formatting on Command Buttons, but you could use Textboxes, tweaked to look like Buttons, and then use their OnClick events for their function.

Linq ;0)>
 

CJ_London

Super Moderator
Staff member
Local time
Today, 01:58
Joined
Feb 19, 2013
Messages
12,092
hadn't noticed they were buttons - so scrap the conditional formatting suggestion
 

wisekat

Registered User.
Local time
Today, 03:58
Joined
Feb 16, 2017
Messages
18
read my post again - there is no code in the form as far as this is concerned
Yes, you are almost right as we still need to write some code and attach it manually to the required controls - though we do it with the Property Sheet.

But thank you for suggesting this alternative way of doing what I need. At least, the code module will be less cluttered with typical duplicated event handlers.

The problem of both approaches is that we need to remember to do the same thing for all new controls on our forms. It would be nice to have a global setting for all forms...
 

CJ_London

Super Moderator
Staff member
Local time
Today, 01:58
Joined
Feb 19, 2013
Messages
12,092
well you can automate it on opening the form

in the module put

Code:
function setForm(frm as form)
dim ctrl as control
 
for each ctrl in frm.controls
    on error resume next ' in case ctrl does not have these event properties
    ctrl.onenter="=changeborder()"
    ctrl.onexit="=restoreborder()"
next ctrl
end function
and in the form open event put

=setForm([Form])

You can also create a form template. In access, go to help and search for 'Specify a new template for forms and reports'.
 

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

Top Bottom