Two different type of Label? (1 Viewer)

theDBguy

I’m here to help
Staff member
Local time
Today, 08:33
Joined
Oct 29, 2018
Messages
19,164
There's some hope there.
I will try and test the timer idea. If the result somehow satisfies the users we will go with that.
Otherwise I'll go with shift click or ctrl click.

I think I can manage the code.
Million thanks for the idea.
You're welcome. We're happy to assist. Good luck with your project.
 

The_Doc_Man

Immoderate Moderator
Staff member
Local time
Today, 10:33
Joined
Feb 28, 2001
Messages
23,150
Please note that Windows gets involved here because the timing of a double-click is a system setting. Relying on the timer will be sketchy depending on how fast or slow you have set the mouse button-sensitivity speed.

 

MajP

You've got your good things, and you've got mine.
Local time
Today, 11:33
Joined
May 21, 2018
Messages
6,437
Would left click right click work? Left click changes the state. Right click runs whatever. If I was doing this I would trap the mouse down event. If the "button" = 2 (right click) then run your function. Easier than all of these other workarounds.
 

KitaYama

Active member
Local time
Tomorrow, 00:33
Joined
Jan 6, 2022
Messages
537
Would left click right click work? Left click changes the state. Right click runs whatever. If I was doing this I would trap the mouse down event. If the "button" = 2 (right click) then run your function. Easier than all of these other workarounds.
If it works, your suggestion is much easier to maintain. I'm not in front of a PC to test. Doesn't right click show the context menu?
 

KitaYama

Active member
Local time
Tomorrow, 00:33
Joined
Jan 6, 2022
Messages
537
Please note that Windows gets involved here because the timing of a double-click is a system setting. Relying on the timer will be sketchy depending on how fast or slow you have set the mouse button-sensitivity speed.

While driving back home, I was exactly thinking the same thing.
Thanks for mentioning though.
 

MajP

You've got your good things, and you've got mine.
Local time
Today, 11:33
Joined
May 21, 2018
Messages
6,437
Doesn't right click show the context menu?
Code:
Private Sub Check0_GotFocus()
  Me.ShortcutMenu = False
End Sub

Private Sub Check0_LostFocus()
  Me.ShortcutMenu = True
End Sub
 

KitaYama

Active member
Local time
Tomorrow, 00:33
Joined
Jan 6, 2022
Messages
537
Code:
Private Sub Check0_GotFocus()
  Me.ShortcutMenu = False
End Sub

Private Sub Check0_LostFocus()
  Me.ShortcutMenu = True
End Sub
@MajP I really don't know how to appreciate you.
It's Sunday 1:33 AM here. I'll try it Monday morning as soon as I'm back to my desk.

Thanks again.
 

Uncle Gizmo

Nifty Access Guy
Staff member
Local time
Today, 16:33
Joined
Jul 9, 2003
Messages
14,646
Otherwise I'll go with shift click or ctrl click.

I answered a similar question for Farz... Here is a video explanation:-


If you'd like a free copy of the code, please send a private message in this forum....
 

MajP

You've got your good things, and you've got mine.
Local time
Today, 11:33
Joined
May 21, 2018
Messages
6,437
@MajP I really don't know how to appreciate you
You will have to test the concept to see if it works. With a standard option group it does not. I am not sure how you are designing this.
 

strive4peace

AWF VIP
Local time
Today, 10:33
Joined
Apr 3, 2020
Messages
921
hi @KitaYama

> "Is there any way to fire a function for an associated label?"

no, there isn't. Therefore, what I do in cases where the label needs events, is to cut it and then paste it with nothing selected, than change it's Name to be logical, then:

CLICK event is SetFocus to control that would be associated -- so it behaves as Access would if it was associated. However, if you don't want the label to automatically change the value, then either pop a MsgBox to ask, do something else, or do nothing (that helps Double-Click to properly fire)

Perhaps use Right-Click to do something else -- to me, that's more reliable than Double-click since you have to accomodate if Click happens because the 2nd click wasn't fast enough. Capture right-click in the MouseUp event

> Run a function with any events of check box or its label without changing checkbox state

perhaps use a small command button instead? Maybe with something like as caption?
 

KitaYama

Active member
Local time
Tomorrow, 00:33
Joined
Jan 6, 2022
Messages
537
With a standard option group it does not. I am not sure how you are designing this.
It's not option group. There are several checkboxes. Anyhow the idea is promising. I will try and report back.

thanks again.
 

Pat Hartman

Super Moderator
Staff member
Local time
Today, 11:33
Joined
Feb 19, 2002
Messages
36,868
Is there any way to fire a function for an associated label?
No, label events are transferred to the associated control. That means you also can't use both click and double-click.

Using a command button works but I would have just disassociated the label. That way I could use the double click on the label and the click on the control. You don't want to use the double click on the control if the field can be edited because the double click would interfere with editing.

Sorry, I see Crystal already posted the same advice.
 

Users who are viewing this thread

Top Bottom