Code: Select all | Expand
#include "FiveWin.ch"
#define DT_WORDBREAK 0x00000010
#define DT_CALCRECT 0x00000400
//----------------------------------------------------------------------------//
function Main()
local oWnd, oExBar, oPanel1, oPanel2, oPanel3, oPanel4
local aSections := {{ "One", "..\bitmaps\32x32\people.bmp",.t. },;
{ "Two", "..\bitmaps\32x32\case.bmp",.f. },;
{ "Three", "..\bitmaps\32x32\graphics.bmp",.t. },;
{ "Four", "..\bitmaps\32x32\people.bmp",.t. } }
local cMessageMemo:="Notice to users bla bla bla"+CRLF+;
"Notice to users bla bla bla"+CRLF+;
"Notice to users bla bla bla"+CRLF+;
"Notice to users bla bla bla"+CRLF+;
"Notice to users bla bla bla"+CRLF+;
"Notice to users bla bla bla"+CRLF+;
"Notice to users bla bla bla"+CRLF+;
"Notice to users bla bla bla"
local bClick := { | o | change_array(@aSections,oExBar) }
local oFontText
DEFINE FONT oFontText NAME "Segoe UI Light" SIZE 0, -12
DEFINE WINDOW oWnd TITLE "FWH Class TExplorerBar"
oWnd:SetSize( 350, 600 )
oExBar = TExplorerBar():New()
oPanel1 = oExBar:AddPanel( "One", "..\bitmaps\32x32\people.bmp",100 )
oPanel1:lSpecial = .T.
If aSections[2][3]
oPanel2 = oExBar:AddPanel( "Two", "..\bitmaps\32x32\case.bmp" )
Endif
oPanel3 = oExBar:AddPanel( "Three", "..\bitmaps\32x32\graphics.bmp" )
oPanel3:AddLink( "Add Panel 2", bClick, "..\bitmaps\16x16\additem.bmp" )
oPanel4 = oExBar:AddPanel( "Four" )
// sections
Section_Advice(oPanel1,oFontText,oWnd,cMessageMemo,oPanel3)
oWnd:oClient = oExBar
ACTIVATE WINDOW oWnd
return nil
//----------------------------------------------------------------------------//
function change_array(aSections,oExBar)
aSections[2][3]:= .t.
oExBar:refresh()
return nil
//----------------------------------------------------------------------------//
Function RinfrescaPanel(cMessageMemo,oPanel1,oMemo)
local nLineswidth:= 250
local nTotRows:= MLCount(Alltrim(cMessageMemo),nLineswidth)
local oItem
local old_Height:= oPanel1:nBodyHeight
oPanel1:nBodyHeight := (old_Height*nTotRows)/4
for n = 1 to Len( oPanel1:aControls )
oItem = oPanel1:aControls[ n ]
if oItem:ClassName == "TTaskPanel" .OR. oItem:ClassName == "TPanel"
oItem:nBottom:= (old_Height*nTotRows)/4
oItem:refresh()
Endif
next
AEval( oExbar:aPanels, { | o | o:Refresh() } )
oMemo:settext(cMessageMemo)
// oPanel1:refresh()
return nil
//---------------------------------------------------------------------------//
Function Section_Advice(oPanel1,oFontText,oWnd,cMessageMemo,oPanel3)
local oImageAdvice,oMemo,oBoxAdvice
local oItem1,oItem2
local nLineswidth:= 250
local nTotRows:= MLCount(Alltrim(cMessageMemo),nLineswidth)
local oBrushshadow,oBrushtext
local aGrad := { rgb(224,224,224),rgb(224,224,224) }
local aGradtext:= { rgb(248,248,248),rgb(248,248,248) }
local nMaxHeight
local badvise := { | o | (Msgget( "edit",,@cMessageMemo),;
RinfrescaPanel(cMessageMemo,oPanel1,oMemo)) }
DEFINE BRUSH oBrushshadow GRADIENT aGrad //shadow
DEFINE BRUSH oBrushtext GRADIENT aGradtext //text
oPanel3:AddLink( "Edit advise", badvise, "..\bitmaps\16x16\additem.bmp" )
//the shadow
oItem1:=Tpanel():New( oPanel1:nTitleHeight +2, 10,;
oPanel1:nBottom-10,oPanel1:nWidth-40, oPanel1 )
oItem1:SetBrush( oBrushshadow )
//panel for the text
oItem2:=Tpanel():New( 2, 2,;
oItem1:nBottom-45,oItem1:nWidth-4, oItem1)
oItem2:SetBrush( oBrushtext )
//the text
@ 5,10 SAY oMemo VAR cMessageMemo of oItem2 ;
SIZE oItem2:nwidth-40,oItem2:nBottom-10 PIXEL ;
FONT oFontText TRANSPARENT UPDATE
return nil
//------------------------------------------------------------------------------//
//mSGGET MODIFIED
function MsgGet( cTitle, cText, uVar, cBmpFile, cResName, lPassword, bAction )
local oDlg, oBmp
local oGet, uTemp := uVar
local lOk := .f.
DEFAULT cText := "", lPassword := .F.
if CenterMsgs( "?" )
SetAsMsgBox()
endif
DEFINE DIALOG oDlg FROM 10, 20 TO 26, 59.5 TITLE cTitle
oDlg:lTruePixel := .f.
if ! Empty( cBmpFile ) .or. ! Empty( cResName )
if ! Empty( cBmpFile )
@ 1, 1 BITMAP oBmp FILENAME cBmpFile SIZE 20, 20 NO BORDER OF oDlg
endif
if ! Empty( cResName )
@ 1, 1 BITMAP oBmp RESOURCE cResName SIZE 20, 20 NO BORDER OF oDlg
endif
@ 0.5, 6 SAY cText OF oDlg SIZE 250, 10
if ! lPassword
if Empty( bAction )
@ 0.6, 4 GET uTemp SIZE 120, 40 OF oDlg
else
@ 0.6, 4 GET oGet VAR uTemp ;
ACTION oGet:SetText( uTemp := Eval( bAction ) ) ;
SIZE 120, 60 OF oDlg
endif
else
@ 0.6, 4 GET oGet VAR uTemp SIZE 120, 12 OF oDlg PASSWORD ACTION ( oGet:lShowPassword := !oGet:lShowPassword )
endif
else
@ 0.5, 3.3 SAY cText OF oDlg SIZE 250, 10
if ! lPassword
if Empty( bAction )
@ 0.6, 2.3 GET uTemp SIZE 120, 60 MEMO OF oDlg
else
@ 0.6, 2.3 GET oGet VAR uTemp ;
ACTION oGet:SetText( uTemp := Eval( bAction ) ) ;
SIZE 120, 60 OF oDlg
endif
else
@ 0.6, 2.3 GET oGet VAR uTemp SIZE 120, 12 OF oDlg PASSWORD ACTION ( oGet:lShowPassword := !oGet:lShowPassword )
endif
endif
@ 4.25, 7.5 - If( oBmp == nil, 2, 0 ) BUTTON FWString( "&Ok" ) ;
OF oDlg SIZE 35, 12 ;
ACTION ( oDlg:End(), lOk := .t. ) DEFAULT
@ 4.25, 16.5 - If( oBmp == nil, 2, 0 ) BUTTON FWString( "&Cancel" ) ;
OF oDlg SIZE 35, 12 ;
ACTION ( oDlg:End(), lOk := .f. )
ACTIVATE DIALOG oDlg CENTERED
if lOk
uVar := uTemp
endif
return lOk
//-----------------------------------------------------------------------------//