c++builder - Firemonkey: TGrid usage on Embarcadero C++ Builder XE3 -
I am trying to create a device that reads the data from the database and can use it in the FireMonkey using a TGIR Displays in the form. I need to use different types of columns like TCheckColumn and TPopupColumn, but can not find any good guides or examples on how to use them in C ++ Builder.
Either way, I managed to understand the use of TStringColumn, the column of TGrogress, set the value of the cell on the event of TGridGet value
Does anyone know how to set up TCheckColumn, TImageColumn and TPopupColumn columns for any one?
Thanks DANIEL
--- UPDATE-- -
I have been able to use the test column. This is what I do in the manufacturer of the form. I:
// TStringColumn Grid1-> AddObject (new TStringColumn (this)); // TCheckColumn TCheckColumn * c = new TCheckColumn (this); Grid1-> AddObject (c); // TPopupColumn // List of values TStringList * l = new TStringList (NULL); L & gt; Pairs (L "first"); L & gt; Pairs (L "second"); L & gt; Pairs (L "third"); TPopupColumn * p = new TPopupColumn (this); // Adding a list to the popup column p- & gt; Item = l; Grid1-> AddObject (P); // TProgressColumn Grid1-> AddObject (new TProgressColumn (this)); Grid 1- & gt; Raukount = 3; And this Grid1GetValue method is:
// TStringColumn if (colonel == 0) value = TValue :: & lt; String & gt; (Line) ; // TCheckColumn !! This can not work if (Colonel == 1) value = TV: :: from & lt; Boolean & gt; (truth); // TPopupColumn if (Colonel == 2) value = TV: :: from & lt; Int & gt; (2); // Target column if (Colonel == 3) value = TV: :: from & lt; Double & gt; (50.0); --- Update ---
If I save the value of the column using the method OnSetValue
zero __fastcall TForm1 :: Grid1SetValue (...) {if (Colonel == 1) check = value; } and then the method set with OnGetValue:
zero __fastcall TForm1 :: Grid1GetValue (...) {// TCheckColumn !! This can not work if (Colonel == 1) value = check; // TV: :: from & lt; Boolean & gt; (truth); } After clicking on a checkbox, all other checkboxes change state. Then the component works correctly ... Now the thing is to set the right or wrong value correctly.
TGris does not store any data, you should create your own datastorage
type TField = records with TCheckColumn, TStringColumn and TPopupColumn were checked: Boolean; Name: string; Columns: Bytes; End; Var Field: TLIST & LT; Tiffild & gt; Function setfield (consecuted: boolean; constant anonym: string; cons. Acclam: byte): tfild; Start getting started with the result checked: = ehkake; Name: = Anonymous; Columns: = Echolam; End; End; Process TForm1.FormCreate (Sender: TObject); Var I: integer; Start field: = TList & lt; TField & gt; Create; Field.ed (setfield (true, 'name', 1)); Field.ed (setfield (true, 'login', 2)); Field.ed (setfield (true, 'password', 3)); For I: For = 1 field. Calculation popup column 1. item. Add ('Column' + IntToStr (I)); GdFields.RowCount: = Field.Count; End; Process TForm1.FormDestroy (Sender: Tubect); Start the field. free; End; Process TFormExport.gdFieldsGetValue (Sender: Tubect; Constant Call, Line: Integer; var Value: TLL); Early case gdFields.Column [Colonel]. 0 order: value: = field [row]. check; 1: value: = field [row] .name; 2: value: = field [line]. Column-1; End; End; Process TFormExport.gdFieldsSetValue (Sender: Tubect; Constant Call, Line: Integer; Moderate Price: TLL); Var FACC: Tiffild; Start FRec: = field [row]; Case gdFields.Columns [Col.] Order of 0: FRec.Checked: = Value.AsBoolean; 1: FRec.Name: = Value.AsString; 2: FRec.Column: Value.AsInteger + 1; End; Field [row]: = FRC; End; Now all data from your datastorez will be changed after editing your tigritude, but potential bugs in TGIR - have never been received after changing popup columns
Comments
Post a Comment