Page 1 of 1
UPD_Entry changes field atributes to append
Posted: Tue Apr 18, 2017 6:00 am
by amadorsilvestre
There is a list that has 3 columns that do a quick calculation and put the result into another column in that list.
The calc is triggered by a keypress or an enter key. The problem is, after the calc is done run UPD_Entry in the list and it updates everything.
During that update, it causes the new entry to the cell to be appended instead of replaced (clear and add).
Re: UPD_Entry changes field atributes to append
Posted: Tue Apr 18, 2017 10:19 am
by Stewart Marshall
The Keypress event fires when the key is pressed and BEFORE the field values in the list are updated. This allows you to trap specific keys if required.
However, for the purposes of updating a total, it's best is to use the ItemChanged event. This fires after the underlying list values have been updated
Code: Select all
Begin_Com Role(*EXTENDS #PRIM_WEB) Width(817) Height(593)
Define_Com Class(#PRIM_LIST) Name(#List1) DisplayPosition(1) Left(16) Parent(#COM_OWNER) TabPosition(1) Top(8) Height(426) Width(537)
Define_Com Class(#PRIM_LIST.Number) Name(#ColumnSTD_QTY1) ColumnWidth(181) DisplayPosition(1) Increment(1) Parent(#List1) Source(#STD_QTY) Wrap(False) ColumnReadOnly(False) EditAlignment(Right) DisplayAlignment(Right)
Define_Com Class(#PRIM_LIST.Number) Name(#ColumnSTD_PRICE1) ColumnWidth(136) DisplayPosition(2) Increment(1) Parent(#List1) Source(#STD_PRICE) Wrap(False) ColumnReadOnly(False) DisplayAlignment(Right) EditAlignment(Right)
Define_Com Class(#PRIM_LIST.Number) Name(#ColumnSTD_AMNT1) ColumnWidth(148) DisplayPosition(3) Increment(1) Parent(#List1) Source(#STD_AMNT) Wrap(False) DisplayAlignment(Right) EditAlignment(Right)
Evtroutine Handling(#Com_owner.CreateInstance)
Inz_List Named(#List1) Num_Entrys(10)
Endroutine
Evtroutine Handling(#List1.ItemChanged)
#std_amnt := #Std_price * #Std_qty
Upd_Entry In_List(#List1)
Endroutine
End_Com
Regards