#include "Fivewin.ch"
#include "constant.ch"
#include "ttitle.ch"
#include "richedit.ch"
#define LIGHTCYAN nRGB( 203, 225, 252 )
REQUEST DBFCDX
REQUEST DBFFPT
EXTERNAL ORDKEYNO,ORDKEYCOUNT,ORDCREATE,ORDKEYGOTO
Function Test()
Local nBottom := 29.2
Local nRight := 58
Local nWidth := Max( nRight * DLG_CHARPIX_W, 180 )
Local nHeight := nBottom * DLG_CHARPIX_H
Local cDlgTitle :="Family"
Local oDlgModelli,oBarMemo
Local aGet[5],oSay[2]
Local oFontmodelli,oFontBoldModelli
Local oLbx
Local cMessage := space(200)
Local cSubject := space(60)
Local cModello := space(60)
Local oImagetitle
Local oTitle
Local cTitle := "Modelli e-mail"
Local cTitle2:= "Crea nuovi modelli o personalizza quelli esistenti"
Local cImageTitle := "MailModel.bmp"
RddSetDefault( "DBFCDX" )
Create_Archive_Modelli_mail()
USE MAILMOD ALIAS MM
DEFINE FONT oFontmodelli NAME 'Tahoma' SIZE 0, -12
DEFINE FONT oFontBoldModelli NAME 'Tahoma' SIZE 0, -12 BOLD
DEFINE DIALOG oDlgModelli ;
SIZE nWidth, nHeight PIXEL ;
TITLE cDlgTitle
oDlgModelli:lHelpIcon := .F.
oDlgModelli:nStyle := nOr( WS_OVERLAPPED,WS_THICKFRAME,WS_SYSMENU,WS_MAXIMIZEBOX, 0 )
@ 0,0 TITLE oTitle OF oDlgModelli size 500, 40 SHADOW NOSHADOW GRADIENT { { 1,CLR_WHITE,LIGHTCYAN } }
@ 10, 12 TITLETEXT OF oTitle TEXT cTitle FONT oFontBoldModelli COLOR CLR_BLACK
@ 38, 42 TITLETEXT OF oTitle TEXT cTitle2 FONT oFontmodelli COLOR CLR_BLACK
@ 10, oTitle:nWidth-120 TITLEIMG oImagetitle OF oTitle BITMAP cImageTitle TRANSPARENT
@ 42, 1 XBROWSE oLbx OF oDlgModelli ;
SIZE 100 ,oDlgModelli:nBottom-150 PIXEL NOBORDER
aBrowse := { { { ||MM->MAILNAME}, i18n("Nome Modello"), 50, }}
FOR i := 1 TO Len(aBrowse)
oCol := oLbx:AddCol()
oCol:bEditValue := aBrowse[ i, 1 ]
* oCol:bStrData := aBrowse[ i, 1 ]
oCol:cHeader := aBrowse[ i, 2 ]
oCol:nWidth := aBrowse[ i, 3 ]
if !Empty(aBrowse[ i, 4 ])
oCol:cEditPicture:=aBrowse[ i, 4 ]
Endif
NEXT
oLbx:nStretchCol := -1
oLbx:nMarqueeStyle := MARQSTYLE_HIGHLWIN7 //MARQSTYLE_HIGHLROW
oLbx:nColDividerStyle := LINESTYLE_LIGHTGRAY
oLbx:lColDividerComplete := .t.
oLbx:lRecordSelector := .f.
oLbx:lHScroll := .f.
oLbx:CreateFromCode()
oLbx:bChange := { || Rinfresca_get(aGet,"MM") }
@ 45,oLbx:nWidth+10 SAY oSay[1] Prompt "Nome modello:" of oDlgModelli size 80,10 PIXEL FONT oFontBoldModelli COLOR CLR_BLACK
@ 55,oLbx:nWidth+10 GET aGet[1] VAR MM->MAILNAME size 115,10 PIXEL of oDlgModelli FONT oFontmodelli UPDATE
@ 66,oLbx:nWidth+10 SAY oSay[2] Prompt "Oggetto:" of oDlgModelli size 80,10 PIXEL FONT oFontBoldModelli COLOR CLR_BLACK
@ 76,oLbx:nWidth+10 GET aGet[2] VAR MM->SUBJECT size 115,10 PIXEL of oDlgModelli FONT oFontmodelli UPDATE
hDLL = LoadLibrary( 'riched20.dll' )
@ 90,110 RICHEDIT aGet[3] VAR MM->MESSAGE of oDlgModelli PIXEL SIZE 100,100
oDlgModelli:bResized := {||Rinfresca_oDlgModelli(oTitle,oImagetitle,oDlgModelli,oLbx,oSay,aGet ,oBarMemo) }
ACTIVATE DIALOG oDlgModelli centered ;
ON INIT BuildRichEditBar( oDlgModelli, aGet[3],oBarMemo )
oFontmodelli:Release()
oFontBoldModelli:Release()
if hDLL != nil
FreeLibrary( hDLL )
endif
return nil
//-----------------------------------------------------------------------//
static function BuildRichEditBar( oWnd, oRtf, oBarMemo )
local oBtn, oBullet, oBold, oItalic, oNumber, oUnderline, oCursor
local lBold := .F., ;
lItalic := .F., ;
lUnderline := .F.,;
lBullet := .F.,;
lNumber := .F.
DEFINE CURSOR oCursor HAND
@ oRtf:nTop,oRtf:nLeft BUTTONBAR oBarMemo ;
SIZE oRtf:nWidth+100,27 3D;
BUTTONSIZE 26, 27;
OF oWnd ;
CURSOR oCursor
DEFINE BUTTON oBtn OF oBarMemo ;
MESSAGE "Create a new file" TOOLTIP "New" NOBORDER ;
ACTION oRTF:SetText( "" )
oBtn:hBitmap1 = FWBitmap( "new16" )
DEFINE BUTTON oBtn OF oBarMemo ;
MESSAGE "Open a file" TOOLTIP "Open" NOBORDER ;
ACTION Open()
oBtn:hBitmap1 = FWBitmap( "open16" )
DEFINE BUTTON oBtn OF oBarMemo ;
MESSAGE "Save a file" TOOLTIP "Save" NOBORDER ;
ACTION Save()
oBtn:hBitmap1 = FWBitmap( "save16" )
DEFINE BUTTON oBtn OF oBarMemo ;
MESSAGE "Close a file" TOOLTIP "Close" NOBORDER ;
ACTION oWnd:End()
oBtn:hBitmap1 = FWBitmap( "close16" )
DEFINE BUTTON oBtn OF oBarMemo GROUP ;
MESSAGE "Print" TOOLTIP "Print" NOBORDER ;
ACTION ( oRTF:Print(), oRTF:SetFocus() )
oBtn:hBitmap1 = FWBitmap( "printer16" )
DEFINE BUTTON oBtn OF oBarMemo ;
MESSAGE "Displays full pages" ;
TOOLTIP "Print Preview" NOBORDER ;
ACTION oRTF:Preview( "Class TRichEdit")
oBtn:hBitmap1 = FWBitmap( "preview16" )
DEFINE BUTTON oBtn OF oBarMemo GROUP ;
MESSAGE "Search" TOOLTIP "Search" NOBORDER ;
ACTION ( Find(), oRTF:SetFocus() )
oBtn:hBitmap1 = FWBitmap( "search16" )
DEFINE BUTTON oBtn OF oBarMemo GROUP ;
MESSAGE "Cut" TOOLTIP "Cut" NOBORDER ;
WHEN ( ! Empty( oRTF:GetSel() ) .and. ! oRTF:lReadOnly ) ;
ACTION ( oRTF:Cut(), oRTF:SetFocus() )
oBtn:hBitmap1 = FWBitmap( "cut16" )
DEFINE BUTTON oBtn OF oBarMemo ;
MESSAGE "Copy" TOOLTIP "Copy" NOBORDER ;
WHEN ( ! Empty( oRTF:GetSel() ) ) ;
ACTION ( oRTF:Copy(), oRTF:SetFocus() )
oBtn:hBitmap1 = FWBitmap( "copy16" )
DEFINE BUTTON oBtn OF oBarMemo ;
MESSAGE "Paste" TOOLTIP "Paste" NOBORDER ;
WHEN ( /* ! Empty( oClp:GetText() ) .and. */ ! oRTF:lReadOnly ) ;
ACTION ( oRTF:Paste(), oRTF:SetFocus() )
oBtn:hBitmap1 = FWBitmap( "paste16" )
DEFINE BUTTON oBtn OF oBarMemo GROUP ;
MESSAGE "Undo" TOOLTIP "Undo" NOBORDER ;
WHEN ( oRTF:SendMsg( EM_CANUNDO ) != 0 ) ;
ACTION ( oRTF:Undo(), oRTF:SetFocus() )
oBtn:hBitmap1 = FWBitmap( "undo16" )
DEFINE BUTTON oBtn OF oBarMemo ;
MESSAGE "Redo" TOOLTIP "Redo" NOBORDER ;
WHEN ( oRTF:SendMsg( EM_CANREDO ) != 0 ) ;
ACTION ( oRTF:Redo(), oRTF:SetFocus() )
oBtn:hBitmap1 = FWBitmap( "redo16" )
DEFINE BUTTON oBold OF oBarMemo GROUP ;
MESSAGE "Bold" TOOLTIP "Bold" NOBORDER ;
WHEN ! oRTF:lReadOnly ;
ACTION ( lBold := !lBold, ;
oBold:lPressed := lBold, ;
oBold:Refresh(), ;
oRTF:SetBold( lBold ), oRTF:SetFocus() )
oBold:hBitmap1 = FWBitmap( "bold16" )
oBold:Show()
DEFINE BUTTON oItalic OF oBarMemo ;
MESSAGE "Italic" TOOLTIP "Italic" NOBORDER ;
WHEN ! oRTF:lReadOnly ;
ACTION ( lItalic := !lItalic, ;
oItalic:lPressed := lItalic, ;
oItalic:Refresh(), ;
oRTF:SetItalic( lItalic ), oRTF:SetFocus() )
oItalic:hBitmap1 = FWBitmap( "italic16" )
oItalic:Show()
DEFINE BUTTON oUnderline RESOURCE "Underline" OF oBarMemo ;
MESSAGE "Underline" TOOLTIP "Underline" NOBORDER ;
WHEN ! oRTF:lReadOnly ;
ACTION ( lUnderline := !lUnderline, ;
oUnderline:lPressed := lUnderline, ;
oUnderline:Refresh(), ;
oRTF:SetUnderline( lUnderline ), oRTF:SetFocus() )
oUnderline:hBitmap1 = FWBitmap( "underline16" )
oUnderline:Show()
DEFINE BUTTON RESOURCE "Left" OF oBarMemo GROUP ;
MESSAGE "Align Left" TOOLTIP "Left" NOBORDER ;
WHEN ! oRTF:lReadOnly ;
ACTION ( oRTF:SetAlign( PFA_LEFT ), oRTF:SetFocus() )
DEFINE BUTTON RESOURCE "Center" OF oBarMemo ;
MESSAGE "Center" TOOLTIP "Center" NOBORDER ;
WHEN ! oRTF:lReadOnly ;
ACTION ( oRTF:SetAlign( PFA_CENTER ), oRTF:SetFocus() )
DEFINE BUTTON RESOURCE "Right" OF oBarMemo ;
MESSAGE "Align Right" TOOLTIP "Right" NOBORDER ;
WHEN ! oRTF:lReadOnly ;
ACTION ( oRTF:SetAlign( PFA_RIGHT ), oRTF:SetFocus() )
DEFINE BUTTON RESOURCE "Justify" OF oBarMemo ;
MESSAGE "Justify" TOOLTIP "Justify" NOBORDER ;
WHEN ! oRTF:lReadOnly ;
ACTION ( oRTF:SetAlign( PFA_JUSTIFY ), oRTF:SetFocus() )
DEFINE BUTTON oNumber RESOURCE "Number" OF oBarMemo GROUP ;
MESSAGE "Numbering" TOOLTIP "Numbering" NOBORDER ;
WHEN ! oRTF:lReadOnly .AND. ! oRTF:GetBullet() ;
ACTION ( lNumber := !lNumber, ;
oNumber:lPressed := lNumber, ;
oNumber:Refresh(), ;
oRTF:SetNumbering( lNumber ), oRTF:SetFocus() )
DEFINE BUTTON oBullet RESOURCE "Bullet" OF oBarMemo ;
MESSAGE "Bullets" TOOLTIP "Bullets" NOBORDER ;
WHEN ! oRTF:lReadOnly .AND. ! oRTF:GetNumbering() ;
ACTION ( lBullet := !lBullet, ;
oBullet:lPressed := lBullet, ;
oBullet:Refresh(), ;
oRTF:SetBullet( lBullet ), oRTF:SetFocus() )
DEFINE BUTTON RESOURCE "Exit" OF oBarMemo GROUP ;
MESSAGE "Exit" ACTION oWnd:End() ;
TOOLTIP "Salir" NOBORDER
// AEval( oBar:aControls, { |x| x:nLeft += 272, x:nRight += 272 }, 13 )
oBarMemo:bLClicked := { || nil }
oBarMemo:bRClicked := { || nil }
AEval( oBarMemo:aControls, { |x| x:oCursor := oCursor } )
return nil
static function Open()
return nil
static function Save()
return nil
static function Find()
return nil
//-----------------------------------------------------------------------//
static Function Rinfresca_oDlgModelli(oTitle,oImagetitle,oDlg,oLbx,oSay,aGet,oBarMemo )
Local aClient := GetClientRect ( oDlg:hWnd )
//title
oTitle:nWidth:=oDlg:nWidth
oTitle:aImgs[1][ 2 ] = oTitle:nWidth-120
oTitle:refresh()
//xBrowse
oLbx:nHeight := oDlg:nHeight-150
oLbx:nwidth := oDlg:nwidth/2 -200
oLbx:refresh()
//get /say
oSay[1]:nLeft:= oLbx:nWidth+10
oSay[2]:nLeft:= oLbx:nWidth+10
aGet[1]:nLeft:= oLbx:nWidth+10
aGet[2]:nLeft:= oLbx:nWidth+10
aGet[3]:nTop:=aGet[2]:nTop+60
aGet[3]:nLeft:= oLbx:nWidth+10
aGet[3]:nwidth:= oDlg:nwidth -200
aGet[3]:nHeight:= oDlg:nHeight-280
aGet[3]:SetSize( aClient[ 4 ] - aGet[3]:nLeft-10, oDlg:nHeight-280)
aGet[3]:Refresh()
aGet[2]:SetSize( aClient[ 4 ] - aGet[2]:nLeft-10, 20)
aGet[1]:SetSize( aClient[ 4 ] - aGet[1]:nLeft-10, 20)
IF oBarMemo != NIL
oBarMemo:nTop := aGet[3]:nTop-30
oBarMemo:nRight := aClient[ 4 ] - aGet[3]:nLeft-10
oBarMemo:nleft := aGet[3]:nLeft
oBarMemo:setpos(aGet[3]:nTop-30,aGet[3]:nLeft )
oBarMemo:Refresh()
endif
return nil
//------------------------------------------------------------------------------------------//
static Function Create_Archive_Modelli_mail()
Local cDir :=""
DbCreate(cDir+'mm', { {'MAILNAME' , 'C', 30, 0} ,;
{'SUBJECT' , 'C', 30, 0} ,;
{'MESSAGE' , 'M', 10, 0}}, 'DBFCDX')
close all
use &(cDir+'mm') new
select mm
if FILE(cDir+'MailMod.DBF')
delete file &(cdir+'MailMod.cdx')
append from &(cdir+'MailMod')
dbcommitall()
close all
delete file &(cdir+'MailMod.dbf')
delete file &(cdir+'MailMod.fpt')
endif
close all
rename &(cdir+'mm.dbf') to &(cdir+'MailMod.dbf')
rename &(cDir+'mm.fpt') to &(cDir+'MailMod.fpt')
close all
return nil
//------------------------------------------------------------------------------------------//
Function Rinfresca_get(aGet,cDbf)
nRecAdd := (cDbf)->(RecNo())
aGet[1]:ctext:= MM->MAILNAME
aGet[2]:ctext:= MM->SUBJECT
aGet[3]:ctext:= MM->MESSAGE
return nil