Using xBrowse for Vert.-Scrolling of SAY-fields (to AHF)

Post Reply
User avatar
ukoenig
Posts: 3981
Joined: Wed Dec 19, 2007 6:40 pm
Location: Germany
Contact:

Using xBrowse for Vert.-Scrolling of SAY-fields (to AHF)

Post by ukoenig »

Hello,

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.

Image

Code: Select all


#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 :lol:
Last edited by ukoenig on Tue Dec 02, 2008 11:18 pm, edited 1 time in total.
Since 1995 ( the first release of FW 1.9 )
i work with FW.
If you have any questions about special functions, maybe i can help.
User avatar
James Bott
Posts: 4654
Joined: Fri Nov 18, 2005 4:52 pm
Location: San Diego, California, USA
Contact:

Post by James Bott »

Uwe,

You could also try using a multiline get set to READONLY.

James
User avatar
ukoenig
Posts: 3981
Joined: Wed Dec 19, 2007 6:40 pm
Location: Germany
Contact:

SAY with VScroll

Post by ukoenig »

Hello James,

I will add the same Var as a multiline-get to the Dialog.
Let's see, how it looks.

Regards
Uwe:lol:
Since 1995 ( the first release of FW 1.9 )
i work with FW.
If you have any questions about special functions, maybe i can help.
User avatar
ukoenig
Posts: 3981
Joined: Wed Dec 19, 2007 6:40 pm
Location: Germany
Contact:

SAY with VScroll

Post by ukoenig »

Hello James,

I added Multiline-Get.
I think xBrowse looks better. There is a Field-header and i can see the aktive line-position (ruler).
The Get is readonly, but You can click inside the area. The user doesn't know, if he can add some data.

Regards
Uwe :lol:
Since 1995 ( the first release of FW 1.9 )
i work with FW.
If you have any questions about special functions, maybe i can help.
User avatar
James Bott
Posts: 4654
Joined: Fri Nov 18, 2005 4:52 pm
Location: San Diego, California, USA
Contact:

Post by James Bott »

Uwe,

Thanks for posting the screenshot.

>I think xBrowse looks better. There is a Field-header and i can see the aktive line-position (ruler).

At least we have two options.

>The Get is readonly, but You can click inside the area. The user doesn't know, if he can add some data.

There could be an advantage to being able to click inside the GET. Can you hightlihgt text and copy it? Also, I bet there is a way to make it not clickable.

Regards,
James
Post Reply