473,322 Members | 1,755 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,322 software developers and data experts.

Buttons still appear "highlighted" after being clicked

12
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?

Expand|Select|Wrap|Line Numbers
  1.  
  2. 'Button to set the recordset of the form to the records associated with the
  3. 'last computer ID in my array (the array contains the computer IDs for 
  4. 'all the computers that matched search criteria specified by the user).
  5. 'Other buttons are similar-- they go to the first
  6. 'computer ID in the array, or increment or decrement current array index..
  7.  
  8. Private Sub lastComputer_Click()
  9. On Error GoTo Err_lastComputer_Click
  10.  
  11.     searchComputerIDArrayCurrent = UBound(searchComputerIDArray)
  12.     displayCurrentSearchResults
  13.  
  14.     'DoCmd.GoToRecord , , acLast
  15.  
  16. Exit_lastComputer_Click:
  17.     Exit Sub
  18.  
  19. Err_lastComputer_Click:
  20.     MsgBox Err.Description
  21.     Resume Exit_lastComputer_Click
  22.  
  23. End Sub
  24.  
  25. Public Sub displayCurrentSearchResults()
  26.  
  27.     'display the correct values in the combo boxes, even though they aren't enabled
  28.     computerComboBox = searchComputerIDArray(searchComputerIDArrayCurrent)
  29.     Me.subsystemComboBox.Value = Me.computerComboBox.Column(5)
  30.     Me.siteComboBox.Value = Me.computerComboBox.Column(4)
  31.  
  32.     'display the current record number in the navigation bar
  33.     Me.currentComputerTextBox = searchComputerIDArrayCurrent + 1
  34.  
  35.     'make sure the appropriate navigation buttons are enabled/disabled
  36.     Me.prevComputer.Enabled = True
  37.     Me.nextComputer.Enabled = True
  38.  
  39.     If (searchComputerIDArrayCurrent = LBound(searchComputerIDArray)) Then
  40.         Me.currentComputerTextBox.SetFocus
  41.         Me.prevComputer.Enabled = False
  42.     End If
  43.  
  44.     If (searchComputerIDArrayCurrent = UBound(searchComputerIDArray)) Then
  45.         Me.currentComputerTextBox.SetFocus
  46.         Me.nextComputer.Enabled = False
  47.     End If
  48.  
  49.     'requery the form
  50.     Me.Requery
  51.  
  52. End Sub
  53.  
Mar 20 '07 #1
11 5265
MMcCarthy
14,534 Expert Mod 8TB
Not sure why this is happening. Try adding and Me.Refresh at the end of the button click event code.

Mary
Mar 21 '07 #2
dana1
12
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
Mar 21 '07 #3
dana1
12
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.

Expand|Select|Wrap|Line Numbers
  1. Private Sub lastComputer_Click()
  2. On Error GoTo Err_lastComputer_Click
  3.  
  4.     searchComputerIDArrayCurrent = UBound(searchComputerIDArray)
  5.     displayCurrentSearchResults
  6.     Me.currentComputerTextBox.SetFocus
  7.     Me.lastComputer.Enabled = False
  8.     Me.lastComputer.Enabled = True
  9.     Me.lastComputer.SetFocus
  10.  
  11.     'DoCmd.GoToRecord , , acLast
  12.  
  13. Exit_lastComputer_Click:
  14.     Exit Sub
  15.  
  16. Err_lastComputer_Click:
  17.     MsgBox Err.Description
  18.     Resume Exit_lastComputer_Click
  19.  
  20. End Sub
  21.  
Mar 21 '07 #4
dana1
12
....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...
Mar 21 '07 #5
Denburt
1,356 Expert 1GB
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
Mar 21 '07 #6
dana1
12
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
Mar 21 '07 #7
Denburt
1,356 Expert 1GB
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.
Mar 21 '07 #8
dana1
12
Thanks Denburt. I'll try creating new buttons next week and let you know how that works out.

Dana
Mar 23 '07 #9
Denburt
1,356 Expert 1GB
Your welcome, and good luck let us know how it goes.
Mar 23 '07 #10
dana1
12
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
Apr 3 '07 #11
Denburt
1,356 Expert 1GB
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.
Apr 4 '07 #12

Sign in to post your reply or Sign up for a free account.

Similar topics

4
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...
1
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....
235
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...
0
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)...
22
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...
1
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...
5
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...
15
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...
0
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...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
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...
0
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...
0
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...
1
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...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
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
0
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...
0
isladogs
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...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.