JDDEV Posted May 23, 2019 Share Posted May 23, 2019 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 Quote Link to comment Share on other sites More sharing options...
Sherzod Posted May 23, 2019 Share Posted May 23, 2019 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; Quote Link to comment Share on other sites More sharing options...
JDDEV Posted May 24, 2019 Author Share Posted May 24, 2019 Thanks, I do exactly the same code, but the result is empty What is wrong ? PS : i use version n° 1.90.0.1496 Quote Link to comment Share on other sites More sharing options...
Sherzod Posted May 24, 2019 Share Posted May 24, 2019 2 hours ago, JDDEV said: I do exactly the same code, but the result is empty Can you make a simple testcase for this? Quote Link to comment Share on other sites More sharing options...
JDDEV Posted May 27, 2019 Author Share Posted May 27, 2019 Hi, this is a testcase from the demo "Property Grid". Property Grid.zip Quote Link to comment Share on other sites More sharing options...
JDDEV Posted May 27, 2019 Author Share Posted May 27, 2019 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; Quote Link to comment Share on other sites More sharing options...
Sherzod Posted May 27, 2019 Share Posted May 27, 2019 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; ... Quote Link to comment Share on other sites More sharing options...
JDDEV Posted May 28, 2019 Author Share Posted May 28, 2019 Thanks, it is working well , Is it a bug ? Is it possible to define type of properties ? (boolean, list of items...) Quote Link to comment Share on other sites More sharing options...
Sherzod Posted May 29, 2019 Share Posted May 29, 2019 On 5/28/2019 at 1:40 PM, JDDEV said: boolean UniPropertyGrid1.AddProperty(['Prop1', True]); Quote Link to comment Share on other sites More sharing options...
JDDEV Posted June 3, 2019 Author Share Posted June 3, 2019 Thanks. If i well understand, it is not possible to have a property with a combobox editor and a list of items to choice ? Quote Link to comment Share on other sites More sharing options...
Sherzod Posted June 3, 2019 Share Posted June 3, 2019 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 Quote Link to comment Share on other sites More sharing options...
Sherzod Posted June 4, 2019 Share Posted June 4, 2019 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 Quote Link to comment Share on other sites More sharing options...
Sherzod Posted June 7, 2019 Share Posted June 7, 2019 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"]})})}};'); Quote Link to comment Share on other sites More sharing options...
JDDEV Posted July 3, 2019 Author Share Posted July 3, 2019 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 ? Quote Link to comment Share on other sites More sharing options...
Sherzod Posted July 3, 2019 Share Posted July 3, 2019 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; ? Quote Link to comment Share on other sites More sharing options...
JDDEV Posted July 3, 2019 Author Share Posted July 3, 2019 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. Quote Link to comment Share on other sites More sharing options...
andyhill Posted July 4, 2019 Share Posted July 4, 2019 Good to know about ... sourceConfig = {Prop2" ... How can we add "Items" collection editor to the PropertyGrid for respective components ? Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.