BorlandTalk.com Forum Index BorlandTalk.com
Borland discussion newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Radiobuttons to Pushbuttons

 
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> C++ Builder (VCL Components Development)
View previous topic :: View next topic  
Author Message
Darius Linder
Guest





PostPosted: Fri Nov 28, 2003 9:37 pm    Post subject: Radiobuttons to Pushbuttons Reply with quote



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
Display posts from previous:   
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> C++ Builder (VCL Components Development) All times are GMT
Page 1 of 1

 
Jump to:  
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


Powered by phpBB © 2001, 2006 phpBB Group
SEO toolkit © 2004-2006 webmedic.