"Push like" radio buttons in Windows 7


M

Marcus

Hi

In my c++ project I have a group of radio buttons. All of them have
got the "Push like" property set to true. Every button has also got an
icon on it instead of text. These radio buttons works fine in XP but
in Windows 7 the clicked button does not appear pushed. There is no
way of seeing which button is selected. Now if I remove the icons from
the radiobuttons then I can see which one is selected because it gets
a different color than the un-selected.

I could not find any solution to this on the Internet, but I doubt I
am the only one having this problem.

Please help, what is wrong here?
 
Ad

Advertisements

8

88888 Dihedral

Please check the Windows API for windows.
Also X-windows programming in unix or linux programming.
 
K

Kenny McCormack

Hi

In my c++ project I have a group of radio buttons. All of them have
got the "Push like" property set to true. Every button has also got an
icon on it instead of text. These radio buttons works fine in XP but
in Windows 7 the clicked button does not appear pushed. There is no
way of seeing which button is selected. Now if I remove the icons from
the radiobuttons then I can see which one is selected because it gets
a different color than the un-selected.

I could not find any solution to this on the Internet, but I doubt I
am the only one having this problem.

Please help, what is wrong here?

You've defiitely come to the right place. People here will be glad to help.

--
No, I haven't, that's why I'm asking questions. If you won't help me,
why don't you just go find your lost manhood elsewhere.

CLC in a nutshell.
 
M

Malcolm McLean

