Posts: 4
Threads: 1
Joined: Oct 2018
Reputation:
0
Location: New Zealand
IntraWeb v14.2.3 newbie.
I add an edit into a grid:
{Grid: TIWGrid}
var
Edit: TIWEdit ;
begin
Edit := TIWEdit.Create(Self) ;
Edit.Parent := Self ;
Edit.Alignment := taRightJustify ;
Edit.Editable := True ;
Edit.Text := '1' ;
Edit.OnAsyncExit := edtAsyncExit ;
Grid.Cell[1,2].Control := Edit ;
end ;
This puts the edit in the grid in the (sort of) correct place, I then edit the value in the grid (change 1 to 2), if I then add a new row the edit goes back to it's original value (1). How do I get this to work?
Posts: 1,136
Threads: 37
Joined: Mar 2018
Reputation:
30
Location: Limassol, Cyprus
I have no context to know when the above code is being called. Its likely that your code is being called again and it is resetting it by rerunning.
Posts: 4
Threads: 1
Joined: Oct 2018
Reputation:
0
Location: New Zealand
10-26-2018, 09:58 PM
(This post was last modified: 10-26-2018, 10:00 PM by dave@corplogistics.co.nz.
Edit Reason: An afterthought
)
IW 14.2.6 now.
The code is called in the OnAsyncChange of an iwCombobox and is only called once (traced into).
The event adds a new line to the grid and populates it with two iwEdit's in two cells.
Consequent editing of the iwEdit shows that in the OnAsyncKeypress event of the iwEdit the character entered (EventParams.Values['which']) is correct, but the underlying .Text value is never updated. The [displayed] value is correct in the iwEdit control until the grid is refreshed, then it goes back to the .Text value.
Is there something I am not setting up properly when I create the iwEdit control?
Is there some other way to get a couple of columns in a grid to be editable?
Posts: 1,136
Threads: 37
Joined: Mar 2018
Reputation:
30
Location: Limassol, Cyprus
The current grid is very limited. Most user use CG or TMS for advanced grids. IW17 also has much better grids coming.
Input via the grid is a bit tricky and limited and IIRC its not automatic. For one, IW uses names to resolve things and your edit has no name. Take a look at the IW demos. One of them shows usage of editing in a grid. Please take a look how it performs this function.