Intraweb 15.1.5 - IWEdit in IWGrid.Cell problem - Printable Version +- Atozed Forums (https://www.atozed.com/forums) +-- Forum: Atozed Software Products (https://www.atozed.com/forums/forum-1.html) +--- Forum: IntraWeb (https://www.atozed.com/forums/forum-3.html) +---- Forum: English (https://www.atozed.com/forums/forum-16.html) +----- Forum: IntraWeb General Discussion (https://www.atozed.com/forums/forum-4.html) +----- Thread: Intraweb 15.1.5 - IWEdit in IWGrid.Cell problem (/thread-1288.html) Pages:
1
2
|
Intraweb 15.1.5 - IWEdit in IWGrid.Cell problem - piotr.lewicki@mapi.com.pl - 10-05-2019 Hi I have a TIWGrid Control with 6 columns and 10 rows. For all cells in grid I create a TIWEdit Control. (button Fill) procedure TIWMainForm.IWButton1Click(Sender: TObject); var i, j: Integer; begin for j := 0 to IWGrid1.RowCount - 1 do for i := 0 to IWGrid1.ColumnCount - 1 do begin with IWGrid1.Cell[j, i] do begin Alignment := taCenter; Width := IntToStr(Round(IWGrid1.Width / IWGrid1.ColumnCount)); Control := TMyIWEdit.Create(IWGrid1); with TMyIWEdit(Control) do begin X := i; Y := j; Text := ''; Width := StrToInt(IWGrid1.Cell[j, i].Width) - 10; OnAsyncKeyDown := OnAsyncKeyDownControl; OnAsyncClick := OnAsyncClickControl; end; end; end; SetFocus(0, 0); end; [attachment=174] Any IWEdit control has attached procedure for OnAsyncKeyDown event (code below). The procedure realize the below behavior: When enter to first control in any rows, enter any value to IWEdit control in selected cell and push enter key all other IWEdit controls in current row will have the same value. And here is a problem. All IWEdit controls in current row, wchich have changed value, are move to left, upper corner of IWGrid control. [attachment=175] In Intraweb ver. 14.2.6 i haven't the problem.. In Intraweb ver. 15.1.6 problem exists. Where can be a problem? Test project: https://github.com/PeterDelphinsky/IWGridTest procedure TIWMainForm.OnAsyncKeyDownControl(Sender: TObject; EventParams: TStringList); var pKey: Integer; pText: String; i: Integer; begin if not TryStrToInt(EventParams.Values['Which'],pKey) then pKey := 0; if pKey = 13 then begin pText := IWGrid1.Cell[Y, X].Control.Text; if (X = 0) and (pText <> '') then begin for i := X + 1 to IWGrid1.ColumnCount - 1 do IWGrid1.Cell[Y, i].Control.Text := pText; //<-- Exit; end; // (...) end; end; RE: Intraweb 15.1.5 - IWEdit in IWGrid.Cell problem - MJS@mjs.us - 10-05-2019 The buttons will need a unique 'Name' value assigned after being created. Something like: Control := TMyIWEdit.Create(IWGrid1); with TMyIWEdit(Control) do begin Name := 'btn'+IntToStr(i)+IntToStr(j); ... RE: Intraweb 15.1.5 - IWEdit in IWGrid.Cell problem - piotr.lewicki@mapi.com.pl - 10-05-2019 (10-05-2019, 05:34 PM)MJS@mjs.us Wrote: The buttons will need a unique 'Name' value assigned after being created. Something like: thanks, but problem still exists... :-( Piotr Lewicki RE: Intraweb 15.1.5 - IWEdit in IWGrid.Cell problem - MJS@mjs.us - 10-05-2019 The button 'Parent' value may need to be set also. RE: Intraweb 15.1.5 - IWEdit in IWGrid.Cell problem - piotr.lewicki@mapi.com.pl - 10-05-2019 (10-05-2019, 06:50 PM)MJS@mjs.us Wrote: The button 'Parent' value may need to be set also. Parent is TWinControl, but IWComponents don't inherit from TWinControls....? TIWEdit(Control).Parent := IWGrid -> [dcc32 Error] IWMainFrm.pas(70): E2010 Incompatible types: 'TWinControl' and 'TIWGrid' PLE RE: Intraweb 15.1.5 - IWEdit in IWGrid.Cell problem - MJS@mjs.us - 10-05-2019 Interesting... what about setting the TIWEdit 'Parent' to the form? RE: Intraweb 15.1.5 - IWEdit in IWGrid.Cell problem - piotr.lewicki@mapi.com.pl - 10-05-2019 (10-05-2019, 09:02 PM)MJS@mjs.us Wrote: Interesting... what about setting the TIWEdit 'Parent' to the form? TIWMainForm -->TIWRegion -->TIWGrid -->Cell[row,col] -->Control = TIWEdit How do you think, what is Parent for Control in Cell? If I set Parent as TIWMainForm, my IWGrid renders incorrectly. PLE RE: Intraweb 15.1.5 - IWEdit in IWGrid.Cell problem - DanBarclay - 10-05-2019 (10-05-2019, 06:10 PM)piotr.lewicki@mapi.com.pl Wrote:Be sure to assign the unique name. Unique to the page, so be sure there isn't another 'btnXY'. I use the grid .name in front like(10-05-2019, 05:34 PM)MJS@mjs.us Wrote: The buttons will need a unique 'Name' value assigned after being created. Something like: Name:=self.name+'btn'[b]+IntToStr(i)+IntToStr(j);[/b] It's too easy to duplicate a name with something else on the page and HTML simply won't put up with it. I don't use edit controls, but with checkboxes and radio boxes I also include. SubmitOnAsyncEvent:=true; I manage all of my cell controls in the grid RenderCell procedure. That involves checking to insure that cell's control is not already created. Another point, although it's supposed to be OK, I just don't cascade "with" statements. Having the IWEdit inside the Cell should be fine, I just don't trust it. (others will disagree with me on that!) Dan RE: Intraweb 15.1.5 - IWEdit in IWGrid.Cell problem - kudzu - 10-06-2019 You can check in our Demos to see. Off hand I dont think a parent is set for grid based controls but the demo will show for sure the right way. RE: Intraweb 15.1.5 - IWEdit in IWGrid.Cell problem - piotr.lewicki@mapi.com.pl - 10-07-2019 Thanks for all, but problem still exists. Why the same code is working in old version (14) of Intraweb , but in new version (15) doesn't. Still I'm looking a solution... Have a nice day. PLE |