Connecting Tech Pros Worldwide Help | Site Map

Attaching a label to a BOX

Armando
Guest
 
Posts: n/a
#1: Nov 13 '05
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


B. Austin
Guest
 
Posts: n/a
#2: Nov 13 '05

re: Attaching a label to a BOX


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
[color=blue]
>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
>[/color]

(Remove NOSPAM to reply.)
B. Austin
Guest
 
Posts: n/a
#3: Nov 13 '05

re: Attaching a label to a BOX


Armando -

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

- Brian
[color=blue][color=green]
>>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
>>[/color]
>
>(Remove NOSPAM to reply.)[/color]

(Remove NOSPAM to reply.)
Justin Hoffman
Guest
 
Posts: n/a
#4: Nov 13 '05

re: Attaching a label to a BOX



"Armando" <armando@bogusaddress.com> wrote in message
news:KwW7e.1061$4a.101279@news1.epix.net...[color=blue]
> 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[/color]


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


Phil Stanton
Guest
 
Posts: n/a
#5: Nov 13 '05

re: Attaching a label to a BOX


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" <armando@bogusaddress.com> wrote in message
news:KwW7e.1061$4a.101279@news1.epix.net...[color=blue]
> 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
>
>[/color]


Armando
Guest
 
Posts: n/a
#6: Nov 13 '05

re: Attaching a label to a BOX


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:d3qefg$n7o$1@hercules.btinternet.com...[color=blue]
>
> "Armando" <armando@bogusaddress.com> wrote in message
> news:KwW7e.1061$4a.101279@news1.epix.net...[color=green]
> > Hey gurus -
> >
> > Access 2000 - I have a form with a series of box controls forming a map[/color][/color]
of[color=blue][color=green]
> > 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[/color][/color]
both[color=blue][color=green]
> > the box and the label (or force the user to click on the background[/color][/color]
only).[color=blue][color=green]
> > 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[/color]
>
>
> 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
>
>[/color]


Armando
Guest
 
Posts: n/a
#7: Nov 13 '05

re: Attaching a label to a BOX


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" <philnoxx@xxstantonfamily.co.uk> wrote in message
news:4260f0c6$0$556$ed2e19e4@ptn-nntp-reader04.plus.net...[color=blue]
> Have a look at Stephen Lebans (http://www.lebans.com) cmdbutton. As far as[/color]
I[color=blue]
> remember that allows coloured command buttons with labels
>
> HTH
>
> Phil[/color]



Closed Thread


Similar Microsoft Access / VBA bytes