Jump to content

UniPropertyGrid / uniAddProperties


JDDEV

Recommended Posts

Hi all,

I would like to use a uniPropertyGrid component without a AttachedComponent : just like a TValueListEditor component.

I find the AddProperty function but i don't find an explicit help to use it.

Is it possible to work with uniPropertyGrid  like a TValueListEditor ?

Thank you

Link to comment
Share on other sites

5 hours ago, JDDEV said:

I would like to use a uniPropertyGrid component without a AttachedComponent : just like a TValueListEditor component.

Hi,

procedure TMainForm.UniFormCreate(Sender: TObject);
begin
  UniPropertyGrid1.AttachedComponent := Nil;
  UniPropertyGrid1.AddProperty(['Prop1', 'Value1', 'Prop2', 'Value2']);
end;
procedure TMainForm.UniPropertyGrid1PropertyChange(Sender: TObject;
  const PropName: string; var PropValue: string; var Handled: Boolean);
begin
   //
end;

 

Link to comment
Share on other sites

I have just modified these lines from the demo :

procedure TMainForm.UniComboBox1Change(Sender: TObject);
var
  componentName:string;
begin
  componentName := UniComboBox1.Items[UniComboBox1.ItemIndex];
  if componentName='Perso' then begin
    UniPropertyGrid1.AttachedComponent := Nil;
    UniPropertyGrid1.AddProperty(['Prop1', 'Value1', 'Prop2', 'Value2']);
  end else
UniPropertyGrid1.AttachedComponent := MainForm.FindComponent(componentName);
end;

Link to comment
Share on other sites

12 hours ago, JDDEV said:

I have just modified these lines from the demo

Hi,

As a workaround, you can try this approach:

type TExPGrid = class(TUniCustomPropertyGrid)

end;

...
  UniPropertyGrid1.AddProperty(['Prop1', 'Value1', 'Prop2', 'Value2']);
  TExPGrid(UniPropertyGrid1).PopulateGrid;
...

 

Link to comment
Share on other sites

On 6/3/2019 at 11:58 AM, JDDEV said:

If i well understand, it is not possible to have a property with a combobox editor and a list of items to choice ?

Hi,

You can try this approach:

  UniPropertyGrid1.AddProperty(['Prop1', True]);
  UniPropertyGrid1.AddProperty(['Prop2', 'B']); //combobox
  TExPGrid(UniPropertyGrid1).PopulateGrid;
  
  UniPropertyGrid1.JSInterface.JSCode(#1'.sourceConfig = {Prop2: {editor: new Ext.grid.CellEditor({field: new Ext.form.field.ComboBox({editable: false, store:["A", "B", "C"]})})}};');
      

 

Link to comment
Share on other sites

  • 4 weeks later...
30 minutes ago, JDDEV said:

And now, i would like to get a property value...i don't find the function to do that ;(

 Do you have the solution ?

 

On 5/23/2019 at 10:39 PM, Sherzod said:

procedure TMainForm.UniPropertyGrid1PropertyChange(Sender: TObject; const PropName: string; var PropValue: string; var Handled: Boolean); begin // end;

?

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...