 |
BorlandTalk.com Borland discussion newsgroups
|
| View previous topic :: View next topic |
| Author |
Message |
Darius Linder Guest
|
Posted: Fri Nov 28, 2003 9:37 pm Post subject: Radiobuttons to Pushbuttons |
|
|
I know that I can change the appearance of a TRadioButton to look like a
push button with the following code:
GetWindowLong(RadioButton->Handle, GWL_STYLE);
dwStyle = dwStyle | BS_PUSHLIKE;
SetWindowLong(RadioButton->Handle, GWL_STYLE, dwStyle);
My problem is that I'm trying to write a component that is a group box that
contains several radiobuttons.
I'm trying to change the style of the radiobuttons in the constructor, but I
receive an invalidoperation.
How can I change the radiobuttons to look like pushbuttons?
-- Here's the relevant pieces of the header file --
class PACKAGE TDowSelector : public TCustomGroupBox
{
private:
TRadioButton *Radio1;
public:
virtual __fastcall TDowSelector(TComponent* Owner);
};
-- Here's the relevant pieces of the cpp file --
#include "DowSelector.h"
static inline void ValidCtrCheck(TDowSelector *)
{
new TDowSelector(NULL);
}
__fastcall TDowSelector::TDowSelector(TComponent* Owner) :
TCustomGroupBox(Owner)
{
DWORD dwstyle;
Radio1 = new TRadioButton(this);
Radio1->Parent = this;
Radio1->Caption = "Mon";
Radio1->Name = "RadioMon"
GetWindowLong(RadioMon->Handle, GWL_STYLE); // InvalidOperation is
generated here.
dwStyle = dwStyle | BS_PUSHLIKE;
SetWindowLong(RadioMon->Handle, GWL_STYLE, dwStyle);
}
namespace Dowselector
{
void __fastcall PACKAGE Register()
{
TComponentClass classes[1] = {__classid(TDowSelector)};
RegisterComponentsP("Samples", classes, 0);
}
}
|
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|