Hiding buttons

  • Thread starter Thread starter Jessie
  • Start date Start date
J

Jessie

Hi
I have two buttons on a form Butt1 & Butt2. At any give
time only one button is displayed.. When Butt1 is
clicked, Butt1 must be hidden and Butt2 must be
displayed. The problem I have is that Butt1 is still in
focus when I want to set its visible property to false.
Also is sufficient to set the visible property to False
to disable the button or must /data/ enable =
NO, /Format/ transparent = YES, and Visible = NO Which
events are used to achieve this.
Thanks
 
Jessie,

Setting visible to false is enough, once made invisible the user cannot
do anything with it. On the focus issue, all you need to do make visible
and set focus to the other button right before you make the one juct
clicked invisible! So, your code should look something like:

Private Sub Butt1_Click()
'whatever the button does
'
Me.Butt2.Visible = True
Me.Butt2.SetFocus
Me.Butt1.Visible = False

likewise,

Private Sub Butt2_Click()
'whatever the button does
'
Me.Butt1.Visible = True
Me.Butt1.SetFocus
Me.Butt2.Visible = False

I haven't tested it, but I trust it should work.

HTH,
Nikos
 
Thanks for the help. I will give this a try.
-----Original Message-----
Jessie,

Setting visible to false is enough, once made invisible the user cannot
do anything with it. On the focus issue, all you need to do make visible
and set focus to the other button right before you make the one juct
clicked invisible! So, your code should look something like:

Private Sub Butt1_Click()
'whatever the button does
'
Me.Butt2.Visible = True
Me.Butt2.SetFocus
Me.Butt1.Visible = False

likewise,

Private Sub Butt2_Click()
'whatever the button does
'
Me.Butt1.Visible = True
Me.Butt1.SetFocus
Me.Butt2.Visible = False

I haven't tested it, but I trust it should work.

HTH,
Nikos

.
 
Back
Top