On Sun, 05 Sep 2010 19:18:49 +1000 Peter E Williams <[email protected]> wrote:
> Hi Felipe and All, > > On Sun, 2010-09-05 at 07:01 +0200, Felipe Monteiro de Carvalho wrote: > > On Sun, Sep 5, 2010 at 6:39 AM, Peter E Williams > > <[email protected]> wrote: > > > Questions: > > > 1) Does the Memo1, OK_Button and Cancel TButton need to be in a > > > TGroupBox??? > > > 2) Also, should the TImage be in a TGroupBox??? > > > > I think that to use the splitter you need to group the elements using > > a panel. I vaguely remember that if you have something like: > > > > Panel 1 - Splitter - Panel 2 > > My question is: > How do I create a TForm and TSplitter and 2 x TPanel's at runtime?!? I created an example here: http://wiki.lazarus.freepascal.org/Working_with_TSplitter > I would guess something like: > { this code is all untested and typed straight into my email client } > > procedure create_formA( > Image_filename : string; StringList1 : TStringList ); > var > FormA : TForm; > Splitter1 : TSplitter; > Panel1, Panel2 : TPanel; > success_modal_result : boolean; > OK_button, Cancel_button : TButton; > Image1 : TImage; > begin > FormA := TForm.Create; // Are there any parameters here???? > > try > FormA.caption := 'Image and Comments for ' + Image_filename; > > Splitter1 := TSplitter.Create( FormA ); > Splitter1.Parent := FormA; > //Splitter1.Visible := True; Visible=true is default. > Splitter1.Align := alRight; > // do I need to set any other properties like Height, Width, Top, > Left ??? You can set the Width. > Panel1 := TPanel.Create( FormA ); > Panel1.Parent := FormA; > Panel1.Visible := True; > Panel1.Align := alClient; > > Memo1 := TMemo.Create( FormA ); > Memo1.Parent := Panel1; > Memo1.Visible := True; > > Memo1.Align := ????????? Memo1.Align := alClient; // fill Panel1 > // do I need to set any other properties like Height, Width, Top, > Left ??? No. > // will this work ???? > > Memo1.Strings := StringList1.Strings; Memo1.Lines := StringList1; // this calls Assign > OK_Button := TButton.Create( FormA ); > OK_Button.Parent := FormA; > OK_Button.Visible := True; > OK_Button.ModalResult := mrOK; > > OK_Button.Align := ???????????? Don't know. Maybe you should put all the buttons into a TPanel or use TButtonPanel or use anchors. See here: http://wiki.lazarus.freepascal.org/Autosize_/_Layout#Example:_a_button_panel > // do I need to set any other properties like Height, Width, Top, > Left ??? Normally you do OK_Button.AutoSize:=true; >[...] Mattias -- _______________________________________________ Lazarus mailing list [email protected] http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
