here is a nice solution for vertical-scrolling of big SAY-fields.
Because there is no MULTTILINE and VSCROLL for a REDEFINE SAY,
I use xBROWSE and Arrays.
- Code: Select all Expand view
#include "fivewin.ch"
#include "folder.ch"
#include "xBrowse.ch"
FUNCTION Main()
LOCAL oDlg, oBtn1, oBtn2, oFld, nColor := 0, oLbx, aTEXT := {}
oFONT := TFont():New("Arial", ,-16, .F. ,.T., , , ,.F.)
DEFINE DIALOG oDlg RESOURCE "MAINDLG" PIXEL TRANSPARENT TITLE "Testing Folder-Tabs" FONT oFont
REDEFINE FOLDER oFld ID 110 OF oDlg PROMPT " Blue ", " Red ", " Green " ;
PAGE "Page1", "Page2", "Page3" PIXEL Font oFont
cSAY := "This is a very long Field-Text with 40 Chars to show in xBrowse" + ;
"with another extra Line added " + ;
"1111111111 1111111111 1111111 222222 2222222222 33333333 4444444444"
// aText = Array
// cSAY = SAY
// Value = Text-length to show and line-break
// --------------------------------------------------
MAKE_ARRAY( aTEXT, cSAY, 35 )
oLbx := TXBrowse():New( oFld:aDialogs[1] )
oLbx:nMarqueeStyle := MARQSTYLE_HIGHLROW
oLbx:nColDividerStyle := LINESTYLE_NOLINES
oLbx:nRowDividerStyle := LINESTYLE_NOLINES
oLbx:nRecSelColor = 15512898
oLbx:bClrSelFocus = { || { 16777215, 15512898 } }
oLbx:bClrSel = { || { 16777215, 15512898 } }
oLbx:SetArray( aTEXT )
oLbx:aCols[ 1 ]:cHeader = Padr("Info", 70)
oLbx:lHScroll := .F.
oLbx:lVScroll := .T.
oLbx:lFooter := .F.
oLbx:lRecordSelector := .F.
oLbx:CreateFromResource( 120 )
// Multiline-Get READONLY
// ----------------------------
REDEFINE GET oGET VAR cSAY ID 130 MULTILINE of oFld:aDialogs[1]
REDEFINE BUTTONBMP oBtn1 ID 30 OF oDlg ;
ACTION ( oDlg:End() ) ;
BITMAP "quit" PROMPT SPACE(10) + "&Exit" TEXTRIGHT
oBtn1:cToolTip = { "Close the" + CRLF + "Template" + CRLF + ;
"Dialog","Close the Dialog", 1, CLR_BLACK, 14089979 }
ACTIVATE DIALOG oDlg CENTERED ;
ON PAINT ( Gradpaint0( hDC, oDlg ), SetDialogsGradient( oFld ) )
oFont:End()
RETURN ( NIL )
// -------------------------------
FUNCTION MAKE_ARRAY( aFIELD, cTEXT, nSIZE )
// cSAY := "This is a very long Field-Text with 40 Chars to show " + ;
// "in xBrowse with another extra Line added + ;
// 1111111111 1111111111 1111111 222222 2222222222 33333333 4444444444"
nLINES := ( LEN(cTEXT) / nSIZE ) + 1 // select the number of chars, You want to show in a row
// Add a line to the Array and calculate a clean Line-break
// ----------------------------------------------------------------
n := 1
nFOR := 1
FOR nFOR := 1 TO INT(nLINES)
cSTRING := SUBSTR( cSAY, n, nSIZE )
nNEXTPOS := RAT( " ", cSTRING ) // the last blanc-pos in substring
AADD(aFIELD, { SUBSTR( cSAY, n, nNEXTPOS ) })
n := n + nNEXTPOS
NEXT
RETURN( NIL )
// -------- Gradient in Windows ---------------------------------
static func Gradpaint0( hDC, oWnd )
local aGrad1
aGrad1 := { { 0.50, 16054371, 8388608 },{ 0.50, 8388608, 16054371 } }
GradientFill( hDC, 0, 0, oWnd:nHeight, oWnd:nWidth, aGrad1, .T. )
RETURN NIL
// --------- Gradient in FOLDER -------------------
FUNCTION SetDialogsGradient( oFld )
LOCAL n, oDlg
FOR n = 1 to Len( oFld:aDialogs )
oDlg = oFld:aDialogs[ n ]
IF n = 1
oDlg:bPainted = { | hDC | GradientFill( hDC, 0, 0, oDlg:nHeight, ;
oDlg:nWidth, { { 0.50, 0, 16045947 } } ) }
ENDIF
IF n = 2
oDlg:bPainted = { | hDC | GradientFill( hDC, 0, 0, oDlg:nHeight, ;
oDlg:nWidth, { { 0.50, 0, 128 } } ) }
ENDIF
IF n = 3
oDlg:bPainted = { | hDC | GradientFill( hDC, 0, 0, oDlg:nHeight, ;
oDlg:nWidth, { { 0.50, 0, 32768 } } ) }
ENDIF
NEXT
RETURN NIL
Regards
Uwe