Every button has also got an
icon on it instead of text. These radio buttons works fine in XP but
in Windows 7 the clicked button does not appear pushed.
Unfortunately there's not much you can do in C/C++ if a library
function in something like a windowing system doesn't work correctly.
(That's also the case for most languages).

The real answer is to get the source code of the radio button object
and fix it. But that entails a whole new version of the SDK, maybe a
new version of Windows. It's not worth it for something as small as
that.
The other answer is to apply a patch in code. This is also difficult,
because of object encapsulation. You can probably hack the button
class code, obtain the window handle, intercept the WM_PAINT message,
and draw a black border to indicate "pushed". But it's a nasty
solution, and might break in the next version of the SDK.

Another alternative is to knock up your own radio buttons. This would
take me about a day's work to do. The problem is they won't have all
the functionality of the built-in radio buttons. But they should work
well enough to provide radio buttons for your particular application.
This solution breaks down if you're using fancy C++ object hierarchies
that need the genuine MS Button class beneath them, but it will work
well enough for most code.

The best solution is to find a workaround. Maybe you can reset the
radio button's icon to a pushed in one when it's in state "pushed".
This is cluntzy, but it's the least bad answer.
 
K

Keith Thompson

Marcus said:
In my c++ project I have a group of radio buttons.
[...]

This is not the best place to ask.

First of all, this newsgroup discusses C, not C++.

Second, the C++ newsgroups focus on portable C++ programming.
Things like radio buttons are closely tied to the OS and/or GUI
framework you're using.

If you're using the Win32 API, comp.os.ms-windows.programmer.win32
is probably a good place to ask. If not, try a newsgroup or
other forum that deals with whataver framework you're using.
(stackoverflow.com might be a good choice.)
 
M

Marcus

Unfortunately there's not much you can do in C/C++ if a library
function in something like a windowing system doesn't work correctly.
(That's also the case for most languages).

The real answer is to get the source code of the radio button object
and fix it. But that entails a whole new version of the SDK, maybe a
new version of Windows. It's not worth it for something as small as
that.
The other answer is to apply a patch in code. This is also difficult,
because of object encapsulation. You can probably hack the button
class code, obtain the window handle, intercept the WM_PAINT message,
and draw a black border to indicate "pushed". But it's a nasty
solution, and might break in the next version of the SDK.

Another alternative is to knock up your own radio buttons. This would
take me about a day's work to do. The problem is they won't have all
the functionality of the built-in radio buttons. But they should work
well enough to provide radio buttons for your particular application.
This solution breaks down if you're using fancy C++ object hierarchies
that need the genuine MS Button class beneath them, but it will work
well enough for most code.

The best solution is to find a workaround. Maybe you can reset the
radio button's icon to a pushed in one when it's in state "pushed".
This is cluntzy, but it's the least bad answer.

Thanks for answering, if no other solution comes into mind maybe I
will resort to what you suggests (the change icon way).
 
Ad

Advertisements

M

Marcus

Marcus said:
In my c++ project I have a group of radio buttons.

[...]

This is not the best place to ask.

First of all, this newsgroup discusses C, not C++.

Second, the C++ newsgroups focus on portable C++ programming.
Things like radio buttons are closely tied to the OS and/or GUI
framework you're using.

If you're using the Win32 API, comp.os.ms-windows.programmer.win32
is probably a good place to ask.  If not, try a newsgroup or
other forum that deals with whataver framework you're using.
(stackoverflow.com might be a good choice.)

--
Keith Thompson (The_Other_Keith) (e-mail address removed)  <http://www.ghoti.net/~kst>
    Will write code for food.
"We must do something.  This is something.  Therefore, we must do this."
    -- Antony Jay and Jonathan Lynn, "Yes Minister"

Thanks for not just giving me a hard time for asking in the wrong
group, but actually point me to a better suited one. I will try
posting in that one instead.
I guess what I am looking for is something like an XP style of the
radiobutton. I remember using something like that some time ago when
having problems with different behaviour of an open file dialog in XP/
win7. That, I solved by simple using the old style of dialog even on
Win7.
 
8

88888 Dihedral

在 2012å¹´2月22日星期三UTC+8下åˆ3æ—¶08分48秒,Marcus写é“:
Marcus said:
In my c++ project I have a group of radio buttons.

[...]

This is not the best place to ask.

First of all, this newsgroup discusses C, not C++.

Second, the C++ newsgroups focus on portable C++ programming.
Things like radio buttons are closely tied to the OS and/or GUI
framework you're using.

If you're using the Win32 API, comp.os.ms-windows.programmer.win32
is probably a good place to ask.  If not, try a newsgroup or
other forum that deals with whataver framework you're using.
(stackoverflow.com might be a good choice.)

--
Keith Thompson (The_Other_Keith) (e-mail address removed)  <http://www.ghoti.net/~kst>
    Will write code for food.
"We must do something.  This is something.  Therefore, we must do this."
    -- Antony Jay and Jonathan Lynn, "Yes Minister"

Thanks for not just giving me a hard time for asking in the wrong
group, but actually point me to a better suited one. I will try
posting in that one instead.
I guess what I am looking for is something like an XP style of the
radiobutton. I remember using something like that some time ago when
having problems with different behaviour of an open file dialog in XP/
win7. That, I solved by simple using the old style of dialog even on
Win7.

OK, check SMDL and the open source GMP for image processing.

These two packages are most written in C and support an object
interface layor for cross platform GUIs in different Oses.
 
8

88888 Dihedral

88888 Dihedralæ–¼ 2012å¹´2月23日星期四UTC+8上åˆ3時05分53秒寫é“:
在 2012å¹´2月22日星期三UTC+8下åˆ3æ—¶08分48秒,Marcus写é“:
In my c++ project I have a group of radio buttons.

[...]

This is not the best place to ask.

First of all, this newsgroup discusses C, not C++.

Second, the C++ newsgroups focus on portable C++ programming.
Things like radio buttons are closely tied to the OS and/or GUI
framework you're using.

If you're using the Win32 API, comp.os.ms-windows.programmer.win32
is probably a good place to ask.  If not, try a newsgroup or
other forum that deals with whataver framework you're using.
(stackoverflow.com might be a good choice.)

--
Keith Thompson (The_Other_Keith) (e-mail address removed)  <http://www.ghoti.net/~kst>
    Will write code for food.
"We must do something.  This is something.  Therefore, we must do this."
    -- Antony Jay and Jonathan Lynn, "Yes Minister"

Thanks for not just giving me a hard time for asking in the wrong
group, but actually point me to a better suited one. I will try
posting in that one instead.
I guess what I am looking for is something like an XP style of the
radiobutton. I remember using something like that some time ago when
having problems with different behaviour of an open file dialog in XP/
win7. That, I solved by simple using the old style of dialog even on
Win7.

OK, check SMDL and the open source GMP for image processing.

I typed it wrong again. Check GIMP and GTK.
 
Ad

Advertisements

S

Shao Miller

I guess what I am looking for is something like an XP style of the
radiobutton. I remember using something like that some time ago when
having problems with different behaviour of an open file dialog in XP/
win7. That, I solved by simple using the old style of dialog even on
Win7.

You could potentially find out how wxWidgets does their magic when
deriving buttons from the OS or underlying GUI. The source code is
available.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top