Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
TIWEdit in a TIWGrid
#1
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?
Reply
#2
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.
Reply
#3
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?
Reply
#4
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.
Reply
#5
(10-27-2018, 02:43 PM)kudzu Wrote: 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.

I did try giving it a name but that didn't appear to make any difference.

Please send me a link to the demo you are talking about, I have not managed to find it anywhere.
Reply
#6
https://github.com/Atozed/IntraWeb/tree/...XIV/Delphi

IIRC, its in Features.
Reply
#7
(10-28-2018, 01:43 PM)kudzu Wrote: https://github.com/Atozed/IntraWeb/tree/...XIV/Delphi

IIRC, its in Features.

I added the EditGrid demo form from features to my project and it works fine.

In the end after much experimentation I realized it was using the OnAsyncChange event of the ComboBox that was the culprit. Changed to the OnChange event and all now works as expected.

Thanks.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)