Form S_153FB: Email Demonstration B
Name: S_153FB
Description: The following RDMLX form demonstrates various aspects of email integration and the use of resuable part S_153RML.
FUNCTION OPTIONS(*DIRECT);
BEGIN_COM FORMPOSITION(ScreenCenter) HEIGHT(574) LAYOUTMANAGER(#SPLM_1) LEFT(173) TOP(74) WIDTH(710);
DEFINE_COM CLASS(#PRIM_SPLM) NAME(#SPLM_1);
DEFINE_COM CLASS(#PRIM_PANL) NAME(#PANL_1) DISPLAYPOSITION(1) HEIGHT(392) LAYOUTMANAGER(#SPLM_2) LEFT(0) PARENT(#COM_OWNER) TABPOSITION(2) TABSTOP(False) TOP(0) WIDTH(702);
DEFINE_COM CLASS(#PRIM_PANL) NAME(#PANL_2) DISPLAYPOSITION(2) HEIGHT(151) LAYOUTMANAGER(#SPLM_3) LEFT(0) PARENT(#COM_OWNER) TABPOSITION(3) TABSTOP(False) TOP(396) WIDTH(702);
DEFINE_COM CLASS(#PRIM_SPLI) NAME(#SPLI_1) MANAGE(#PANL_1) PARENT(#SPLM_1) WEIGHT(1);
DEFINE_COM CLASS(#PRIM_SPLI) NAME(#SPLI_2) MANAGE(#PANL_2) PARENT(#SPLM_1);
DEFINE_COM CLASS(#PRIM_SPLM) NAME(#SPLM_2) ORIENTATION(Vertical);
DEFINE_COM CLASS(#PRIM_PANL) NAME(#PANL_3) DISPLAYPOSITION(1) HEIGHT(392) LAYOUTMANAGER(#ATLM_3) LEFT(0) PARENT(#PANL_1) TABPOSITION(1) TABSTOP(False) TOP(0) VISUALSTYLE(#VS_PANEL) WIDTH(432);
DEFINE_COM CLASS(#PRIM_PANL) NAME(#PANL_4) DISPLAYPOSITION(2) HEIGHT(392) LAYOUTMANAGER(#ATLM_2) LEFT(436) PARENT(#PANL_1) TABPOSITION(2) TABSTOP(False) TOP(0) VISUALSTYLE(#VS_PANEL) WIDTH(266);
DEFINE_COM CLASS(#PRIM_SPLI) NAME(#SPLI_3) MANAGE(#PANL_3) PARENT(#SPLM_2);
DEFINE_COM CLASS(#PRIM_SPLI) NAME(#SPLI_4) MANAGE(#PANL_4) PARENT(#SPLM_2) WEIGHT(1);
DEFINE_COM CLASS(#PRIM_ATLM) NAME(#ATLM_2);
DEFINE_COM CLASS(#PRIM_ATLM) NAME(#ATLM_3);
DEFINE_COM CLASS(#PRIM_SPLM) NAME(#SPLM_3) ORIENTATION(Vertical);
DEFINE_COM CLASS(#PRIM_PANL) NAME(#PANL_5) DISPLAYPOSITION(1) HEIGHT(151) LAYOUTMANAGER(#ATLM_1) LEFT(0) PARENT(#PANL_2) TABPOSITION(1) TABSTOP(False) TOP(0) VISUALSTYLE(#VS_PANEL) WIDTH(245);
DEFINE_COM CLASS(#PRIM_PANL) NAME(#PANL_6) DISPLAYPOSITION(2) HEIGHT(151) LAYOUTMANAGER(#ATLM_4) LEFT(249) PARENT(#PANL_2) TABPOSITION(2) TABSTOP(False) TOP(0) VISUALSTYLE(#VS_PANEL) WIDTH(453);
DEFINE_COM CLASS(#PRIM_SPLI) NAME(#SPLI_5) MANAGE(#PANL_5) PARENT(#SPLM_3);
DEFINE_COM CLASS(#PRIM_SPLI) NAME(#SPLI_6) MANAGE(#PANL_6) PARENT(#SPLM_3) WEIGHT(1);
DEFINE_COM CLASS(#PRIM_ATLM) NAME(#ATLM_1);
DEFINE_COM CLASS(#PRIM_ATLM) NAME(#ATLM_4);
DEFINE_COM CLASS(#PRIM_DCBX) NAME(#DCBX_1) DISPLAYPOSITION(1) FILEINCLUDEMASK('"*.*"') HEIGHT(143) LEFT(2) NOTIFYCOMPONENT(#DCBX_2) PARENT(#PANL_5) TABPOSITION(1) TABSTOP(False) TOP(2) WIDTH(237);
DEFINE_COM CLASS(#PRIM_ATLI) NAME(#ATLI_1) ATTACHMENT(Center) MANAGE(#DCBX_1) MARGINBOTTOM(2) MARGINLEFT(2) MARGINRIGHT(2) MARGINTOP(2) PARENT(#ATLM_1);
DEFINE_COM CLASS(#PRIM_DCBX) NAME(#DCBX_2) DISPLAYPOSITION(1) DISPLAYSTYLE(GeneralListView) FILEINCLUDEMASK('"*.*"') HEIGHT(143) LEFT(2) PARENT(#PANL_6) TABPOSITION(1) TABSTOP(False) TOP(2) WIDTH(445);
DEFINE_COM CLASS(#PRIM_ATLI) NAME(#ATLI_2) ATTACHMENT(Center) MANAGE(#DCBX_2) MARGINBOTTOM(2) MARGINLEFT(2) MARGINRIGHT(2) MARGINTOP(2) PARENT(#ATLM_4);
DEFINE_COM CLASS(#PRIM_ATLI) NAME(#ATLI_3) ATTACHMENT(Center) PARENT(#ATLM_2);
DEFINE_COM CLASS(#PRIM_GRID) NAME(#GRID_1) COLUMNBUTTONHEIGHT(21) DISPLAYPOSITION(1) HEIGHT(384) LEFT(2) PARENT(#PANL_4) TABPOSITION(1) TOP(2) WIDTH(258);
DEFINE_COM CLASS(#PRIM_ATLI) NAME(#ATLI_4) ATTACHMENT(Center) MANAGE(#GRID_1) MARGINBOTTOM(2) MARGINLEFT(2) MARGINRIGHT(2) MARGINTOP(2) PARENT(#ATLM_2);
DEFINE_COM CLASS(#PRIM_GDCL) NAME(#GDCL_1) CAPTION('Attachment(s) to Send ') CAPTIONTYPE(Caption) DISPLAYPOSITION(1) PARENT(#GRID_1) SOURCE(#SYSVAR$AV) TABSTOP(False) WIDTH(50) WIDTHTYPE(Remainder);
DEFINE_COM CLASS(#PRIM_ATLI) NAME(#ATLI_5) ATTACHMENT(Top) MARGINBOTTOM(4) MARGINLEFT(4) MARGINRIGHT(4) MARGINTOP(4) PARENT(#ATLM_3);
;
DEFINE_COM CLASS(#PRIM_ATLI) NAME(#ATLI_6) ATTACHMENT(Center) PARENT(#ATLM_3);
DEFINE_COM CLASS(#PRIM_MECL) NAME(#MECL_1) COLUMNROLE(Data) DISPLAYPOSITION(1) PARENT(#MEMO_1) SOURCE(#STD_TEXTL) WIDTH(20) WIDTHTYPE(Remainder);
DEFINE_COM CLASS(#PRIM_ATLI) NAME(#ATLI_7) ATTACHMENT(Top) MANAGE(#PANL_8) PARENT(#ATLM_3);
DEFINE_COM CLASS(#PRIM_PANL) NAME(#PANL_7) DISPLAYPOSITION(2) HEIGHT(213) LEFT(302) PARENT(#PANL_3) TABPOSITION(2) TABSTOP(False) TOP(175) WIDTH(126);
DEFINE_COM CLASS(#PRIM_ATLI) NAME(#ATLI_8) ATTACHMENT(Right) MANAGE(#PANL_7) PARENT(#ATLM_3);
DEFINE_COM CLASS(#PRIM_MEMO) NAME(#MEMO_1) CURRENTLINE(1) DISPLAYPOSITION(3) HEIGHT(213) LEFT(50) MAXIMUMLINELENGTH(75) PARENT(#PANL_3) TABPOSITION(3) TOP(175) WIDTH(252) WORDWRAP(True);
DEFINE_COM CLASS(#PRIM_ATLI) NAME(#ATLI_9) ATTACHMENT(Center) MANAGE(#MEMO_1) PARENT(#ATLM_3);
DEFINE_COM CLASS(#PRIM_PHBN) NAME(#BTN_SEND) CAPTION('Send Email') DISPLAYPOSITION(1) LEFT(2) PARENT(#PANL_7) TABPOSITION(1) TOP(8) WIDTH(119);
DEFINE_COM CLASS(#PRIM_PHBN) NAME(#BTN_CATCH) CAPTION('Clear Attachments') DISPLAYPOSITION(2) LEFT(2) PARENT(#PANL_7) TABPOSITION(2) TOP(44) WIDTH(120);
DEFINE_COM CLASS(#PRIM_PHBN) NAME(#PHBN_1) CAPTION('Clear Text Message') DISPLAYPOSITION(3) LEFT(2) PARENT(#PANL_7) TABPOSITION(3) TOP(80) WIDTH(119);
DEFINE_COM CLASS(#STD_TEXTL.Visual) NAME(#SUBJECT) CAPTION('Subject') DISPLAYPOSITION(4) HEIGHT(22) LABELTYPE(Caption) LEFT(0) MARGINLEFT(49) PARENT(#PANL_3) TABPOSITION(1) TOP(149) WIDTH(424);
DEFINE_COM CLASS(#PRIM_ATLI) NAME(#ATLI_10) ATTACHMENT(Top) MANAGE(#SUBJECT) MARGINBOTTOM(4) MARGINRIGHT(4) MARGINTOP(4) PARENT(#ATLM_3);
;
DEFINE_COM CLASS(#S_153RML) NAME(#MAIL) DISPLAYPOSITION(3) PARENT(#COM_OWNER);
DEFINE_COM CLASS(#PRIM_GPBX) NAME(#PANL_8) CAPTION('Addressing Details') DISPLAYPOSITION(1) HEIGHT(145) LEFT(0) PARENT(#PANL_3) TABPOSITION(4) TABSTOP(False) TOP(0) WIDTH(428);
DEFINE_COM CLASS(#PRIM_ATLI) NAME(#ATLI_11) ATTACHMENT(Top) PARENT(#ATLM_3);
DEFINE_COM CLASS(#PRIM_GRID) NAME(#GRID_TO) COLUMNBUTTONHEIGHT(18) DISPLAYPOSITION(1) HEIGHT(65) LEFT(48) PARENT(#PANL_8) ROWBUTTONS(True) ROWBUTTONWIDTH(22) ROWHEIGHT(22) TABPOSITION(1) TOP(15) WIDTH(369);
DEFINE_COM CLASS(#PRIM_GDCL) NAME(#GDCL_3) CAPTION('Email Address') CAPTIONTYPE(Caption) DISPLAYPOSITION(1) PARENT(#GRID_TO) READONLY(False) SOURCE(#STD_TEXTL) WIDTH(50);
DEFINE_COM CLASS(#PRIM_GDCL) NAME(#GDCL_4) CAPTION('Shown in Email as') CAPTIONTYPE(Caption) DISPLAYPOSITION(2) PARENT(#GRID_TO) READONLY(False) SOURCE(#STD_TEXTS) WIDTH(20) WIDTHTYPE(Remainder);
DEFINE_COM CLASS(#PRIM_GRID) NAME(#GRID_CC) COLUMNBUTTONHEIGHT(0) DISPLAYPOSITION(2) HEIGHT(48) LEFT(48) PARENT(#PANL_8) ROWBUTTONS(True) ROWBUTTONWIDTH(22) ROWHEIGHT(22) TABPOSITION(2) TOP(84) WIDTH(369);
DEFINE_COM CLASS(#PRIM_GDCL) NAME(#GDCL_5) DISPLAYPOSITION(1) PARENT(#GRID_CC) READONLY(False) SOURCE(#STD_TEXTL) WIDTH(50);
DEFINE_COM CLASS(#PRIM_GDCL) NAME(#GDCL_6) DISPLAYPOSITION(2) PARENT(#GRID_CC) READONLY(False) SOURCE(#STD_TEXTS) WIDTH(20) WIDTHTYPE(Remainder);
;
DEFINE_COM CLASS(#PRIM_LABL) NAME(#LABL_1) CAPTION('TO :') DISPLAYPOSITION(3) HEIGHT(19) LEFT(13) PARENT(#PANL_8) TABPOSITION(3) TABSTOP(False) TOP(35) VISUALSTYLE(#VS_EMPH) WIDTH(33);
DEFINE_COM CLASS(#PRIM_LABL) NAME(#LABL_2) CAPTION('CC :') DISPLAYPOSITION(4) HEIGHT(19) LEFT(15) PARENT(#PANL_8) TABPOSITION(4) TABSTOP(False) TOP(85) VISUALSTYLE(#VS_EMPH) WIDTH(25);
DEFINE_COM CLASS(#PRIM_LABL) NAME(#LABL_4) CAPTION('Message Text') DISPLAYPOSITION(5) HEIGHT(213) LEFT(0) PARENT(#PANL_3) TABPOSITION(5) TABSTOP(False) TOP(175);
DEFINE_COM CLASS(#PRIM_ATLI) NAME(#ATLI_13) ATTACHMENT(Left) MANAGE(#LABL_4) PARENT(#ATLM_3);
;
Def_Cond *Recipient '(#Std_TextL *ne *blanks)';
Define #LineNo RefFld(#Std_Num);
;
;
Define #LstTOAdr RefFld(#Std_TextL);
Define #LstCCAdr RefFld(#Std_TextL);
;
Define #LstTONam RefFld(#Std_TextS);
Define #LstCCNam RefFld(#Std_TextS);
;
* ============================================================;
* Form Initialization - Restore first entry in each grid;
* ============================================================;
;
EvtRoutine Handling(#Com_Owner.Initialize);
;
Set #Com_Owner Caption(*Component_Desc) ;
;
Change (#LstTOAdr #LstTONam) *Remembered_Value_For_User;
Change #Std_TextL #LstTOAdr;
Change #Std_TextS #LstTONam;
Add_Entry #Grid_TO;
;
Change (#LstCCAdr #LstCCNam) *Remembered_Value_For_User;
Change #Std_TextL #LstCCAdr;
Change #Std_TextS #LstCCNam;
Add_Entry #Grid_CC;
;
Change (#Std_TextL #Std_TextS) *Null;
;
Begin_Loop to(20);
Add_Entry #Grid_TO;
Add_Entry #Grid_CC;
End_Loop ;
;
EndRoutine ;
;
* ============================================================;
* Form Termination - Remember first entry from each grid;
* ============================================================;
;
EvtRoutine Handling(#Com_Owner.Closing);
;
Get_Entry 1 #Grid_TO;
Change #LstTOAdr #Std_TextL;
Change #LstTONam #Std_TextS;
;
Get_Entry 1 #Grid_CC;
Change #LstCCAdr #Std_TextL;
Change #LstCCNam #Std_TextS;
;
EndRoutine ;
;
* ============================================================;
* Handle a file selected in the right most explorer component;
* ============================================================;
;
EVTROUTINE HANDLING(#DCBX_2.ItemGotFocus) OPTIONS(*NOCLEARMESSAGES *NOCLEARERRORS);
if '#dcbx_2.PathType = File';
Use TConcat with_args(#dcbx_2.path #dcbx_2.filename) to_get(#SysVar$Av);
Change #Std_TextL *null;
Add_Entry #Grid_1;
Endif ;
ENDROUTINE ;
;
* ============================================================;
* Clear the attachments grid;
* ============================================================;
;
EVTROUTINE HANDLING(#BTN_CATCH.Click);
Clr_List #Grid_1;
ENDROUTINE ;
;
* ============================================================;
* Clear the message text memo;
* ============================================================;
;
EVTROUTINE HANDLING(#PHBN_1.Click);
Clr_List #Memo_1;
ENDROUTINE ;
;
* ============================================================;
* Send the email;
* ============================================================;
;
EVTROUTINE HANDLING(#BTN_SEND.Click);
;
* Set the subject;
;
Set #Mail Subject(#Subject.Value);
;
* Insert the TO and CC recipients;
;
SelectList #Grid_To;
If *Recipient;
Invoke #Mail.InsertRecipient Type(to) EMailAddress(#Std_TextL) VisualName(#Std_TextS);
Endif ;
EndSelect ;
;
SelectList #Grid_CC;
If *Recipient;
Invoke #Mail.InsertRecipient Type(cc) EMailAddress(#Std_TextL) VisualName(#Std_TextS);
Endif ;
EndSelect ;
;
* Add the text lines;
;
Change #LineNo 0;
SelectList #Memo_1;
Change #LineNo '#LineNo + 1';
Invoke #Mail.InsertItem Order(#LineNo) TextValue(#Std_TextL);
EndSelect ;
;
* Add the attachments;
;
SelectList #Grid_1;
Invoke #Mail.InsertAttachment FileName(#SysVar$Av);
EndSelect ;
;
* Send the mail;
;
Invoke #Mail.Send;
;
* Close the mail;
;
Invoke #Mail.Close;
;
* Finished;
;
ENDROUTINE ;
;
* ============================================================;
* Put up a message box if an unexpected error is detected;
* ============================================================;
;
EvtRoutine Handling(#Mail.MailErrorDetected);
Use Message_Box_Show (ok ok error *component 'Unexpected error when sending email.');
EndRoutine ;
;
;
END_COM ;
Name: S_153FB
Description: The following RDMLX form demonstrates various aspects of email integration and the use of resuable part S_153RML.
FUNCTION OPTIONS(*DIRECT);
BEGIN_COM FORMPOSITION(ScreenCenter) HEIGHT(574) LAYOUTMANAGER(#SPLM_1) LEFT(173) TOP(74) WIDTH(710);
DEFINE_COM CLASS(#PRIM_SPLM) NAME(#SPLM_1);
DEFINE_COM CLASS(#PRIM_PANL) NAME(#PANL_1) DISPLAYPOSITION(1) HEIGHT(392) LAYOUTMANAGER(#SPLM_2) LEFT(0) PARENT(#COM_OWNER) TABPOSITION(2) TABSTOP(False) TOP(0) WIDTH(702);
DEFINE_COM CLASS(#PRIM_PANL) NAME(#PANL_2) DISPLAYPOSITION(2) HEIGHT(151) LAYOUTMANAGER(#SPLM_3) LEFT(0) PARENT(#COM_OWNER) TABPOSITION(3) TABSTOP(False) TOP(396) WIDTH(702);
DEFINE_COM CLASS(#PRIM_SPLI) NAME(#SPLI_1) MANAGE(#PANL_1) PARENT(#SPLM_1) WEIGHT(1);
DEFINE_COM CLASS(#PRIM_SPLI) NAME(#SPLI_2) MANAGE(#PANL_2) PARENT(#SPLM_1);
DEFINE_COM CLASS(#PRIM_SPLM) NAME(#SPLM_2) ORIENTATION(Vertical);
DEFINE_COM CLASS(#PRIM_PANL) NAME(#PANL_3) DISPLAYPOSITION(1) HEIGHT(392) LAYOUTMANAGER(#ATLM_3) LEFT(0) PARENT(#PANL_1) TABPOSITION(1) TABSTOP(False) TOP(0) VISUALSTYLE(#VS_PANEL) WIDTH(432);
DEFINE_COM CLASS(#PRIM_PANL) NAME(#PANL_4) DISPLAYPOSITION(2) HEIGHT(392) LAYOUTMANAGER(#ATLM_2) LEFT(436) PARENT(#PANL_1) TABPOSITION(2) TABSTOP(False) TOP(0) VISUALSTYLE(#VS_PANEL) WIDTH(266);
DEFINE_COM CLASS(#PRIM_SPLI) NAME(#SPLI_3) MANAGE(#PANL_3) PARENT(#SPLM_2);
DEFINE_COM CLASS(#PRIM_SPLI) NAME(#SPLI_4) MANAGE(#PANL_4) PARENT(#SPLM_2) WEIGHT(1);
DEFINE_COM CLASS(#PRIM_ATLM) NAME(#ATLM_2);
DEFINE_COM CLASS(#PRIM_ATLM) NAME(#ATLM_3);
DEFINE_COM CLASS(#PRIM_SPLM) NAME(#SPLM_3) ORIENTATION(Vertical);
DEFINE_COM CLASS(#PRIM_PANL) NAME(#PANL_5) DISPLAYPOSITION(1) HEIGHT(151) LAYOUTMANAGER(#ATLM_1) LEFT(0) PARENT(#PANL_2) TABPOSITION(1) TABSTOP(False) TOP(0) VISUALSTYLE(#VS_PANEL) WIDTH(245);
DEFINE_COM CLASS(#PRIM_PANL) NAME(#PANL_6) DISPLAYPOSITION(2) HEIGHT(151) LAYOUTMANAGER(#ATLM_4) LEFT(249) PARENT(#PANL_2) TABPOSITION(2) TABSTOP(False) TOP(0) VISUALSTYLE(#VS_PANEL) WIDTH(453);
DEFINE_COM CLASS(#PRIM_SPLI) NAME(#SPLI_5) MANAGE(#PANL_5) PARENT(#SPLM_3);
DEFINE_COM CLASS(#PRIM_SPLI) NAME(#SPLI_6) MANAGE(#PANL_6) PARENT(#SPLM_3) WEIGHT(1);
DEFINE_COM CLASS(#PRIM_ATLM) NAME(#ATLM_1);
DEFINE_COM CLASS(#PRIM_ATLM) NAME(#ATLM_4);
DEFINE_COM CLASS(#PRIM_DCBX) NAME(#DCBX_1) DISPLAYPOSITION(1) FILEINCLUDEMASK('"*.*"') HEIGHT(143) LEFT(2) NOTIFYCOMPONENT(#DCBX_2) PARENT(#PANL_5) TABPOSITION(1) TABSTOP(False) TOP(2) WIDTH(237);
DEFINE_COM CLASS(#PRIM_ATLI) NAME(#ATLI_1) ATTACHMENT(Center) MANAGE(#DCBX_1) MARGINBOTTOM(2) MARGINLEFT(2) MARGINRIGHT(2) MARGINTOP(2) PARENT(#ATLM_1);
DEFINE_COM CLASS(#PRIM_DCBX) NAME(#DCBX_2) DISPLAYPOSITION(1) DISPLAYSTYLE(GeneralListView) FILEINCLUDEMASK('"*.*"') HEIGHT(143) LEFT(2) PARENT(#PANL_6) TABPOSITION(1) TABSTOP(False) TOP(2) WIDTH(445);
DEFINE_COM CLASS(#PRIM_ATLI) NAME(#ATLI_2) ATTACHMENT(Center) MANAGE(#DCBX_2) MARGINBOTTOM(2) MARGINLEFT(2) MARGINRIGHT(2) MARGINTOP(2) PARENT(#ATLM_4);
DEFINE_COM CLASS(#PRIM_ATLI) NAME(#ATLI_3) ATTACHMENT(Center) PARENT(#ATLM_2);
DEFINE_COM CLASS(#PRIM_GRID) NAME(#GRID_1) COLUMNBUTTONHEIGHT(21) DISPLAYPOSITION(1) HEIGHT(384) LEFT(2) PARENT(#PANL_4) TABPOSITION(1) TOP(2) WIDTH(258);
DEFINE_COM CLASS(#PRIM_ATLI) NAME(#ATLI_4) ATTACHMENT(Center) MANAGE(#GRID_1) MARGINBOTTOM(2) MARGINLEFT(2) MARGINRIGHT(2) MARGINTOP(2) PARENT(#ATLM_2);
DEFINE_COM CLASS(#PRIM_GDCL) NAME(#GDCL_1) CAPTION('Attachment(s) to Send ') CAPTIONTYPE(Caption) DISPLAYPOSITION(1) PARENT(#GRID_1) SOURCE(#SYSVAR$AV) TABSTOP(False) WIDTH(50) WIDTHTYPE(Remainder);
DEFINE_COM CLASS(#PRIM_ATLI) NAME(#ATLI_5) ATTACHMENT(Top) MARGINBOTTOM(4) MARGINLEFT(4) MARGINRIGHT(4) MARGINTOP(4) PARENT(#ATLM_3);
;
DEFINE_COM CLASS(#PRIM_ATLI) NAME(#ATLI_6) ATTACHMENT(Center) PARENT(#ATLM_3);
DEFINE_COM CLASS(#PRIM_MECL) NAME(#MECL_1) COLUMNROLE(Data) DISPLAYPOSITION(1) PARENT(#MEMO_1) SOURCE(#STD_TEXTL) WIDTH(20) WIDTHTYPE(Remainder);
DEFINE_COM CLASS(#PRIM_ATLI) NAME(#ATLI_7) ATTACHMENT(Top) MANAGE(#PANL_8) PARENT(#ATLM_3);
DEFINE_COM CLASS(#PRIM_PANL) NAME(#PANL_7) DISPLAYPOSITION(2) HEIGHT(213) LEFT(302) PARENT(#PANL_3) TABPOSITION(2) TABSTOP(False) TOP(175) WIDTH(126);
DEFINE_COM CLASS(#PRIM_ATLI) NAME(#ATLI_8) ATTACHMENT(Right) MANAGE(#PANL_7) PARENT(#ATLM_3);
DEFINE_COM CLASS(#PRIM_MEMO) NAME(#MEMO_1) CURRENTLINE(1) DISPLAYPOSITION(3) HEIGHT(213) LEFT(50) MAXIMUMLINELENGTH(75) PARENT(#PANL_3) TABPOSITION(3) TOP(175) WIDTH(252) WORDWRAP(True);
DEFINE_COM CLASS(#PRIM_ATLI) NAME(#ATLI_9) ATTACHMENT(Center) MANAGE(#MEMO_1) PARENT(#ATLM_3);
DEFINE_COM CLASS(#PRIM_PHBN) NAME(#BTN_SEND) CAPTION('Send Email') DISPLAYPOSITION(1) LEFT(2) PARENT(#PANL_7) TABPOSITION(1) TOP(8) WIDTH(119);
DEFINE_COM CLASS(#PRIM_PHBN) NAME(#BTN_CATCH) CAPTION('Clear Attachments') DISPLAYPOSITION(2) LEFT(2) PARENT(#PANL_7) TABPOSITION(2) TOP(44) WIDTH(120);
DEFINE_COM CLASS(#PRIM_PHBN) NAME(#PHBN_1) CAPTION('Clear Text Message') DISPLAYPOSITION(3) LEFT(2) PARENT(#PANL_7) TABPOSITION(3) TOP(80) WIDTH(119);
DEFINE_COM CLASS(#STD_TEXTL.Visual) NAME(#SUBJECT) CAPTION('Subject') DISPLAYPOSITION(4) HEIGHT(22) LABELTYPE(Caption) LEFT(0) MARGINLEFT(49) PARENT(#PANL_3) TABPOSITION(1) TOP(149) WIDTH(424);
DEFINE_COM CLASS(#PRIM_ATLI) NAME(#ATLI_10) ATTACHMENT(Top) MANAGE(#SUBJECT) MARGINBOTTOM(4) MARGINRIGHT(4) MARGINTOP(4) PARENT(#ATLM_3);
;
DEFINE_COM CLASS(#S_153RML) NAME(#MAIL) DISPLAYPOSITION(3) PARENT(#COM_OWNER);
DEFINE_COM CLASS(#PRIM_GPBX) NAME(#PANL_8) CAPTION('Addressing Details') DISPLAYPOSITION(1) HEIGHT(145) LEFT(0) PARENT(#PANL_3) TABPOSITION(4) TABSTOP(False) TOP(0) WIDTH(428);
DEFINE_COM CLASS(#PRIM_ATLI) NAME(#ATLI_11) ATTACHMENT(Top) PARENT(#ATLM_3);
DEFINE_COM CLASS(#PRIM_GRID) NAME(#GRID_TO) COLUMNBUTTONHEIGHT(18) DISPLAYPOSITION(1) HEIGHT(65) LEFT(48) PARENT(#PANL_8) ROWBUTTONS(True) ROWBUTTONWIDTH(22) ROWHEIGHT(22) TABPOSITION(1) TOP(15) WIDTH(369);
DEFINE_COM CLASS(#PRIM_GDCL) NAME(#GDCL_3) CAPTION('Email Address') CAPTIONTYPE(Caption) DISPLAYPOSITION(1) PARENT(#GRID_TO) READONLY(False) SOURCE(#STD_TEXTL) WIDTH(50);
DEFINE_COM CLASS(#PRIM_GDCL) NAME(#GDCL_4) CAPTION('Shown in Email as') CAPTIONTYPE(Caption) DISPLAYPOSITION(2) PARENT(#GRID_TO) READONLY(False) SOURCE(#STD_TEXTS) WIDTH(20) WIDTHTYPE(Remainder);
DEFINE_COM CLASS(#PRIM_GRID) NAME(#GRID_CC) COLUMNBUTTONHEIGHT(0) DISPLAYPOSITION(2) HEIGHT(48) LEFT(48) PARENT(#PANL_8) ROWBUTTONS(True) ROWBUTTONWIDTH(22) ROWHEIGHT(22) TABPOSITION(2) TOP(84) WIDTH(369);
DEFINE_COM CLASS(#PRIM_GDCL) NAME(#GDCL_5) DISPLAYPOSITION(1) PARENT(#GRID_CC) READONLY(False) SOURCE(#STD_TEXTL) WIDTH(50);
DEFINE_COM CLASS(#PRIM_GDCL) NAME(#GDCL_6) DISPLAYPOSITION(2) PARENT(#GRID_CC) READONLY(False) SOURCE(#STD_TEXTS) WIDTH(20) WIDTHTYPE(Remainder);
;
DEFINE_COM CLASS(#PRIM_LABL) NAME(#LABL_1) CAPTION('TO :') DISPLAYPOSITION(3) HEIGHT(19) LEFT(13) PARENT(#PANL_8) TABPOSITION(3) TABSTOP(False) TOP(35) VISUALSTYLE(#VS_EMPH) WIDTH(33);
DEFINE_COM CLASS(#PRIM_LABL) NAME(#LABL_2) CAPTION('CC :') DISPLAYPOSITION(4) HEIGHT(19) LEFT(15) PARENT(#PANL_8) TABPOSITION(4) TABSTOP(False) TOP(85) VISUALSTYLE(#VS_EMPH) WIDTH(25);
DEFINE_COM CLASS(#PRIM_LABL) NAME(#LABL_4) CAPTION('Message Text') DISPLAYPOSITION(5) HEIGHT(213) LEFT(0) PARENT(#PANL_3) TABPOSITION(5) TABSTOP(False) TOP(175);
DEFINE_COM CLASS(#PRIM_ATLI) NAME(#ATLI_13) ATTACHMENT(Left) MANAGE(#LABL_4) PARENT(#ATLM_3);
;
Def_Cond *Recipient '(#Std_TextL *ne *blanks)';
Define #LineNo RefFld(#Std_Num);
;
;
Define #LstTOAdr RefFld(#Std_TextL);
Define #LstCCAdr RefFld(#Std_TextL);
;
Define #LstTONam RefFld(#Std_TextS);
Define #LstCCNam RefFld(#Std_TextS);
;
* ============================================================;
* Form Initialization - Restore first entry in each grid;
* ============================================================;
;
EvtRoutine Handling(#Com_Owner.Initialize);
;
Set #Com_Owner Caption(*Component_Desc) ;
;
Change (#LstTOAdr #LstTONam) *Remembered_Value_For_User;
Change #Std_TextL #LstTOAdr;
Change #Std_TextS #LstTONam;
Add_Entry #Grid_TO;
;
Change (#LstCCAdr #LstCCNam) *Remembered_Value_For_User;
Change #Std_TextL #LstCCAdr;
Change #Std_TextS #LstCCNam;
Add_Entry #Grid_CC;
;
Change (#Std_TextL #Std_TextS) *Null;
;
Begin_Loop to(20);
Add_Entry #Grid_TO;
Add_Entry #Grid_CC;
End_Loop ;
;
EndRoutine ;
;
* ============================================================;
* Form Termination - Remember first entry from each grid;
* ============================================================;
;
EvtRoutine Handling(#Com_Owner.Closing);
;
Get_Entry 1 #Grid_TO;
Change #LstTOAdr #Std_TextL;
Change #LstTONam #Std_TextS;
;
Get_Entry 1 #Grid_CC;
Change #LstCCAdr #Std_TextL;
Change #LstCCNam #Std_TextS;
;
EndRoutine ;
;
* ============================================================;
* Handle a file selected in the right most explorer component;
* ============================================================;
;
EVTROUTINE HANDLING(#DCBX_2.ItemGotFocus) OPTIONS(*NOCLEARMESSAGES *NOCLEARERRORS);
if '#dcbx_2.PathType = File';
Use TConcat with_args(#dcbx_2.path #dcbx_2.filename) to_get(#SysVar$Av);
Change #Std_TextL *null;
Add_Entry #Grid_1;
Endif ;
ENDROUTINE ;
;
* ============================================================;
* Clear the attachments grid;
* ============================================================;
;
EVTROUTINE HANDLING(#BTN_CATCH.Click);
Clr_List #Grid_1;
ENDROUTINE ;
;
* ============================================================;
* Clear the message text memo;
* ============================================================;
;
EVTROUTINE HANDLING(#PHBN_1.Click);
Clr_List #Memo_1;
ENDROUTINE ;
;
* ============================================================;
* Send the email;
* ============================================================;
;
EVTROUTINE HANDLING(#BTN_SEND.Click);
;
* Set the subject;
;
Set #Mail Subject(#Subject.Value);
;
* Insert the TO and CC recipients;
;
SelectList #Grid_To;
If *Recipient;
Invoke #Mail.InsertRecipient Type(to) EMailAddress(#Std_TextL) VisualName(#Std_TextS);
Endif ;
EndSelect ;
;
SelectList #Grid_CC;
If *Recipient;
Invoke #Mail.InsertRecipient Type(cc) EMailAddress(#Std_TextL) VisualName(#Std_TextS);
Endif ;
EndSelect ;
;
* Add the text lines;
;
Change #LineNo 0;
SelectList #Memo_1;
Change #LineNo '#LineNo + 1';
Invoke #Mail.InsertItem Order(#LineNo) TextValue(#Std_TextL);
EndSelect ;
;
* Add the attachments;
;
SelectList #Grid_1;
Invoke #Mail.InsertAttachment FileName(#SysVar$Av);
EndSelect ;
;
* Send the mail;
;
Invoke #Mail.Send;
;
* Close the mail;
;
Invoke #Mail.Close;
;
* Finished;
;
ENDROUTINE ;
;
* ============================================================;
* Put up a message box if an unexpected error is detected;
* ============================================================;
;
EvtRoutine Handling(#Mail.MailErrorDetected);
Use Message_Box_Show (ok ok error *component 'Unexpected error when sending email.');
EndRoutine ;
;
;
END_COM ;