I have a form which contains some buttons. The buttons use some of the standard images that come with access 2003 (e.g., the move next record image, or the sort ascending/descending images). The default behavior for access is to give the button a "highlighted" appearance when the button is hovered with the mouse.
My problem is that these buttons permanently have that "highlighted" appearance after they have been clicked. With my XP theme, that happens to be an orange border.
Oddly enough, I can get the buttons to go back to their normal appearance if I have another control slightly overlapping them. This works in most cases, but is not a satisfactory solution.
All the buttons are in my form header. I don't think I'm doing anything in code to cause this to happen, but just in case, I've included code for one of the buttons below.
Has anyone run across this before? Does anyone know how to ensure the buttons go back to their "normal" appearance after they have been clicked? -
-
'Button to set the recordset of the form to the records associated with the
-
'last computer ID in my array (the array contains the computer IDs for
-
'all the computers that matched search criteria specified by the user).
-
'Other buttons are similar-- they go to the first
-
'computer ID in the array, or increment or decrement current array index..
-
-
Private Sub lastComputer_Click()
-
On Error GoTo Err_lastComputer_Click
-
-
searchComputerIDArrayCurrent = UBound(searchComputerIDArray)
-
displayCurrentSearchResults
-
-
'DoCmd.GoToRecord , , acLast
-
-
Exit_lastComputer_Click:
-
Exit Sub
-
-
Err_lastComputer_Click:
-
MsgBox Err.Description
-
Resume Exit_lastComputer_Click
-
-
End Sub
-
-
Public Sub displayCurrentSearchResults()
-
-
'display the correct values in the combo boxes, even though they aren't enabled
-
computerComboBox = searchComputerIDArray(searchComputerIDArrayCurrent)
-
Me.subsystemComboBox.Value = Me.computerComboBox.Column(5)
-
Me.siteComboBox.Value = Me.computerComboBox.Column(4)
-
-
'display the current record number in the navigation bar
-
Me.currentComputerTextBox = searchComputerIDArrayCurrent + 1
-
-
'make sure the appropriate navigation buttons are enabled/disabled
-
Me.prevComputer.Enabled = True
-
Me.nextComputer.Enabled = True
-
-
If (searchComputerIDArrayCurrent = LBound(searchComputerIDArray)) Then
-
Me.currentComputerTextBox.SetFocus
-
Me.prevComputer.Enabled = False
-
End If
-
-
If (searchComputerIDArrayCurrent = UBound(searchComputerIDArray)) Then
-
Me.currentComputerTextBox.SetFocus
-
Me.nextComputer.Enabled = False
-
End If
-
-
'requery the form
-
Me.Requery
-
-
End Sub
-
11 5265
Not sure why this is happening. Try adding and Me.Refresh at the end of the button click event code.
Mary
Mary,
Thanks for responding. No luck with the Me.Refresh, unfortunately. Any other ideas?
Even setting the Visible property to False and then back to True doesn't reset the way they're displayed, they still show that "highlight" permanently after they've been clicked. I also tried Me.Repaint, and that did not work either.
Thanks,
Dana
One thing that does appear to work is to disable/enable the button. Again, this isn't really a good solution...
But I guess it will work if we can't figure out why the behaviour is happening in the first place. -
Private Sub lastComputer_Click()
-
On Error GoTo Err_lastComputer_Click
-
-
searchComputerIDArrayCurrent = UBound(searchComputerIDArray)
-
displayCurrentSearchResults
-
Me.currentComputerTextBox.SetFocus
-
Me.lastComputer.Enabled = False
-
Me.lastComputer.Enabled = True
-
Me.lastComputer.SetFocus
-
-
'DoCmd.GoToRecord , , acLast
-
-
Exit_lastComputer_Click:
-
Exit Sub
-
-
Err_lastComputer_Click:
-
MsgBox Err.Description
-
Resume Exit_lastComputer_Click
-
-
End Sub
-
....Actually... like the overlapping thing, this only works for some buttons. And, it ends up leaving a green "highlight" instead of an orange "highlight" (probably XP theme colors for something) on the buttons I use it on. The green highlight isn't permanent, but it displays or doesn't display depending on whether the button next to it is enabled/disabled (or so it appears).
[quote=dana1]One thing that does appear to work is to disable/enable the button. Again, this isn't really a good solution...
May or may not be but are you sure you are using a command button and not a Toggle Button? I don't have my XP themes turned on my Machine is as plain looking as they come so I might not see what you are seeing but the only time my command button highlights is when I click on it and it always snaps back.
Return a Toggle Button:
Me!YourControlNameHere.Value = 1
Denburt,
Good thought-- I hadn't thought to check that. Unfortunately, it does not appear that they are toggle buttons. I don't see how to tell the type of the control from the GUI, but the ControlType property returns 104, which is a command button. Also, the Value property isn't available from VB, so it appears that is not what is going on.
It's not really the "snapping back" part that is the problem. It does that just fine. It's just the orange border... It's the same orange border that I get when I hover any other button on any of my other forms, or even the buttons on this website (i.e., the Submit Reply or Preview Post buttons). The only difference is on this particular form, the orange border doesn't go away once you've clicked the button :-)
I've compared all the property settings on this button to other buttons that work just fine, and cannot figure out what the difference is..
Thanks for the suggestion! If you have any other ideas, let me know!
or.. if there's any more information that might help you be able to reproduce the behaviour on your machine, let me know and I'd be glad to provide it.
Dana
May or may not be but are you sure you are using a command button and not a Toggle Button? I don't have my XP themes turned on my Machine is as plain looking as they come so I might not see what you are seeing but the only time my command button highlights is when I click on it and it always snaps back.
Return a Toggle Button:
Me!YourControlNameHere.Value = 1
OK I set winXP themes and checked it out I wasn't able to reproduce your issue but I see how the highlighting is done now... Interesting situation you are describing and I can only suggest deleting that button and creating a new one. I have had some issues with widows themes acting screwy with my buttons before. I had one user download the frontend off the server and the buttons were the old style, user two downloaded the same database and the buttons had the themes style... I told them it was something they would just need to get used to lol. A few days later new update on the server (only a few minor code changes) both users had the themed style buttons go figure.
Wish I could offer something else to try, good luck.
Thanks Denburt. I'll try creating new buttons next week and let you know how that works out.
Dana
Your welcome, and good luck let us know how it goes.
Here's the verdict:
Creating brand new buttons from the wizard and making no modifications to them do the same thing, so maybe what I'm seeing is some undocumented "feature" of Access. (Maybe because the buttons are in the Header of the form the focus on them is different? I've done similar things with buttons in the footer and had no problems)
The best solution for the navigation buttons seems to be to move focus away from the button, disable the button, enable the button, then move focus back to the button. The unfortunate side effect of moving focus to the button programatically like this is that the button temporarily gets a green highlight. This goes away when the user moves focus to somewhere else using the mouse. Unfortunately, moving focus elsewhere via VBA doesn't do the trick.
For my sort ascending and sort descending buttons, having another control slightly overlap the buttons seems to do the trick. These buttons are always enabled, so overlapping works. I sometimes disable some of the navigation buttons (i.e., the "Next" button is disabled when I'm on the last record), and that messes up the "overlap" solution.
These aren't really what I would call "Ideal" solutions-- but if no one else can repeat what I'm seeing, there may not be an "Ideal" solution!
Thanks to the two of you who provided input!
Dana
Thanks for the update. I tried it again setting up buttons in the header (turned WinXP themes back on) and was unable to reproduce the results. I know that there are a number of anomalies similar to this that I have run into over the years so it doesn't surprise me. Glad you were able to find a workaround.
Sign in to post your reply or Sign up for a free account.
Similar topics
by: Doug van Vianen |
last post by:
Hi,
I am working on an Applet which provides some mouse practice for
new computer users in our local seniors' computer club. The applet
contains several cards, in a card layout, which are...
|
by: ehm |
last post by:
I apologize in advance for the cross-post (from
microsoft.public.inetexplorer.scripting), but that board seems dead.
I have what I think is a fairly simple problem, but I cannot figure
this out....
|
by: napi |
last post by:
I think you would agree with me that a C compiler that directly
produces Java Byte Code to be run on any JVM is something that is
missing to software programmers so far. With such a tool one could...
|
by: coli |
last post by:
I have 3 buttons. And basically, which ever get's clicked on should be
highlighted, while the rest should return to normal.
Currently, I'm using
void Button3_Click(object sender, EventArgs e)...
|
by: stephen |
last post by:
I have created an order form that users javascript to create a new html
document when the customers clicks the "print page" button.
Once the new document has been created it then prints the...
|
by: Jack |
last post by:
Hello,
On a form, I have a tab control with two tab pages. On one tab page, I have
about seven group boxes which I hide and make visible when buttons are
clicked on the tab page. No problems...
|
by: Mark |
last post by:
Hi All,
I have 3 images stored which are to imitate a button. One for Normal,
one for Depressed and another for Highlighted.
The 'Normal' button is placed on the form.
The Mousedown event...
|
by: simonoficina |
last post by:
Hello all! I am a vb.net beginner in Spain. When I use VB6 ,the button
object has a property called "default" that can set this button like
press "ENTER" key. But in the VB.net I can't find this...
|
by: Curious |
last post by:
I'm working on fixing the command of "Copy to Clipboard" from a data
grid.
The current implementation has two problems:
1) There are two extra columns copied to clipboard that are invisible...
|
by: ryjfgjl |
last post by:
ExcelToDatabase: batch import excel into database automatically...
|
by: Vimpel783 |
last post by:
Hello!
Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
|
by: jfyes |
last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
|
by: ArrayDB |
last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
|
by: CloudSolutions |
last post by:
Introduction:
For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
|
by: Defcon1945 |
last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
|
by: af34tf |
last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
|
by: Faith0G |
last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome former...
| |