fivewin xbrowse array
Enviado: 24 Fev 2025 19:51
O que tá errado nisso.
Não é automático ?
É um browse simples de array.
Não é automático ?
É um browse simples de array.
Código: Selecionar todos
#include "fivewin.ch"
PROCEDURE ze_fwTextMsg
LOCAL oVar, nCont // , oDialog
hb_ThreadStart( { || oVar := DlgTextMsgClass():New(), oVar:Execute() } )
Altd()
Inkey(2)
FOR nCont = 1 TO 50
oVar:ShowText( "Test " + Ltrim( Str( nCont ) ) )
Inkey(2)
NEXT
oVar:End()
RETURN
CREATE CLASS DlgTextMsgClass
VAR xDlg
VAR xControl
VAR cText
VAR aText INIT {}
VAR nMaxRow INIT 10
VAR nStyle INIT 2
METHOD Execute()
METHOD ShowText( cText )
METHOD End() INLINE ::xDlg:End()
ENDCLASS
METHOD Execute() CLASS DlgTextMsgClass
LOCAL nDlgWidth, nDlgHeight, oFont // xStatusbar,
LOCAL nFontSize
nDlgWidth := AppWindowInfo()[1]
nDlgHeight := AppWindowInfo()[2]
nFontSize := Int( AppWindowInfo()[ 3 ] * 0.8 )
::nMaxRow := Int( nDlgHeight / ( nFontSize + 2 ) - 2 )
DEFINE FONT oFont NAME "ARIAL" SIZE 0, -nFontSize
DEFINE DIALOG ::xDlg FROM 0, 0 TO nDlgHeight, nDlgWidth PIXEL ;
FONT oFont ;
TITLE "TextScroll" // COLOR COLOR_WHITE, CLR_JPA
::xDlg:SetIcon( TIcon():New(,,"APPICON" ) )
::xDlg:bValid := .F.
IF ::nStyle == 1
@ 10, 10 GET ::xControl VAR ::cText MEMO OF ::xDlg PIXEL ;
SIZE nDlgWidth - nFontSize, nDlgHeight - nFontSize FONT oFont COLOR CLR_BLACK, CLR_WHITE // TRANSPARENT BORDER
ENDIF
//::xGet:Disable()
//Don't works for GET MEMO
//::xGet:lDisColors := .F.
//::xGet:nClrTextDis := RGB2N(20,20,20)
IF ::nStyle == 2
@ 10, 10 XBROWSE ::xControl ;
Array Array(10) ;
SIZE nDlgWidth - nFontSize, nDlgHeight - nFontSize FONT oFont
::xControl:SetArray( ::aText )
ENDIF
ACTIVATE DIALOG ::xDlg CENTERED
//ON INIT ( (Self), guistatusBarCreate( ::xDlg, @xStatusbar, "" ) )
RETURN Nil
METHOD ShowText( cText ) CLASS DlgTextMsgClass
LOCAL cItem
IF Len( ::aText ) = ::nMaxRow
ADel( ::aText, 1 )
::aText[ Len( ::aText ) ] := cText
ELSE
AAdd( ::aText, cText )
ENDIF
::cText := ""
FOR EACH cItem IN ::aText
::cText += cItem + hb_Eol()
NEXT
IF ::nStyle == 1
::xControl:VarPut( ::cText )
::xControl:Refresh()
ELSE
::xControl:SetArray( ::aText )
::xControl:nArrayAt := Len( ::aText )
::xControl:Refresh()
ENDIF
RETURN Nil
//STATIC FUNCTION guiStatusBarCreate( xDlg, xStatusbar, cText )
//DEFINE STATUSBAR xStatusBar PROMPT cText OF xDlg
//xDlg:Refresh()
//RETURN xStatusBar