Re: Freeing buttons created in a dynamic array
From: Maarten Wiltink (maarten_at_kittensandcats.net)
Date: 03/16/04
- Next message: matt: "Which user interface libraries/tools are good?"
- Previous message: Maarten Wiltink: "Re: Delphi tcp proxy?"
- In reply to: GB Blanchard: "Freeing buttons created in a dynamic array"
- Next in thread: GB Blanchard: "Re: Freeing buttons created in a dynamic array"
- Reply: GB Blanchard: "Re: Freeing buttons created in a dynamic array"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Tue, 16 Mar 2004 22:24:53 +0100
"GB Blanchard" <1122@1122noexiste.net> wrote in message
news:45d612875782b3502d2f8a7468391a7d@news.teranews.com...
> I'm creating some buttons on a panel like this:
>
> {...}
> SetLength(BtnArray,Length(CharString));
>
> for Col := 0 to ColCount - 1 do
> for Row := 0 to RowCount - 1 do
> begin
> Btn := TButton.Create(Self);
> Btn.Parent := pnBtnArray;
> Btn.SetBounds(Col * (BtnWidth + 1), Row * (BtnHeight + 1),
> BtnWidth, BtnHeight);
> if Row = 0 then
> Btn.Caption := CharString[Col +1]
> else
> Btn.Caption := CharString[(Col +1) + ColCount];
> Btn.OnClick := btSendKeyClick;
> BtnArray[Col] := Btn;
> end;
>
> {...}
>
> Each button has one character as a caption and the user can change
> which character set he wants to use at any time. Therefore, he may
> start with 10 characters on 10 buttons, and later decide to choose
> 3 characters on 3 buttons.
>
> The problem is that the extra 7 buttons and characters will still
> be shown on the first row of the new 3 button selection because I
> haven't been able to figure out how to free the buttons of the
> first selection. Any advice will be greatly appreciated.
Seeing as how you already store your buttons in the BtnArray array,
could you free every button in it before starting over?
You might want to keep references to them _all_, BTW. Currently you're
overwriting every row except the last one.
Groetjes,
Maarten Wiltink
- Next message: matt: "Which user interface libraries/tools are good?"
- Previous message: Maarten Wiltink: "Re: Delphi tcp proxy?"
- In reply to: GB Blanchard: "Freeing buttons created in a dynamic array"
- Next in thread: GB Blanchard: "Re: Freeing buttons created in a dynamic array"
- Reply: GB Blanchard: "Re: Freeing buttons created in a dynamic array"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]