A while back, I posted notes and a bug report concerning the an issue
in which a disabled BevelButton didn't change properly when the
Enabled value was set to True, even if the .Refresh method was
called. After revisiting this in a new project, I've uncovered a
more clear definition of the problem and a fix/workaround.
The issue arises when the BB's parent window is not the currently
active window.
- Window contains a listbox that accepts drags from the desktop
(clicking on the desktop removes focus from the window)
- When items are dropped onto the listbox, I check the count in the
listbox's Change event and if it's non-zero, I enable the BB.
- However, when I click the window and it comes to the foreground,
the previously disabled BB is still drawn as disabled even though it
responds if you click it indicating that the enabled change has
occurred.
- If I then click in the listbox to force a revisit to the Change
event, the BB is redrawn in the correct state.
The fix is to add code to the BB's parent window's Activate event:
If Me.lbCurrentSelections.ListCount > 0 Then // the drop target
listbox
Me.bbQuickDump.Enabled = True
End If
This has my BevelButtons properly updating when the window is brought
back to the top of the window stack.
So if you are seeing a situation where a BevelButton isn't refreshing
its drawn state when your window loses focus, try setting the enabled
state in the window's Activate event.
Note that a button that was enabled when the window lost focus will
be enabled when the window regains focus.
Hopefully this info will help others.
Tim
_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>
Search the archives:
<http://support.realsoftware.com/listarchives/lists.html>
|