realbasic-nug
[Top] [All Lists]

BevelButton Enable Failure resolution

To: REALbasic NUG <realbasic-nug@lists.realsoftware.com>
Subject: BevelButton Enable Failure resolution
From: Tim Jones <tjmac@tolisgroup.com>
Date: Thu, 30 Oct 2008 08:31:25 -0700
Authentication-results: mx.google.com; spf=neutral (google.com: 74.124.194.228 is neither permitted nor denied by best guess record for domain of realbasic-nug-bounces@lists.realsoftware.com) smtp.mail=realbasic-nug-bounces@lists.realsoftware.com
Delivered-to: listarchive@realsoftware.com
Reply-to: REALbasic NUG <realbasic-nug@lists.realsoftware.com>
Sender: realbasic-nug-bounces@lists.realsoftware.com
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>


<Prev in Thread] Current Thread [Next in Thread>
  • BevelButton Enable Failure resolution, Tim Jones <=