Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
IWGrid.RefreshAsyncRender
#1
Hi @all,

The problem is difficult to put into words.

Therefore here is a small test case to reproduce the problem.

The key point is the use of "RefreshAsyncRender" in IWModalWindow.

It works as expected for all controls in the frame.

However, as soon as an IWGrid is present in the frame and this in turn contains controls, then there are problems with other controls in the frame.

Thanks in advance for useful information!


Attached Files
.zip   TST.zip (Size: 60.07 KB / Downloads: 2)
The way to success is always under construction ... but i see a light at the end of the tunnel  Idea Big Grin
Reply
#2
I'll have a look and let you know.
Reply
#3
I can confirm the problem. I believe it's happening because the hidden input fields that should have been created when the grid renders itself again in async are not being created correctly. I'll see if I can release a fix for it soon.
Reply
#4
This issue has been fixed and will be available in the next update.

Cheers
Reply
#5
(07-17-2022, 12:41 AM)Alexandre Machado Wrote: This issue has been fixed and will be available in the next update.

Cheers

Thanks for quick response!

In this context: Why are the identifiers in the EventParams not generated uniformly?

The component name (in frames plus "_" plus OwnerFrame.Name) is usually specified in EventParams of AsyncEvents.

In the events of TIWCheckBox / TIWSelect, however, the component name is extended by "_CHECKBOX" / "_SELECT".

Possibly the EventParams must therefore be evaluated as follows:

procedure TForm.IWControlAsyncChange (Sender: TObject; EventParams: TStringList);
var
  FName : string;
  FValue: string;
start
  FName:=TIWCustomControl(Sender).IWCLName;

  if Sender is TIWSelect      then FName:=ReplaceStr(FName, 'IWCL', '_SELECT'     ) else
  if Sender is TIWCheckBox then FName:=ReplaceStr(FName, 'IWCL', '_CHECKBOX') else FName:=ReplaceStr(FName, 'IWCL', '');

  FValue:=EventParams.Values[FName];

  ...
  ...

end;


Have a nice day
The way to success is always under construction ... but i see a light at the end of the tunnel  Idea Big Grin
Reply
#6
Not exactly that...

Please update to IW 15.2.63. It should fix this issue.

Please let me know how it goes.

Kind regards,
Reply
#7
(07-19-2022, 06:29 AM)Alexandre Machado Wrote: Not exactly that...

Please update to IW 15.2.63. It should fix this issue.

Please let me know how it goes.

Kind regards,

Hi Alexandre,

thanks for update: It works!

Another related question:

For example, a grid in a frame consists of 50 rows with 10 columns, with 5 of these columns each containing IWEdits:

Grid.Cell[R, C].Control:=TIWEdit.Create(Self);
TIWEdit(Grid.Cell[R, C].Control).SetParentComponent(IWFrameRegion);

If the value or a property of only two or three of these IWEdits is changed by the program, then, as I understand it, only one refresh of these changed IWEdits would be necessary:

TIWEdit(Grid.Cell[R, C].Control).RefreshAsyncRender;

Unfortunately, this does not work: The IWEdit is then outside the grid.

It works with Grid.RefreshAsyncRender.

However, the entire grid is updated with all the cells/controls it contains. That's not really performant. Right?


Do you remember my question about the EventParams?

Normally:
IWCOMBOBOX1_DIALOG4=0
IWEDIT1_DIALOG4=8888
IWMEMO1_DIALOG4=Hello
But:
IWCHECKBOX1_DIALOG4_CHECKBOX=off
IWSELECT1_DIALOG4_SELECT=0

Why are there these extensions?

Cheers
The way to success is always under construction ... but i see a light at the end of the tunnel  Idea Big Grin
Reply
#8
Not exactly performant, yes, in case you have such a big grid. I'll have a look at the IWEdit refresh and why it is not working.

Regarding the EventParams, there is actually no requirement that the field needs to have the same name as the component. The component itself handles this internally in a transparent way. In general you don't need to deal with it directly, do you?

Each TIWControl has a method like this:

function TIWCustomCheckBox.IsForThisControl(AName: string): Boolean;
begin
Result := SameText(HTMLName + '_CHECKBOX', AName);
end;

So, the IWCheckBox itself knows what field name it expects.
Reply
#9
(07-28-2022, 03:01 AM)Alexandre Machado Wrote: Not exactly performant, yes, in case you have such a big grid. I'll have a look at the IWEdit refresh and why it is not working.

Regarding the EventParams, there is actually no requirement that the field needs to have the same name as the component. The component itself handles this internally in a transparent way. In general you don't need to deal with it directly, do you?

Each TIWControl has a method like this:

function TIWCustomCheckBox.IsForThisControl(AName: string): Boolean;
begin
  Result := SameText(HTMLName + '_CHECKBOX', AName);
end;

So, the IWCheckBox itself knows what field name it expects.

Regarding TIWEdit.RefreshAsyncRender:
It is not only TIWEdit but also all other controls; probably TIWCustomControl.RefreshAsyncRender.

Regarding EventParams:
Normally you don't need it. However, if you need to generate controls dynamically in frames in asynchronous events, then you need it.

Example:
Frame1 contains Button1.
An additional control must be generated in Button1.OnAsyncClick, which in turn has an asynchronous event.
In this event, it is only possible to react to a changed value of the control using the EventParams with the name of the control.

Is that correct or do I have a misconception?


Kind regards
The way to success is always under construction ... but i see a light at the end of the tunnel  Idea Big Grin
Reply
#10
Regarding the changes in the IWEdits (or any other control), what are you changing in the IWEdits that are nested into the grid cells? Most things that you can change in the edit control (other than parent) can be set as usual and you don't need to do anything (it will just update as usual without re-rendering the whole grid).

For instance, this works without any issues:

TIWEdit(Grid.Cell[1, 3].Control).Font.Color := clGreen;
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)