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;
and on the OnDestroy free them:
procudure TMyForm.OnDestroy(Sender: TObject);
begin
Panel.Free;
end;
Declare the component namas as variables on your TMyForm.
You may want to create the configuration file on xml, but you need to
learn how to use XML DOM if you do so, for sure this is the more elegant
way.
Also take notice that it is not necessary to use gtk call directly for
this, so this is a multi-platform approach. In fact you don't need to
draw the form to have one on Lazarus. You can simple have the entire
form create by hand just by calling the correct methods and setting the
correct properties, but on most cases it is easier to draw the form.
Another approach is to create the components with the form designer but
set their Visible property to False and then set it to True when you want.
If you want an unknown number of components to be created you may create
a dinamyc array of components, maybe this works.
Felipe
_
To unsubscribe: mail [EMAIL PROTECTED] with
unsubscribe as the Subject
archives at http://www.lazarus.freepascal.org/mailarchives