Discussion:
MFC: How to create 'pressed' buttons impression?
(too old to reply)
Starlite
2003-12-29 11:21:19 UTC
Permalink
I would like to know how to make buttons appear 'pressed' when clicked, and
normal when clicked again - like in paint when you choose a tool from the
toolbar.

I use Microsoft visual c++ 6

Thx
-lp-d31m05
2003-12-30 16:04:08 UTC
Permalink
Halo there...

Um... I'm not a Visual C++ Programmer, but I may help you here :P

Microsoft Visual Basic has this button called the ToggleButton (which sucks
btw).

Borland Delphi's got the SpeedButton which has got a boolean value called
"down" - this allows the button to appear as "clicked" or "normal".

I believe that Visual C++ should have something like the SpeedButton or the
ToggleButton. If it doesn't, throw away your copy of Visual C++ (which was a
pirated one anyway) and move to Delphi :D

Have fun.
Delphi truly rules :P
Rowan
Post by Starlite
I would like to know how to make buttons appear 'pressed' when clicked, and
normal when clicked again - like in paint when you choose a tool from the
toolbar.
I use Microsoft visual c++ 6
Thx
The Ancient One
2003-12-30 20:09:37 UTC
Permalink
VC++ does not have a RAD environment like Delphi or VB (yeah its lame).
Instead of moving to Delphi move to C# :)
I avoid MFC like the plague, it seems that it is not a cmd button being used
in paint as a normal cmd doesn't have a pressed state like that.
Consult the MFC docs for some other API or do an ActiveX control.

--
Come on,do your worst...make me laugh!!
Post by -lp-d31m05
Halo there...
Um... I'm not a Visual C++ Programmer, but I may help you here :P
Microsoft Visual Basic has this button called the ToggleButton (which sucks
btw).
Borland Delphi's got the SpeedButton which has got a boolean value called
"down" - this allows the button to appear as "clicked" or "normal".
I believe that Visual C++ should have something like the SpeedButton or the
ToggleButton. If it doesn't, throw away your copy of Visual C++ (which was a
pirated one anyway) and move to Delphi :D
Have fun.
Delphi truly rules :P
Rowan
Arvind Doobary
2004-01-01 01:00:59 UTC
Permalink
Post by -lp-d31m05
Delphi truly rules :P
Yeah, our ruler! Long live the Queen :)
Starlite
2004-01-01 16:51:05 UTC
Permalink
Thx for all your replies
yeah I know VC++ suks
but i've got to live with it :(
Post by Starlite
I would like to know how to make buttons appear 'pressed' when clicked, and
normal when clicked again - like in paint when you choose a tool from the
toolbar.
I use Microsoft visual c++ 6
Thx
Paul
2004-01-05 18:48:55 UTC
Permalink
void SetState(
BOOL bHighlight
);

see msdn http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vclib/html/_mfc_cbutton.3a3a.setstate.asp


This function of the MFC CButton class will do it for you. Providing
you are using MFC.

If you are only using a Dialog Resource you can cast it to a CButton
by doing the following:

(CButton*)GetDlgItem(ID_YOUR_BUTTONID))->SetState(TRUE);

Hope this helps,

Paul
Post by Starlite
Thx for all your replies
yeah I know VC++ suks
but i've got to live with it :(
Post by Starlite
I would like to know how to make buttons appear 'pressed' when clicked,
and
Post by Starlite
normal when clicked again - like in paint when you choose a tool from the
toolbar.
I use Microsoft visual c++ 6
Thx
Pascal
2004-01-10 14:23:48 UTC
Permalink
Its very easi with button generators.(available in most photoediting
software).
But I would recommend the bevel and emboss feature, you do it yourself and
get the results you want and not what the software want.
Your button bust appear like a button(3d).
To obtain a pressed in button, use inner bevel. And to obtain unpressed
button, use outer bevel.
I'm not entering into details, but feel free to ask for.
Post by Paul
void SetState(
BOOL bHighlight
);
see msdn
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vclib/html/
_mfc_cbutton.3a3a.setstate.asp
Post by Paul
This function of the MFC CButton class will do it for you. Providing
you are using MFC.
If you are only using a Dialog Resource you can cast it to a CButton
(CButton*)GetDlgItem(ID_YOUR_BUTTONID))->SetState(TRUE);
Hope this helps,
Paul
Post by Starlite
Thx for all your replies
yeah I know VC++ suks
but i've got to live with it :(
Post by Starlite
I would like to know how to make buttons appear 'pressed' when clicked,
and
Post by Starlite
normal when clicked again - like in paint when you choose a tool from the
toolbar.
I use Microsoft visual c++ 6
Thx
Loading...