Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

making a text box behave like a button

716 views
Skip to first unread message

Peter Gumbrell

unread,
Dec 13, 2000, 8:11:33 AM12/13/00
to
I have a form in which a combo box selection produces a set of subheadings.
Selection of one of these headings will produces a further selection of
items. I have formatted the textboxes for these subheadings to look like
buttons, but I would also like them to act like buttons when they are
clicked.
Does anyone know of a way to do this?

Many thanks,

Peter


Dale Fye

unread,
Dec 13, 2000, 9:32:55 AM12/13/00
to
Instead of using a text box for your "headings", use a label. Change the caption property of the label based on the
value in your combo box, then put some code in the OnClick event of the label.

"Peter Gumbrell" <pe...@orillia.net> wrote in message news:#0JxEYQZAHA.388@tkmsftngp04...

Peter Gumbrell

unread,
Dec 13, 2000, 12:24:31 PM12/13/00
to
Thanks, Dale, but I need some help here. How do I get the labels to have the
same text as the text boxes. I was using code to pull the appropriate
heading from a query. In some cases there are three headings, in some cases,
there are five.

Peter
"Dale Fye" <df...@REMOVEiitri.org> wrote in message
news:#W0oMnQZAHA.1928@tkmsftngp02...

Sandra Daigle

unread,
Dec 13, 2000, 6:18:13 PM12/13/00
to
What do you mean by "act like buttons when they are clicked"? You can
just create an OnClick event to get some code to fire - are you
looking for something else?

Sandra Daigle

"Peter Gumbrell" <pe...@orillia.net> wrote in message
news:#0JxEYQZAHA.388@tkmsftngp04...

Peter Gumbrell

unread,
Dec 13, 2000, 9:52:45 PM12/13/00
to
What I would like is the user to click in what is a textbox, but not to be
able to modify the text in any way. I thought that if the text box looked
like a button and behaved like a button when clicked (by changing in some
way: text colour, special effect, etc.) then this would prevent user
modification of the text. I find that if I lock the textbox, the onClick
event doesn't fire. Am I mistaken in this?
BTW, selecting one of the choices in the textboxes is the last step in
executing a multiparameter query. The different headings in the textboxes
arise from an earier combo-box selection.
Thanks
Peter
"Sandra Daigle" <SMDa...@mindspring.com> wrote in message
news:#h811sVZAHA.952@tkmsftngp05...

Arvi Laanemets

unread,
Dec 14, 2000, 1:46:14 AM12/14/00
to
Hi Peter!

When you have designed the appearence your TexBox'es as CommandButtons and
will that they behave as CommandButtons .... why don't you use
CommandButtons instead? As for me, I had preferred set of two ComboBoxes
instead - selection in first modifyng RowSource of second.

Arvi Laanemets


Peter Gumbrell <pe...@orillia.net> wrote in message
news:#0JxEYQZAHA.388@tkmsftngp04...

John Nurick

unread,
Dec 14, 2000, 2:08:26 AM12/14/00
to
Surely it's easier to code a button to change its caption as needed
than it is to make a text box behave like a button...

--
John

Please reply to the newsgroup and not by e-mail. That way, more
brain cells get to work on the problem!

Sandra Daigle

unread,
Dec 14, 2000, 8:05:42 AM12/14/00
to
The Click event does fire when the textbox is locked - perhaps
something else is interfering. It does not fire when the text box is
disabled (ie. Enabled=false).

Sandra Daigle

"Peter Gumbrell" <pe...@orillia.net> wrote in message

news:Ov9mCiXZAHA.1844@tkmsftngp04...

QM

unread,
Dec 14, 2000, 9:41:53 AM12/14/00
to
On Thu, 14 Dec 2000 13:05:42 GMT, "Sandra Daigle"
<SMDa...@mindspring.com> wrote:
Hi

the click event does fire if the text box is locked, however if you
lock and set enabled to no the click event cannot fire

Mark

Peter Gumbrell

unread,
Dec 14, 2000, 8:43:00 AM12/14/00
to
Many thanks for your suggestions. I can see that using command buttons is
the best solution. I would appreciate some help with the method for using
code to change the caption property of a button.

Thanks
Peter
"Arvi Laanemets" <ar...@tarkon.ee> wrote in message
news:919qae$826$1...@kadri.ut.ee...

bilt

unread,
Dec 14, 2000, 5:42:00 PM12/14/00
to

I like Dale's idea of using a label.

(infact I have used labels as pseudo buttons on many occasions because more text
fits in one and it can't maintain a focus - ie you can't use the enter key to
activate a faked-label button and users can't change its content directly :-)

An un-attached label has all the events you need.

Use its click event as you normaly would.

With its' MouseDown & MouseUp events you can change its appearance to fake a
pressed effect
ie. Me.LbHeading1.SpecialEffect = 2 'sunken ; 1 = raised
or what ever you like (change the background colour, etc)

To fill the label caption with the results you want, add code to the AfterUpdate
event of your preceding combobox with something like

.... your existing code here in combos AfterUpdate event
Me.LbHeading1.Caption = "What Ever Result Your Code found :-)"
... any other label headings you want to change
Probably a select case would be the best approach here.

Hope that's enough to get you started or follow one of the many other usefull
suggestion already recieved :-)

bilt
_____________________

0 new messages