IonicWind Software

Aurora Compiler => GUI => Topic started by: Bruce Peaslee on February 03, 2006, 05:38:57 PM

Title: Dialog Editor Question
Post by: Bruce Peaslee on February 03, 2006, 05:38:57 PM
I was having some trouble with defining the default button in a dialog. It appears that the dialog editor does not properly add the 0x0001 for the default button and puts a 'B' on the end. 0x000B is BS_OWNERDRAW.
Title: Re: Dialog Editor Question
Post by: Ionic Wind Support Team on February 03, 2006, 05:52:38 PM
The ownerdraw style is needed for color buttons.  If you check the "XP compatible" checkmark then it will be a standard button.

Paul.
Title: Re: Dialog Editor Question
Post by: Ionic Wind Support Team on February 03, 2006, 06:23:51 PM
And upon further investigation it appears that a button with the BS_OWNERDRAW style can't be a default button since the bits confilct in the style (microsoft article).  (0xB = 0x1011)

Well it can be but you need to use a function to set it.  I will change the source output so when "XP theme compatible" is checked that the button retains its default button setting.

Title: Re: Dialog Editor Question
Post by: Ionic Wind Support Team on February 03, 2006, 07:00:05 PM
Came up with a better solution.   Since dialogs are created by using an internal memory template it is possible to specify the default button even with an owner drawn one.  The easiest way to accomplish this was to add another control type constant.

d1.AddControl(CTDEFBUTTON...

The dialog editor now understands this and will chose CTBUTTON or CTDEFBUTTON depending on the properties. 

Button controls create dynamically  just need to specify the 0x0001 (ABS_DEFAULT) style when creating control.  This will maintain backwords compatibility with current code.
Title: Re: Dialog Editor Question
Post by: Bruce Peaslee on February 03, 2006, 10:28:56 PM
Sounds good. I used

const BS_DEFPUSHBUTTON = 1;

which of course is the same value.
Title: Re: Dialog Editor Question
Post by: Bruce Peaslee on March 10, 2006, 11:55:37 AM
All the above work, but as soon as I click into any edit control, the default button changes to CANCEL.

For data entry, I want to be able to click OK when I'm through and not have to use the mouse. How do I keep OK as the default?
Title: Re: Dialog Editor Question
Post by: Ionic Wind Support Team on March 10, 2006, 12:31:06 PM
Sounds like you have two default buttons.

You have to use the CTDEFBUTTON type for it to work properly and not the BS_DEFBUTTON style
Title: Re: Dialog Editor Question
Post by: Bruce Peaslee on March 10, 2006, 12:44:02 PM
Quote from: Ionic Wizard on March 10, 2006, 12:31:06 PM
Sounds like you have two default buttons.

It does more than sound like itÂÃ,  :P

Man, how can a guy stare at code all day long and not see that???

Thanks, it's working well now.
Title: Re: Dialog Editor Question
Post by: Mike Stefanik on March 10, 2006, 03:55:59 PM
Related to the default button issue, it'd be nice if the CButton class had GetStyle/SetStyle methods and the CDialog class had SetDefaultButton and GetDefaultButton methods.
Title: Re: Dialog Editor Question
Post by: Parker on March 10, 2006, 06:17:42 PM
I believe all classes derived from CWindow have the ModifyStyle method, but I don't know about a GetStyle.