Board index » cppbuilder » Carriage Return/New Line in a TRadioGroup

Carriage Return/New Line in a TRadioGroup

Hello All,

I would like to be able to put a carriage return/newline in the caption of
an item of a TRadioGroup.  Any ideas on how to do that?

Thanks,

OAK

 

Re:Carriage Return/New Line in a TRadioGroup


What you're asking for is not possible with the default VCL components.
TRadioGroup uses CRLF in its Items property to distinquish between different
radio items.  And TRadioButton itself doesn't support multi-line captions
anyway, even when modifying the DFM file itself to include CRLF in the
caption.

To do what you're asking, you'll have to either write up your own rabio
button component that supports multi-line captions, or else try finding a
third-party component that already supports it.

Gambit

Quote
"OAK" <brandonDOTaucoinATwcomDOTcom> wrote in message

news:3d123208$1_2@dnews...
Quote
> I would like to be able to put a carriage return/newline in
> the caption of an item of a TRadioGroup.  Any ideas on
> how to do that?

Re:Carriage Return/New Line in a TRadioGroup


Quote
OAK wrote:
> Hello All,

> I would like to be able to put a carriage return/newline in the caption of
> an item of a TRadioGroup.  Any ideas on how to do that?

It's kind-of ugly, but maybe you can pretty it up.

Right-click your for, choose "View as Text."  Find the entry
for TRadioGroup.  Edit it similarly to:

object RadioGroup1: TRadioGroup
        Left = 184
        Top = 48
        Width = 89
        Height = 105
        Items.Strings = (
          'Hack it'#13'Really Well'
          'Hack It'#13'Fairly Well'
          'Hack It'#13'Quite Poorly')
        TabOrder = 3
      end

Right-click on the text editor window and choose "View as Form."
Note:  You will not be able to see the result at design time.

Then, in your form's constructor, put the following:

HWND wnd;
int count = RadioGroup1->ComponentCount;
for(int i = 0;  i < count; i++)
  {
    HWND wnd = ((TWinControl *)RadioGroup1->Components[i])->Handle;
    long style = GetWindowLong(wnd, GWL_STYLE);
    style = style | BS_MULTILINE;
    SetWindowLong(wnd, GWL_STYLE, style);
  }

Make sure your TRadioGroup is tall enough to display the multiple lines.

Re:Carriage Return/New Line in a TRadioGroup


Figures.  I missed the BS_MULTILINE part when I tried it myelf before
replying earlier.

Gambit

Quote
"Fishface" <fishf...@drift.net> wrote in message news:3d1257e9_2@dnews...
> It's kind-of ugly, but maybe you can pretty it up.

<snip>

Re:Carriage Return/New Line in a TRadioGroup


Thank you both for the help!  I really appreciate it!

OAK
"Remy Lebeau [TeamB]" <gambi...@yahoo.com> wrote in message
news:3d129f01$1_1@dnews...

Quote
> Figures.  I missed the BS_MULTILINE part when I tried it myelf before
> replying earlier.

> Gambit

> "Fishface" <fishf...@drift.net> wrote in message news:3d1257e9_2@dnews...

> > It's kind-of ugly, but maybe you can pretty it up.
> <snip>

Other Threads