Silvio
Test this code
#include "fivewin.ch"
Function Main()
local cText:= Memoread( "testsciedit.prg")
SilvioScript( cText, "Script", , , , )
return nil
//----------------------------------------------------------------------------//
function SilvioScript( cText, cTitle, nTop, nLeft, nBottom, nRight )
local oFont, oDlg, oMemo, oBtnOk, oBtnCancel, oBtnHelp
local uTemp := cText
local lOk := .f.
local oMsgbar
local oBar
local cFolder :=".\"
local aDbf := DIRECTORY( cFolder+"*.prg" )
local oBtn
local oBrw
DEFAULT nTop := 1, nLeft := 1, nBottom := 800, nRight := 600,;
cTitle := "Source Edit"
DEFINE FONT oFont NAME "Ms Sans Serif" SIZE 0, -8
DEFINE DIALOG oDlg FROM nTop, nLeft TO nBottom, nRight ;
TITLE cTitle FONT oFont PIXEL TRUEPIXEL RESIZABLE
oDlg:lHelpIcon := .F.
DEFINE BUTTONBAR oBar OF oDlg SIZE 26, 27 2010 NOBORDER
DEFINE BUTTON oBtn OF oBar ;
MESSAGE "Create a new file" TOOLTIP "New" NOBORDER ;
ACTION NIL
oBtn:hBitmap1 = FWBitmap( "new16" )
DEFINE BUTTON oBtn OF oBar ;
MESSAGE "Open a file" TOOLTIP "Open" NOBORDER ;
ACTION NIL
oBtn:hBitmap1 = FWBitmap( "open16" )
DEFINE BUTTON oBtn OF oBar ;
MESSAGE "Save a file" TOOLTIP "Save" NOBORDER ;
ACTION NIL
oBtn:hBitmap1 = FWBitmap( "save16" )
DEFINE BUTTON oBtn OF oBar ;
MESSAGE "Execute" TOOLTIP "Execute" NOBORDER ;
RESOURCE "C:work\fwh\bitmaps\16x16\play2.bmp";
ACTION NIL // FN_Execute(cFile)
oBar:bLClicked := { || nil }
oBar:bRClicked := { || nil }
oDlg:bResized := <||
local oRect := oDlg:GetCliRect()
oMemo:nTop := oBar:nBottom + 5
oMemo:SetSize( oRect:nWidth() - 24, oRect:nHeight() / 2 )
oBrw:SetSize( oRect:nWidth() - 15 , oRect:nHeight() - 10 )
oBrw:nTop := oMemo:nBottom + 5
return nil
>
ACTIVATE DIALOG oDlg center ;
ON INIT ( oMemo := CreaEditor( oDlg, cText, oBar:nBottom + 5, 10, oDlg:nHeight / 2, oDlg:nWidth - 24 ), ;
oMemo:GotoLine( 1 ), ;
oBrw := CreaBrowse( oDlg, aDbf ), ;
oBrw:SetFocus() )
//ON INIT ( SetMsgbar(oDlg,oMsgBar), EVAL( oDlg:bResized))
oFont:End()
return lOk
//----------------------------------------------------------------------------//
Function CreaEditor( oP, cText, nT, nL, nH, nW )
SourceEdit( cText, , Rgb( 255, 255, 234 ), nT, nL, nH, nW, , , 1 , .F., oP, .F., , 519, , -10, .F., , .T., .F., ;
, nil, "FixedSys" )
Return SourceEditor()
//----------------------------------------------------------------------------//
Function CreaBrowse( oDlg, aDbf )
local oBrw
@ ( oDlg:nHeight / 2 ) + 40, 10 XBROWSE oBrw OF oDlg SIZE -15, -10 ;
DATASOURCE aDbf ;
HEADERS "File", "Size" ;
COLUMNS 1,2 ;
COLSIZES 100, 150 ;
CELL LINES NOBORDER FASTEDIT PIXEL
WITH OBJECT oBrw
// :nMarqueeStyle = 4
:bClrRowFocus = { || { CLR_BLACK, RGB(185,220,255) } }
:nMarqueeStyle = MARQSTYLE_HIGHLROWMS
:nStretchCol = 1
:nDataLines = 2
:CreateFromCode()
END
Return oBrw
//----------------------------------------------------------------------------//
Pd:
The SourceEdit function does not return the editor object (this is a bug)
That is why I have to use the SourceEditor() function to get the Scintilla object
To fix this, edit memoedit.prg, and in the SourceEdit function, replace the line
Return if( lDlg, if( lByRef, cSource, lChanged ), cSource )
by
Return if( lDlg, if( lByRef, cSource, lChanged ), oEditor )