By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
443,742 Members | 1,227 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 443,742 IT Pros & Developers. It's quick & easy.

Attaching a label to a BOX

P: n/a
Hey gurus -

Access 2000 - I have a form with a series of box controls forming a map of
clickable areas, and I want each one to have a label. No problem, just put
'em on, right? But I also want the box/label combination to act as a single
item when clicked - that is, not have to put the same OnClick code on both
the box and the label (or force the user to click on the background only).
I've tried attaching the label to the box (by cutting the label then
highlighting the box and pasting it) to try to make the text clickable, like
checkboxes and option buttons work, but they don't stick together.

I can't make the boxes into command buttons, because I need to set the
bgcolor of each one to show its status. I suppose I could use cb's with
colored captions, but it's not as visually intuitive.

Ideas?

Armando
Nov 13 '05 #1
Share this Question
Share on Google+
6 Replies


P: n/a
Armando -

This is a trick that works in Access 97 and probably A2K also.

Highlight the label and cut it to the clipboard (Ctl-X). Then highlight the control and paste
(Ctl-V).

The label will come back and will be attached to the control that you highlighted.

- Brian
Hey gurus -

Access 2000 - I have a form with a series of box controls forming a map of
clickable areas, and I want each one to have a label. No problem, just put
'em on, right? But I also want the box/label combination to act as a single
item when clicked - that is, not have to put the same OnClick code on both
the box and the label (or force the user to click on the background only).
I've tried attaching the label to the box (by cutting the label then
highlighting the box and pasting it) to try to make the text clickable, like
checkboxes and option buttons work, but they don't stick together.

I can't make the boxes into command buttons, because I need to set the
bgcolor of each one to show its status. I suppose I could use cb's with
colored captions, but it's not as visually intuitive.

Ideas?

Armando


(Remove NOSPAM to reply.)
Nov 13 '05 #2

P: n/a
Armando -

Sorry for the wasted post, I overlooked the last sentence of your first paragraph. Apparently
rectangle controls don't know about labels...

- Brian
Hey gurus -

Access 2000 - I have a form with a series of box controls forming a map of
clickable areas, and I want each one to have a label. No problem, just put
'em on, right? But I also want the box/label combination to act as a single
item when clicked - that is, not have to put the same OnClick code on both
the box and the label (or force the user to click on the background only).
I've tried attaching the label to the box (by cutting the label then
highlighting the box and pasting it) to try to make the text clickable, like
checkboxes and option buttons work, but they don't stick together.

I can't make the boxes into command buttons, because I need to set the
bgcolor of each one to show its status. I suppose I could use cb's with
colored captions, but it's not as visually intuitive.

Ideas?

Armando


(Remove NOSPAM to reply.)


(Remove NOSPAM to reply.)
Nov 13 '05 #3

P: n/a

"Armando" <ar*****@bogusaddress.com> wrote in message
news:Kw******************@news1.epix.net...
Hey gurus -

Access 2000 - I have a form with a series of box controls forming a map of
clickable areas, and I want each one to have a label. No problem, just
put
'em on, right? But I also want the box/label combination to act as a
single
item when clicked - that is, not have to put the same OnClick code on both
the box and the label (or force the user to click on the background only).
I've tried attaching the label to the box (by cutting the label then
highlighting the box and pasting it) to try to make the text clickable,
like
checkboxes and option buttons work, but they don't stick together.

I can't make the boxes into command buttons, because I need to set the
bgcolor of each one to show its status. I suppose I could use cb's with
colored captions, but it's not as visually intuitive.

Ideas?

Armando

Here is one possibilty to handle this sort of thing - this form has two
box/label combinations:

Private Sub HandleClick(strBox As String)

Select Case strBox

Case "One"
MsgBox "Do this!"

Case "Two"
MsgBox "Do that!"

Case Else
MsgBox "Do what?"

End Select

End Sub

Private Sub boxOne_Click()
HandleClick "One"
End Sub

Private Sub lblOne_Click()
HandleClick "One"
End Sub

Private Sub boxTwo_Click()
HandleClick "Two"
End Sub

Private Sub lblTwo_Click()
HandleClick "Two"
End Sub
Nov 13 '05 #4

P: n/a
Have a look at Stephen Lebans (http://www.lebans.com) cmdbutton. As far as I
remember that allows coloured command buttons with labels

HTH

Phil
"Armando" <ar*****@bogusaddress.com> wrote in message
news:Kw******************@news1.epix.net...
Hey gurus -

Access 2000 - I have a form with a series of box controls forming a map of
clickable areas, and I want each one to have a label. No problem, just
put
'em on, right? But I also want the box/label combination to act as a
single
item when clicked - that is, not have to put the same OnClick code on both
the box and the label (or force the user to click on the background only).
I've tried attaching the label to the box (by cutting the label then
highlighting the box and pasting it) to try to make the text clickable,
like
checkboxes and option buttons work, but they don't stick together.

I can't make the boxes into command buttons, because I need to set the
bgcolor of each one to show its status. I suppose I could use cb's with
colored captions, but it's not as visually intuitive.

Ideas?

Armando

Nov 13 '05 #5

P: n/a
Hi Justin -

Yup, this is exactly what I'm doing now, just send the same call from both
the box and the label, then do the actual work in the called sub, after
deciding what was clicked. I was hoping to get this down to a single call
from each box, mostly to make it more generalizable for users who have a
different physical-metaphor map. But this isn't THAT bad - thanks for the
second opinion.

Armando

"Justin Hoffman" <j@b.com> wrote in message
news:d3**********@hercules.btinternet.com...

"Armando" <ar*****@bogusaddress.com> wrote in message
news:Kw******************@news1.epix.net...
Hey gurus -

Access 2000 - I have a form with a series of box controls forming a map of clickable areas, and I want each one to have a label. No problem, just
put
'em on, right? But I also want the box/label combination to act as a
single
item when clicked - that is, not have to put the same OnClick code on both the box and the label (or force the user to click on the background only). I've tried attaching the label to the box (by cutting the label then
highlighting the box and pasting it) to try to make the text clickable,
like
checkboxes and option buttons work, but they don't stick together.

I can't make the boxes into command buttons, because I need to set the
bgcolor of each one to show its status. I suppose I could use cb's with
colored captions, but it's not as visually intuitive.

Ideas?

Armando

Here is one possibilty to handle this sort of thing - this form has two
box/label combinations:

Private Sub HandleClick(strBox As String)

Select Case strBox

Case "One"
MsgBox "Do this!"

Case "Two"
MsgBox "Do that!"

Case Else
MsgBox "Do what?"

End Select

End Sub

Private Sub boxOne_Click()
HandleClick "One"
End Sub

Private Sub lblOne_Click()
HandleClick "One"
End Sub

Private Sub boxTwo_Click()
HandleClick "Two"
End Sub

Private Sub lblTwo_Click()
HandleClick "Two"
End Sub

Nov 13 '05 #6

P: n/a
Phil -

This always seems to be the answer to questions like this, and I STILL
forget to do it first. Thanks, I'll look there.

Armando

"Phil Stanton" <ph******@xxstantonfamily.co.uk> wrote in message
news:42*********************@ptn-nntp-reader04.plus.net...
Have a look at Stephen Lebans (http://www.lebans.com) cmdbutton. As far as I remember that allows coloured command buttons with labels

HTH

Phil


Nov 13 '05 #7

This discussion thread is closed

Replies have been disabled for this discussion.