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

The -dialogui option is necessary to get the Window to act like a DialogBox, i.e. process the basic navigation messages. Why that isn't the default is beyond me, since that's almost always the desired behaviour.

But that's not why it doesn't work. The problem is that your example only has Button controls in it.

Pressing Return (or Space) when a button has focus sends the Click event to that button. If some other control has focus, then the default button gets the Click event.

/J

  • Comment on Re: How to change the default (ok) button in Win32::GUI

Replies are listed 'Best First'.
Re^2: How to change the default (ok) button in Win32::GUI
by ChrisR (Hermit) on Apr 21, 2005 at 13:45 UTC
    I use the -dialogui option on all my windows and I would have expected it to be the default also. I must disagree that the problem is that the example only contains the buttons. The project I'm working on has one main window that contains many tabstrips and controls that are hidden and shown at runtime depending on the tab chosen to give the effect of tabs within tabs and different pages. I have modified the example to include two textfields and the result is the same. Here's the code: As you can see in the code I have also added the Update method to the buttons and window after the changes are made but that does not help either. I also tried using -addstyle=>BS_DEFPUSHBUTTON which also didn't help. What worries me with that approach would be that I don't know how to remove the style after it is applied. But it doesn't work anyway, so that's not going to be an issue.