Jump to content
uniGUI Discussion Forums
JDDEV

UniPropertyGrid / uniAddProperties

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

Share this post


Link to post
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;

 

Share this post


Link to post
Share on other sites

Thanks,

I do exactly the same code, but the result is empty :(

What is wrong ?

 

PS : i use version n° 1.90.0.1496

image.png

Share this post


Link to post
Share on other sites
2 hours ago, JDDEV said:

I do exactly the same code, but the result is empty :(

Can you make a simple testcase for this?

Share this post


Link to post
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;

Share this post


Link to post
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;
...

 

Share this post


Link to post
Share on other sites

Thanks, it is working well ;), Is it a bug ?

Is it possible to define type of properties ? (boolean, list of items...)

 

Share this post


Link to post
Share on other sites
On 5/28/2019 at 1:40 PM, JDDEV said:

boolean

UniPropertyGrid1.AddProperty(['Prop1', True]);

 

Share this post


Link to post
Share on other sites

Thanks.

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

 

Share this post


Link to post
Share on other sites
3 hours ago, 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 ?

Yes, not implemented yet 

Share this post


Link to post
Share on other sites
On 6/3/2019 at 11:58 AM, JDDEV said:

to have a property with a combobox editor and a list of items to choice ?

I will try to give you a solution

Share this post


Link to post
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"]})})}};');
      

 

Share this post


Link to post
Share on other sites

Thanks, it is working well.

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

Do you have the solution ?

Share this post


Link to post
Share on other sites
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;

?

Share this post


Link to post
Share on other sites

I am waiting for a get and a set function to manage values, but if it is not possible PropertyChange Event  is the solution.

Thanks.

Share this post


Link to post
Share on other sites

Good to know about

... sourceConfig = {Prop2" ...

How can we add "Items" collection editor to the PropertyGrid for respective components ?

 

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×