Hello Sieghard,

 Finaly I opted  for the solution of scanning an array of TCUSTOMEDITDATAEDIT .

procedure tfrmInfotiersfo.settext(const sender: tcustomdataedit;
               var atext: msestring; var accept: Boolean);
var  intf1:idbeditfieldlink; i:integer;
begin
for i := low(aSum) to high(aSum) do
if sender.name=aSum[i].name then
begin
accept:=tcustomdataedit(aSum[i]).getinterface(idbeditfieldlink,intf1);
with intf1.getfieldlink(), tstringdisp(findcomponent( 'SUM'+fieldName)) do
text:=updatesum(tfield(dataset.fieldbyname(fieldName)), atext, accept, text);
break;
end; end;

Where aSum is the array of tcustomdataedit , setText it's an event fired when 
the user type in and update the field.

Med.
________________________________
De : Sieghard via mseide-msegui-talk <mseide-msegui-talk@lists.sourceforge.net>
Envoyé : jeudi 3 août 2023 23:09
À : mseide-msegui-talk@lists.sourceforge.net 
<mseide-msegui-talk@lists.sourceforge.net>
Cc : Sieghard <s_c_...@arcor.de>
Objet : Re: [MSEide-MSEgui-talk] INITIALIZATION SECTION

Hello mohamed,

you wrote on Thu, 3 Aug 2023 15:46:20 +0000:

> In my case , replacing :
> var frmInfotiersfo: tfrmInfotiersfo; aR1:array[1..2] of tcustomdataedit;
> oCustEdit:tcustomDataEdit; with
>  const   aSum set of tcustomdataedit = [ Price, Amount .....] and then I
> can do
>
>   if oCustEdit in  aSum then  sumField( aSum[?], n);

Just asking: Is this application code or is this an internal part of msgui?
If this was application code, could you make do with something like this:

TYPE
  app_field = (Price, Amount ...);
  aSum: SET OF app_field = [ Price, Amount ... ];
  oCustEdit: app_field;
VAR
  frmInfotiersfo: tfrmInfotiersfo;
  aR1: ARRAY [Price..Amount {aSum?}] OF tcustomdataedit;
...
and later use it like
...
  IF oCustEdit IN aSum THEN sumField (aR1 [oCustEdit], n);
...
i.e. doing the set operation on an enumerated index variable and using
that to select the appropriate field  That's how I would approach such a
problem, anyway.

--
(Weitergabe von Adressdaten, Telefonnummern u.ä. ohne Zustimmung
nicht gestattet, ebenso Zusendung von Werbung oder ähnlichem)
-----------------------------------------------------------
Mit freundlichen Grüßen, S. Schicktanz
-----------------------------------------------------------




_______________________________________________
mseide-msegui-talk mailing list
mseide-msegui-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mseide-msegui-talk
_______________________________________________
mseide-msegui-talk mailing list
mseide-msegui-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mseide-msegui-talk

Reply via email to