in reply to Re^4: Release Button in Click
in thread Release Button in Click

It could be that the code in the event handler is taking a long time to complete, which means Win32::GUI won't have a chance to update the GUI, and the program will appear to hang. This includes redrawing controls. So if a lengthy piece of code is executed when a button is pressed, it will remain pressed until the code returns to the dialog loop. One solution to this problem is to periodically call Win32::GUI::DoEvents() in your code to allow Win32::GUI to process any pending events. Example:

sub Button_Click { while(1){ # do something... Win32::GUI::DoEvents(); } return 1; }

Replies are listed 'Best First'.
Re^6: Release Button in Click
by tcopeck (Initiate) on Sep 22, 2010 at 09:14 UTC
    The event handler activities are fairly time-consuming, and each already ends with a call to DoEvents() after all widgets in the interface that accept user input have been polled (eachTextfield_Change() or eachCombobox_Change()). However even after the event handler concludes and control returns to the main Dialog() loop, the active button is not redrawn with a released appearance. It remains pushed until the user pressed another button. And that's the objective: to trigger a redraw when the handler finishes to tell the user processing is done.

      You could try using one of the Update()/InvalidateRect()/Redraw() methods on the button at the end of the event handler. Alternatively, you could try running the event handler code in a thread to see if this makes any difference to the button's appearance.