Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / fpc-pascal / 2010-02

TVision dynamic NewSItem for RadioButton

2 messages · 2 people ·

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Zitt Zitterkopf

I have a list of strings inside a TStringList which contains the contents of my TurboVision RadioButton group.

This TStringList has a variable data payload... there may be 1 entry... there may be 10 entries.

I need to create a RadioButton Group with a variable number of entries; however, my documentation doesn't seem to give me a pointer to how this can be done. All of the RadioButton examples appear to be static.

    Bruce := New(PRadioButtons, Init(R,
      NewSItem('~1~ OS A',
      NewSItem('~2~ OS B',
      NewSItem('~3~ OS C',
      nil)))
    ));
    Insert(Bruce);

It looks like the second Init parameter is a linked list of sorts; I hope I don't have to get creative in recreating this list.

Suggestions on how to proceed?

Reply by email

Marco van de Voort
to Zitt Zitterkopf

In our previous episode, Zitt Zitterkopf said:

Show quoted text 21 lines
I have a list of strings inside a TStringList which contains the contents of my TurboVision RadioButton group. This TStringList has a variable data payload... there may be 1 entry... there may be 10 entries. I need to create a RadioButton Group with a variable number of entries; however, my documentation doesn't seem to give me a pointer to how this can be done. All of the RadioButton examples appear to be static. Bruce := New(PRadioButtons, Init(R, NewSItem('~1~ OS A', NewSItem('~2~ OS B', NewSItem('~3~ OS C', nil))) )); Insert(Bruce); It looks like the second Init parameter is a linked list of sorts; I hope I don't have to get creative in recreating this list.

That is correct yes, it is a coded creation of a linked list.

To put a tstringlist in there, you'd go:

var p  : psitem;
p:=nil;
if strl.count>0 then
 for i :=strl.count-1 downto 0 do
    p:=newsitem(strl[i],p);

Note the reversion of the for loop.

Reply by email