On Wed, 5 Oct 2005, Felipe Monteiro de Carvalho wrote:
Eduardo wrote:
Can be used Lazarus make a dinamic GUI using gtk for? I want to
read the configuration file and change my app GUI. I don't want a skin
style, just put buttons, checkboxs, edit fileds, etc.. depending the conf
file.
That is quite easy. You just have to create the components by hand. Just
create the components on the OnCreate event of your form:
procudure TMyForm.OnCreate(Sender: TObject);
begin
// Here read from the configuration file
Panel := TPanel.Create(Self);
Panel.Parent := Self;
// Set the position for the Panel (or any other component)
Panel.Left := ConfigFileLeft;
Panel.Top := ConfigFileTop;
Panel.Width := ConfigFileWidth;
Panel.Height := ConfigFileHeight;
// Do the same for other controls
end;
GExperts for Delphi contains a small expert: 'Components to code'. This
allows you to convert a designed component to code. i.e. the expert
generates Object pascal code which will create the component and set all
properties so that it appears exatly as it is in the designer. Putting
this code in the OnCreate() event of the form allows you to delete the
component.
In your case, you would design the whole form, run the expert, and
then put the code for all components in the OnCreate event of your
form.
The code can then be adapted to read various settings from a file.
Mattias, I think this would be a useful addition. I'll see about
creating a Lazarus IDE package for this.
Michael.
_________________________________________________________________
To unsubscribe: mail [EMAIL PROTECTED] with
"unsubscribe" as the Subject
archives at http://www.lazarus.freepascal.org/mailarchives