Muchas gracias, he podido resolver el problema aca dejo código completo. Si lo ven feíto y quieren aportar algo para que se vea mejor estéticamente y mejorar rendimiento sean bienvenidos XD. Ahora me toca la parte dolorosa guardar la información de cada uno en su respectivos lugar y luego cargarla para consultar T_T (siento que me va a doler la cabeza pero tengo a mano aspirina XD).
Código Delphi
[-]procedure TfrmPacientes.Crear_panel();
Var
LPanel : TCategoryPanel;
Cat : TCategoryButtons;
npaneles : Integer;
but : TButtonItem;
i, j : Integer;
edt : TEdit;
mem : TMemo;
chk : TCheckBox;
lbl : TLabel;
contcomp : Integer;
tp : Integer;
sumaalt : Integer;
Const
cl = 165; ll = 5; sp = 5;
lw = 154;
ew = 160; eh = 21;
mw = 510; mh = 90;
cw = 25; ch = 17;
begin
DM.QryPGrupos.Close;
DM.QryPGrupos.Parameters.ParamByName('p').Value := DM.QryPlantillaDefaultidPlantilla.Value;
DM.QryPGrupos.Open;
npaneles := DM.QryPGrupos.RecordCount;
contcomp := frmPacientes.ComponentCount;
for i := 1 to npaneles do
begin
LPanel:=TCategoryPanel.Create(micategorygroup);
LPanel.Caption:= Trim(DM.QryPGrupos.FieldByName('DatosCaptionGrupo').AsString);
LPanel.PanelGroup:= micategorygroup;
LPanel.TabOrder := i;
LPanel.Name := Trim('Grupo' + i.ToString);
Cat := TCategoryButtons.Create(lPanel);
Cat.Name := 'Category' + i.ToString;
cat.Parent := LPanel;
Cat.Align := alClient;
cat.ButtonWidth := 675;
DM.QryPButtons.Close;
DM.QryPButtons.Parameters.ParamByName('p').Value := DM.QryPlantillaDefaultidPlantilla.Value;
DM.QryPButtons.Parameters.ParamByName('cap').Value := DM.QryPGrupos.FieldByName('DatosCaptionGrupo').AsString;;
DM.QryPButtons.Open;
LPanel.Height := (50 * (DM.QryPButtons.RecordCount));
tp := 2;
for j := 0 to (DM.QryPButtons.RecordCount -1) do
begin
contcomp := contcomp + 1;
lbl := TLabel.Create(Self);
lbl.Name := 'lbl'+IntToStr(contcomp);
lbl.Parent:= Cat;
lbl.Caption:= Trim(DM.QryPButtonsDatosDetalle.Value);
lbl.Top := tp;
lbl.Left := ll;
if (Trim(DM.QryPButtonsDatosTipo.Value) = 'TEdit') Or (Trim(DM.QryPButtonsDatosTipo.Value) = 'Edit') then
begin
edt := TEdit.Create(Self);
edt.Name := 'Edt'+IntToStr(contcomp);
edt.Parent:= Cat;
edt.Tag := DM.QryPButtonsidDatos.Value;
edt.Width := ew;
edt.Text := '';
edt.Top := tp;
edt.Left := cl;
tp := tp + eh + sp;
end;
if (Trim(DM.QryPButtonsDatosTipo.Value) = 'TMemo') Or (Trim(DM.QryPButtonsDatosTipo.Value) = 'Memo') then
begin
mem := TMemo.Create(Self);
mem.Name := 'Mem'+IntToStr(contcomp);
mem.Parent:= Cat;
mem.Tag := DM.QryPButtonsidDatos.Value;
mem.Width := mw;
mem.Text := '';
mem.Top := tp;
mem.Left := cl;
tp := tp + mh + sp;
end;
if (Trim(DM.QryPButtonsDatosTipo.Value) = 'TCheckbox') Or (Trim(DM.QryPButtonsDatosTipo.Value) = 'Checkbox') then
begin
chk := TCheckBox.Create(Self);
chk.Name := 'Chk'+IntToStr(contcomp);
chk.Parent:= Cat;
chk.Tag := DM.QryPButtonsidDatos.Value;
chk.Width := cw;
chk.Caption:='';
chk.Top := tp;
chk.Left := cl;
tp := tp + ch + sp;
end;
DM.QryPButtons.Next;
end;
LPanel.Height := tp + 25;
DM.QryPGrupos.Next;
end;
end;