Same Sub for several Events ???? (2 Viewers)

isladogs

MVP / VIP
Local time
Today, 00:21
Joined
Jan 14, 2017
Messages
18,297
Because it's a tree-like structure of text boxes showing a person and his ancestors.

OK - have you considered using a treeview control instead?
 

isladogs

MVP / VIP
Local time
Today, 00:21
Joined
Jan 14, 2017
Messages
18,297
In this demo there are 26 controls and they are acting on 5 events. This would normally require about 100 event procedures. There is 0.

Looks good. I'm sure i can make use of the ideas as well

I haven't studied the code yet but one suggestion if that OK.
In the top group, buttons and textboxes show ...Has Focus after clicking on them... BUT the button captions/textboxes still say ...Has Focus after clicking another object.

Suggest only the most recent clicked object shows the Has Focus and the others revert to 'normal'
 

MajP

You've got your good things, and you've got mine.
Local time
Yesterday, 19:21
Joined
May 21, 2018
Messages
8,700
I haven't studied the code yet but one suggestion if that OK.
In the top group, buttons and textboxes show ...Has Focus after clicking on them... BUT the button captions/textboxes still say ...Has Focus after clicking another object.

Suggest only the most recent clicked object shows the Has Focus and the others revert to 'normal'
This was just a simple demo for the OP and did not put much thought into it, not something I would post in the code forum. Probably should have put "I once received focus"

I find that 99% of the time just using a simple function to handle the events is all that is needed. I do not know if I actually used this class, but the concepts of using with events on Access objects I use in almost all of my class modules.
The OPs example is one of the rare cases this class would have utility because of the mouse down event arguments. The other is a bunch of labels since they cannot receive focus and be the active control.
 

Users who are viewing this thread

Top Bottom