Working with XP Themed Button

Started by Gian Young, November 21, 2009, 12:28:47 AM

Previous topic - Next topic

Gian Young

I have been using Jose's XP Themed Button control successfully with FF2.

The XP Themed Button control relies upon detecting if the App's theme is active with the Function TB_XPBUTTON_IsAPPThemed () to either generate a Classic Button or a Themed Button.

It seems in FF3 that irrespective of whether the Environment Option check box "Enable WINXP Theme Support" is checked or not you can only get a Themed XP Button with this control in FF3.

I have experimented by forcing the Function TB_XPBUTTON_IsAPPThemed () to report = False,  a Classic Button is then created.

It seems a link is missing here.

Regards

Gian Young


Gian Young

Further to the Themed Button Control.

Should users of this control require a CLASSIC button look instead of the Themed Button look they can use the TB_XPButton_DisableTheming function located in the TB_XPButton.Inc file to turn off theming for each of the button controls they are using.

Eg:- in FORM1_WM_CREATE

calling the function as follows will ensure the button with handle HWND_FORM1_XPBUTTON1 will have a Classic look.

TB_XPButton_DisableTheming (HWND_FORM1_XPBUTTON1)


In the standard version of TB_XPButton.Inc shipped with FF3 for the classic button only the image moves down and to the left when the button is clicked.


I wanted the button text to also move in a similar fashion when the button is clicked so I modified a small part of the TB_XPButton.Inc file as follows:-

Replace the code between Line 425 - Line 429 shown below

'        ELSE
'           SetTextColor hDc, GetSysColor(%COLOR_BTNTEXT)
'           SetBkColor hDc, GetSysColor(%COLOR_BTNFACE)
'           DrawText hDc, szCaption, -1, rcContent, @pbxp.dwTextFlags
'        END IF

With

         ELSE
            SetTextColor hDc, GetSysColor(%COLOR_BTNTEXT)
            SetBkColor hDc, GetSysColor(%COLOR_BTNFACE)
            IF iStateId = %PBS_PRESSED THEN
               OffsetRect rcContent, 1, 1
               DrawText hDc, szCaption, -1, rcContent, @pbxp.dwTextFlags
            ELSE
               OffsetRect rcContent, -1, 0
               DrawText hDc, szCaption, -1, rcContent, @pbxp.dwTextFlags
            END IF

to get the text to also move with the button click.

Best Regards

Gian Young (Australia)

Paul Squires

Quote from: Gian Young on November 21, 2009, 12:28:47 AM
It seems in FF3 that irrespective of whether the Environment Option check box "Enable WINXP Theme Support" is checked or not you can only get a Themed XP Button with this control in FF3.

Hi Gian - I will check into this for you to see if FF3 is not honoring the Theme option.
Paul Squires
PlanetSquires Software