Marc,
Just a idea.
Using the setup-section and define the editor You are working with.
That will open the memo with Your favorite editor.
The memo will be saved as a textfile before and opend with Your editor
regards
Uwe
#include "FiveWin.ch"
#include "RichEdi5.ch"
Static hDll
Static oDlg
Static oBrw
Static oMemo
function Main()
local cTitle:="Test"
local cResult
local oFont, oBold
local oSay
local oCode
REQUEST DBFCDX
USE clients via "DBFCDX" NEW
DEFINE FONT oFont NAME "Courier New" SIZE 8,15
DEFINE FONT oBold NAME "Courier New" BOLD SIZE 8,15
DEFINE DIALOG oDlg FROM 5,10 TO 50, 170 font oFont TITLE "Test Color"
@ 10, 10 XBROWSE oBrw OF oDlg ;
SIZE 350, 200 PIXEL ;
COLUMNS 'Name', 'Adress', 'Notes' ;
ALIAS 'CLIENTS' NOBORDER
WITH OBJECT oBrw
:nColDividerStyle := LINESTYLE_LIGHTGRAY
:nRowDividerStyle := LINESTYLE_LIGHTGRAY
:bClrRowFocus := { || { CLR_BLACK, RGB(185,220,255) } }
:nMarqueeStyle := MARQSTYLE_HIGHLROWMS
:bChange := { || oSay:refresh(),showmemo() }
:CreateFromCode()
END
@ 250, 10 BUTTON "Code" PIXEL ACTION ( oCode := SourceEdit( oMemo:GetText() , "Code", , 100, 300, 700, 1160, , , , , , , ) )
@ 10,370 SAY oSay PROMPT clients->notes SIZE 200, 80 PIXEL OF oDlg COLOR CLR_BLACK update //TRANSPARENT
ACTIVATE DIALOG oDlg CENTERED ON INIT showmemo()
close all
FreeLibrary( hDll )
Return nil
function showmemo()
Local cStr := ""
local cChange := "FiveWin" // Word that we will look for
local cInto := "\highlight1 FiveWin \highlight0" // Put Word in Color
local cText
local cVar := ""
cText := clients->notes
cStr += "{\rtf1\ansi\ansicpg1252\deff0\nouicompat\deflang3082{\fonttbl{\f0\fnil\fcharset0 Tahoma;}}"
cStr += "{\colortbl ;\red255\green0\blue0;\red0\green0\blue0;\red128\green64\blue64;\red0\green0\blue128;}"
cStr += "\viewkind4\uc1"
cStr += "\pard\fs20" + if( Empty( cText ), " ", cText )
cStr += "}"
cStr := StrTran( cStr, cChange, cInto )
if hb_Isnil( oMemo )
@ 180,740 RICHEDIT5 oMemo VAR cVar of oDlg PIXEL SIZE 450, 400 HIGHLIGHT
endif
oMemo:LoadRTF( cStr, .F. )
return NIL
@ 04,82 BTNBMP PROMPT "<" SIZE 16,16 PIXEL OF oDlg NOBORDER FONT oFontWD2 ;
COLOR CLR_BLACK, CLR_WHITE ;
TOOLTIP FWString( "Save" ) ; //Save As
ACTION ( SaveFileSource( oEditor, oEditor:cFileName ) )
// and at end of memoedit.prg add
//----------------------------------------------------------------------------//
Static Function SaveFileSource( oEditor, cFile )
if Empty( cFile ) .or. !Empty( At( "noname", Lower( cFile ) ) )
cFile := cGetFile32( "Program file (*.prg) |*.prg|" + ;
"Header file (*.ch) |*.ch|" + ;
"Headers (*.h) |*.h|" + ;
"Resources (*.rc) |*.rc|" + ;
"Source Code C (*.c) |*.c|" + ;
"Source Code C++ (*.cpp) |*.cpp|" + ;
"C File (*.cxx) |*.cxx|" + ;
"Harbour files (*.hrb) |*.hrb|" + ;
"Templates (*.pvk) |*.pvk|" + ;
"Text file (*.txt) |*.txt|" + ;
"Configuration file (*.ini) |*.ini|" + ;
"HTML Page file (*.html) |*.html|" + ;
"HTM Page file (*.htm) |*.htm|" + ;
"TPL Page Template file (*.tpl) |*.tpl|" + ;
"XML file (*.xml) |*.xml|",;
"Save as", 0, ;
hb_CurDrive() + ":\" + CurDir(), .T., .T. )
endif
oEditor:Save( , , , , , cFile )
Return nil
//----------------------------------------------------------------------------//
Marc Venken wrote:Thanks.
Uwe, I let this for you to do because I never have changed stuff from FW prog's itself. (Maybe i have to link/compile them and that kind of stuff)
@ Cristobal : You may put a link to a Exe for me to test, but I get the idea. Mr. Uwe will implement it at a given moment.
#include "FiveWin.ch"
#include "RichEdi5.ch"
Static oDlg, oBrw, oMemo
FUNCTION MAIN()
local cTitle:="Test"
local cResult, cText
local oFont, oBold, oBrush
local oSay, cFilter := "FiveWin"
REQUEST DBFCDX
USE clients via "DBFCDX" NEW
cText := clients->notes
DEFINE FONT oFont NAME "Courier New" SIZE 8,15
DEFINE FONT oBold NAME "Courier New" BOLD SIZE 8,15
DEFINE BRUSH oBrush COLOR 16763283
DEFINE DIALOG oDlg FROM 5,10 TO 50, 170 font oFont TITLE "Test Color"
@ 10, 10 XBROWSE oBrw OF oDlg ;
SIZE 350, 200 PIXEL ;
COLUMNS 'Name', 'Adress', 'Notes' ;
ALIAS 'CLIENTS' NOBORDER
WITH OBJECT oBrw
:nColDividerStyle := LINESTYLE_LIGHTGRAY
:nRowDividerStyle := LINESTYLE_LIGHTGRAY
:bClrRowFocus := { || { CLR_BLACK, RGB(185,220,255) } }
:nMarqueeStyle := MARQSTYLE_HIGHLROWMS
:bChange := { || oSay:refresh(), ;
cText := clients->notes, oMemo:SetText( cText ), ;
oMemo:LoadRTF( SHOWMEMO(cText, cFilter), .F. ), ;
oMemo:GoToLine( 1 ) }
:CreateFromCode()
END
@ 10, 370 SAY oSay PROMPT clients->notes SIZE 200, 80 PIXEL OF oDlg COLOR CLR_BLACK update //TRANSPARENT
@ 120,370 RICHEDIT5 oMemo VAR cText of oDlg PIXEL SIZE 250, 200
ACTIVATE DIALOG oDlg CENTERED ON INIT ;
( oDlg:SetBrush( oBrush ), ;
oMemo:SetText( cText ), ;
oMemo:LoadRTF( SHOWMEMO(cText, cFilter), .F. ), ;
oMemo:GoToLine( 1 ) )
RELEASE BRUSH oBrush
CLOSE ALL
RETURN NIL
//----------------------
FUNCTION SHOWMEMO(cText, cFilter)
Local cStr := ""
local cInto := "\highlight1" + cFilter + "\highlight0" // Put Word in Color
local cVar := ""
cStr += "{\rtf1\ansi\ansicpg1252\deff0\nouicompat\deflang3082{\fonttbl{\f0\fnil\fcharset0 Tahoma;}}"
cStr += "{\colortbl ;\red255\green0\blue0;\red0\green0\blue0;\red128\green64\blue64;\red0\green0\blue128;}"
cStr += "\viewkind4\uc1"
cStr += "\pard\fs20" + if( Empty( cText ), " ", cText )
cStr += "}"
cStr := StrTran( cStr, cFilter, cInto ) // Word that we will look for
RETURN cStr
#include "FiveWin.ch"
#include "RichEdi5.ch"
Static oDlg, oBrw, oMemo
FUNCTION MAIN()
local cTitle:="Test"
local cResult, cText
local oFont, oBold, oBrush
local oSay, cFilter := "FiveWin"
REQUEST DBFCDX
USE clients via "DBFCDX" NEW
cText := clients->notes
DEFINE FONT oFont NAME "Courier New" SIZE 8,15
DEFINE FONT oBold NAME "Courier New" BOLD SIZE 8,15
DEFINE BRUSH oBrush COLOR 16763283
DEFINE DIALOG oDlg FROM 5,10 TO 50, 170 font oFont TITLE "Test Color"
@ 10, 10 XBROWSE oBrw OF oDlg ;
SIZE 350, 200 PIXEL ;
COLUMNS 'Name', 'Adress', 'Notes' ;
ALIAS 'CLIENTS' NOBORDER
WITH OBJECT oBrw
:nColDividerStyle := LINESTYLE_LIGHTGRAY
:nRowDividerStyle := LINESTYLE_LIGHTGRAY
:bClrRowFocus := { || { CLR_BLACK, RGB(185,220,255) } }
:nMarqueeStyle := MARQSTYLE_HIGHLROWMS
:bChange := { || oSay:refresh(), ;
cText := clients->notes, oMemo:SetText( cText ), ;
oMemo:LoadRTF( SHOWMEMO(cText, cFilter), .F. ), ;
oMemo:GoToLine( 1 ) }
:CreateFromCode()
END
@ 10, 370 SAY oSay PROMPT clients->notes SIZE 200, 80 PIXEL OF oDlg COLOR CLR_BLACK update //TRANSPARENT
@ 120,370 RICHEDIT5 oMemo VAR cText of oDlg PIXEL SIZE 250, 200
ACTIVATE DIALOG oDlg CENTERED ON INIT ;
( oDlg:SetBrush( oBrush ), ;
oMemo:SetText( cText ), ;
oMemo:LoadRTF( SHOWMEMO(cText, cFilter), .F. ), ;
oMemo:GoToLine( 1 ) )
RELEASE BRUSH oBrush
CLOSE ALL
RETURN NIL
//----------------------
FUNCTION SHOWMEMO(cText, cFilter)
Local cStr := ""
local cInto := "\highlight1" + cFilter + "\highlight0" // Put Word in Color
local cVar := ""
cStr += "{\rtf1\ansi\ansicpg1252\deff0\nouicompat\deflang3082{\fonttbl{\f0\fnil\fcharset0 Tahoma;}}"
cStr += "{\colortbl ;\red255\green0\blue0;\red0\green0\blue0;\red128\green64\blue64;\red0\green0\blue128;}"
cStr += "\viewkind4\uc1"
cStr += "\pard\fs20" + if( Empty( cText ), " ", cText )
cStr += "}"
cStr := StrTran( cStr, cFilter, cInto ) // Word that we will look for
RETURN cStr
:bChange := { || oSay:refresh(), ;
cText := clients->notes, ; //oMemo:SetText( cText ), ;
oMemo:LoadRTF( SHOWMEMO(cText, cFilter), .F. ), ;
oMemo:GoToLine( 1 ) }
:CreateFromCode()
END
@ 10, 370 SAY oSay PROMPT clients->notes SIZE 200, 80 PIXEL OF oDlg COLOR CLR_BLACK //update //TRANSPARENT
@ 120,370 RICHEDIT5 oMemo VAR cText of oDlg PIXEL SIZE 250, 200 //HIGHLIGHT
ACTIVATE DIALOG oDlg CENTERED ON INIT ;
( oDlg:SetBrush( oBrush ), ;// oMemo:SetText( cText ), ;
oMemo:LoadRTF( SHOWMEMO(cText, cFilter), .F. ), ;
oMemo:GoToLine( 1 ) )
Return to FiveWin for Harbour/xHarbour
Users browsing this forum: No registered users and 59 guests