N
N
nonvon2015-08-09 05:28:42
Delphi
nonvon, 2015-08-09 05:28:42

How to get component property values?

Can you please tell me how to pass the class type to the procedure? I want to know the values ​​of the component properties

procedure TformMain.SetProperties(FormName: Tform; ClassName, SomeProperty: string;
                                  Value, ClassNamePStart, ClassNamePStop: Integer; Condition: string; ClassType: Tclass);

var  i: integer; PropInfo: PPropInfo; Component: TComponent;

begin


  for i := 0 to FormName.ComponentCount - 1 do
  begin
    Component := FormName.Components[i];

   if ClassName = copy(Component.GetNamePath, ClassNamePStart, ClassNamePStop)  then
    begin

  if Condition <> ''  then
   begin
    with findcomponent(Component.GetNamePath) as ClassType do

    ShowMessage(Hint);
   end;

      PropInfo := GetPropInfo(Component.ClassInfo, SomeProperty);
      if Assigned(PropInfo) then
        SetOrdProp(Component, PropInfo, Integer(Value));
    end;
  end;
end;

SetProperties(formMain, 'rps_rb', 'enabled', 1, 0, 6, 'hint', TRadioButton);

Answer the question

In order to leave comments, you need to log in

1 answer(s)
N
nonvon, 2015-08-09
@nonvon

ShowMessage(TControl(FindComponent(Component.Name)).Hint);

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question