in reply to Re: How to change the default (ok) button in Win32::GUI
in thread How to change the default (ok) button in Win32::GUI

I have found no information / documentation that suggests default buttons apply only to dialog boxes. Even so, if you use Win32::GUI::DialogBox instead of Win32::GUI::Window, the resulting behavior is the same. Also, according to the docs for Window:
-dialogui => 0/1 Act as a dialog box.
I have been searching for an answer in the Win32.pm and GUI.pm code but can't find anything that leads me to the answer. I get the feeling that I need to manipulate the window somehow after changing the button but I'm just guessing.

Replies are listed 'Best First'.
Re^3: How to change the default (ok) button in Win32::GUI
by ikegami (Patriarch) on Apr 21, 2005 at 01:49 UTC

    I did a little testing, and Enter did nothing when it was a Win32::GUI::Window, but it pressed button 1 when it was a Win32::GUI::DialogBox.

    I also could not change the default button. I suspect it cannot be changed once the window is created.

    That doesn't mean it's hopeless. What you can do is capture Enter and give it the behaviour you want. In fact, I think CDialog in MFC does just that. You could check the MFC sources for CDialog If you have access to VC++.

      I had thought of using Win32::GUI::AcceleratorTable but was hoping there was a more direct way. Using AcceleratorTable will require a bit more coding but I'm pretty sure it will work even if it wasn't my first choice for a solution.