To change Format of a Field in 28.1 using trigger

sathya02

New Member
In Voucher Maintenance program iam doing one trigger to increase the format of the field in distribution line description but not able to recognize the particular field. the trigger is,

ON ENTRY ANYWHERE
DO:
IF SELF:TYPE = "FRAME" AND SELF:NAME = "a" THEN
DO:
SELF:WIDTH = 80.
END.
IF SELF:TYPE = "FILL-IN" THEN DO:
IF SELF:FRAME-NAME = "a" AND SELF:NAME = "i-desc" THEN DO:
SELF:FORMAT IN FRAME a = "X(60)".
SELF:WIDTH = 65.
APPLY "ENTRY" TO SELF.
RETURN.
END.
END.
END.
{gprun.i ""apvomt.p""}


This code should be executed in GUI.


Sathya
 

subhendra

New Member
Hi,

I had written similar trigger on Customer Maintenance. This works fine with me. You can try the below code for your program.

---------------
{mfdeclre.i}
ON ENTRY ANYWHERE DO:
DEF VAR Hdl as handle no-undo.
DEF VAR Cdl as handle no-undo.
Hdl = SELF:HANDLE.
IF Hdl:TYPE = "FRAME" AND Hdl:NAME = "a" THEN
DO:
Hdl = Hdl:FIRST-CHILD.
Hdl = Hdl:FIRST-CHILD.
Blk1:
DO WHILE VALID-HANDLE(Hdl):
IF Hdl:NAME = "cm_addr" THEN
ASSIGN
Hdl:FORMAT = "X(9)"
Hdl:WIDTH-CHAR = 9.
Hdl = Hdl:NEXT-SIBLING.
END.
END.
END.
{gprun.i ""adcsmt.p""}
-----------
 
/* Voucher Maintenance - To accept 40 characters of Voucher */

{mfdtitle.i}
Pause 0.

/*********** ON ENTRY ANYWHERE ************/
ON ENTRY, LEAVE ANYWHERE
DO:
IF SELF:NAME = "i-desc" AND SELF:FRAME-NAME = "a" THEN
DO:
Hide Message No-pause.
SELF:RESIZABLE = TRUE.
SELF:FORMAT = "x(40)" .
Hide Message No-pause.
END. /*IF SELF:NAME = "i-desc" */
END. /*ON ENTRY ANYWHERE*/
PAUSE(0).

{gprun.i ""apvomt.p""}


HTH,
Shiva
 

sathya02

New Member
Hi,

No Error.

Simply it work as normal Voucher Maintenance program.
It's not able to recognize the "Frame a & Field i-desc" and it accept upto 24 char only.

Sathya
 

sathya02

New Member
Hi,

Sorry for delay.

Now am able to change the format but it is not store in the field "i-desc"

ON GO, TAB, back-tab, enter, LEAVE, RETURN, ABORT ANYWHERE
DO:
IF SELF:FRAME-NAME = "a" AND SELF:NAME = "i-desc" THEN
DO:
SELF:FRAME:SCROLLABLE = TRUE.
SELF:RESIZABLE = TRUE.
SELF:WIDTH = 65.
SELF:FORMAT IN FRAME a = "X(60)".
/*MESSAGE "Inside Frame Name i-desc Making Format"
VIEW-AS ALERT-BOX ERROR BUTTONS OK.
RETURN NO-APPLY. */
/* SELF:WIDTH = 65. */
APPLY "ENTRY" TO SELF.
RETURN.
END.

END.

{gprun.i ""apvomt.p""}


Sathya
 

sathya02

New Member
Hi,

Sorry for Delay reply.

Actually It works fine now i made to accept the format as i want.

Thanks for support


Sathya
 

karthikeyan

New Member
In Voucher Maintenance program iam doing one trigger to increase the format of the field in distribution line description but not able to recognize the particular field. the trigger is,

ON ENTRY ANYWHERE
DO:
IF SELF:TYPE = "FRAME" AND SELF:NAME = "a" THEN
DO:
SELF:WIDTH = 80.
END.
IF SELF:TYPE = "FILL-IN" THEN DO:
IF SELF:FRAME-NAME = "a" AND SELF:NAME = "i-desc" THEN DO:
SELF:FORMAT IN FRAME a = "X(60)".
SELF:WIDTH = 65.
APPLY "ENTRY" TO SELF.
RETURN.
END.
END.
END.
{gprun.i ""apvomt.p""}


This code should be executed in GUI.


Sathya









Try this


{mfdtitle.i}

define variable frmhdl as handle no-undo.
define variable wdghdl as handle no-undo.

on "entry" anywhere do:

if self:type <> "fill-in" then return.
frmhdl = self:frame .
if frmhdl:name <> "a" then return.
wdghdl = self .
case wdghdl:name :
when "i-desc"
then do:
message "hi" view-as alert-box.
frmhdl:width-chars = 80.
wdghdl:width-chars = 50.
wdghdl:format = "X(60)".
end.
end.
end.

pause 0.
{gprun.i ""apvomt.p""}
 
Top