Exemplo de lenta
Enviado: 07 Mai 2025 21:01
Como eu já disse, automático é comigo mesmo kkkkk
Aba1
Aba 2
Aba3
Aba4
Aba5
Quantas tem mesmo ? sei lá perdi as contas, o Lenta que se vire....
E por último, forçar pintura
O que faltou?
O click pra sei lá quantas abas
Style pra cada coluna, sei lá quantas
E nomes, sei lá quantos
Dá pra pensar em criar algo assim dentro da lenta, ou criar outro por herança, e deixar lenta mais flexível.
Aba1
Código: Selecionar todos
@ 20, 150 PANEL oPane1 SIZE 360, 200 STYLE SS_OWNERDRAW BACKCOLOR CLR_BROWN_3 ON SIZE { || .T. }
AAdd( aChildList, oPane1 )
oPane1:oFont := oFont
@ 20, 16 EDITBOX "Pyotr" OF oPane1 SIZE 200, 26
@ 20, 46 EDITBOX "Ilyich" OF oPane1 SIZE 200, 26
@ 20, 76 EDITBOX "Tchaikovsky" OF oPane1 SIZE 200, 26
@ 20, 106 EDITBOX "07/05/1840" OF oPane1 SIZE 100, 26
oPane1:Hide()
Código: Selecionar todos
@ 20, 150 PANEL oPane2 SIZE 360, 200 STYLE SS_OWNERDRAW BACKCOLOR CLR_BROWN_2 ON SIZE { || .T. }
AAdd( aChildList, oPane2 )
oPane2:oFont := oFont
@ 20, 16 EDITBOX "Sergei" OF oPane2 SIZE 200, 26
@ 20, 46 EDITBOX "Vasilievich" OF oPane2 SIZE 200, 26
@ 20, 76 EDITBOX "Rachmaninoff" OF oPane2 SIZE 200, 26
@ 20, 106 EDITBOX "01/04/1873" OF oPane2 SIZE 100, 26
oPane2:Hide()
Código: Selecionar todos
@ 20, 150 PANEL oPane3 SIZE 360, 200 STYLE SS_OWNERDRAW BACKCOLOR CLR_BROWN_3 ON SIZE { || .T. }
AAdd( aChildList, oPane3 )
@ 20, 16 EDITBOX "Vasilievich" OF oPane3 SIZE 200, 26
oPane3:oFont := oFont
Código: Selecionar todos
@ 20, 150 PANEL oPane4 SIZE 360, 200 STYLE SS_OWNERDRAW BACKCOLOR CLR_BROWN_2 ON SIZE { || .T. }
AAdd( AChildList, oPane4 )
@ 20, 46 EDITBOX "Vasilievich" OF oPane4 SIZE 200, 26
oPane4:oFont := oFont
Código: Selecionar todos
@ 20, 150 PANEL oPane5 SIZE 360, 200 STYLE SS_OWNERDRAW BACKCOLOR CLR_BROWN_2 ON SIZE { || .T. }
AAdd( AChildList, oPane5 )
@ 20, 76 EDITBOX "Vasilievich" OF oPane5 SIZE 200, 26
oPane5:oFont := oFont
Código: Selecionar todos
@ 20, 116 LENTA oLenta ;
SIZE 60 * Len( aChildList ), 28 ;
FONT oFont ;
ITEMS LentaNames( aChildList ) ;
ITEMSIZE 60 ;
HSTYLES LentaStyles( aChildList ) ;
ON CLICK { || LentaClick( oLenta, aChildList ) }
Código: Selecionar todos
oLenta:Value := 1
LentaClick( oLenta, aChildList )
O click pra sei lá quantas abas
Código: Selecionar todos
STATIC FUNCTION LentaClick( oLenta, aChildList )
LOCAL oChild
IF ! Empty( aChildList )
FOR EACH oChild IN aChildList
IF oChild:__EnumIndex() == oLenta:Value
oChild:Show()
ELSE
oChild:Hide()
ENDIF
NEXT
ENDIF
RETURN .T.
Código: Selecionar todos
STATIC FUNCTION LentaStyles( aChildList )
LOCAL nIndex := 0, aList := {}, nCont
LOCAL aStyleList := { ;
HStyle():New( { CLR_BROWN_2 }, 1 ), ;
HStyle():New( { CLR_BROWN_3, CLR_BROWN_4 }, 1, , 2, CLR_LIGHTGRAY_2 ) }
FOR nCont = 1 TO Len( aChildList )
nIndex += 1
IF nIndex > Len( aStyleList )
nIndex := 1
ENDIF
AAdd( aList, aStyleList[ nIndex ] )
NEXT
RETURN aList
Código: Selecionar todos
STATIC FUNCTION LentaNames( aChildList )
LOCAL nIndex, aList := {}
FOR nIndex = 1 TO Len( aChildList )
AAdd( aList, Replicate( Chr( 64 + nIndex ), 5 ) )
NEXT
RETURN aList
Código: Selecionar todos
/*
demolenta.prg
*/
// Lenta and panels, used as a replacement of a colorized tab
#include "hwgui.ch"
#define CLR_LIGHTGRAY_2 0xaaaaaa
#define CLR_BROWN_1 0x154780
#define CLR_BROWN_2 0x396eaa
#define CLR_BROWN_3 0x6a9cd4
#define CLR_BROWN_4 0x9dc7f6
#define CLR_DLGBACK 0x154780
FUNCTION DemoLenta()
LOCAL oFont := HFont():Add( "MS Sans Serif", 0, - 13 )
LOCAL oPane1, oPane2, oPane3, oPane4, oPane5
LOCAL oLenta, aChildList := {}
INIT DIALOG oDlg ;
TITLE "demolenta.prg - Lenta control" ;
AT 210, 10 ;
SIZE 800, 600 ;
FONT oFont ;
BACKCOLOR CLR_DLGBACK
@ 20, 150 PANEL oPane1 SIZE 360, 200 STYLE SS_OWNERDRAW BACKCOLOR CLR_BROWN_3 ON SIZE { || .T. }
AAdd( aChildList, oPane1 )
oPane1:oFont := oFont
@ 20, 16 EDITBOX "Pyotr" OF oPane1 SIZE 200, 26
@ 20, 46 EDITBOX "Ilyich" OF oPane1 SIZE 200, 26
@ 20, 76 EDITBOX "Tchaikovsky" OF oPane1 SIZE 200, 26
@ 20, 106 EDITBOX "07/05/1840" OF oPane1 SIZE 100, 26
oPane1:Hide()
@ 20, 150 PANEL oPane2 SIZE 360, 200 STYLE SS_OWNERDRAW BACKCOLOR CLR_BROWN_2 ON SIZE { || .T. }
AAdd( aChildList, oPane2 )
oPane2:oFont := oFont
@ 20, 16 EDITBOX "Sergei" OF oPane2 SIZE 200, 26
@ 20, 46 EDITBOX "Vasilievich" OF oPane2 SIZE 200, 26
@ 20, 76 EDITBOX "Rachmaninoff" OF oPane2 SIZE 200, 26
@ 20, 106 EDITBOX "01/04/1873" OF oPane2 SIZE 100, 26
oPane2:Hide()
@ 20, 150 PANEL oPane3 SIZE 360, 200 STYLE SS_OWNERDRAW BACKCOLOR CLR_BROWN_3 ON SIZE { || .T. }
AAdd( aChildList, oPane3 )
@ 20, 16 EDITBOX "Vasilievich" OF oPane3 SIZE 200, 26
oPane3:oFont := oFont
@ 20, 150 PANEL oPane4 SIZE 360, 200 STYLE SS_OWNERDRAW BACKCOLOR CLR_BROWN_2 ON SIZE { || .T. }
AAdd( AChildList, oPane4 )
@ 20, 46 EDITBOX "Vasilievich" OF oPane4 SIZE 200, 26
oPane4:oFont := oFont
@ 20, 150 PANEL oPane5 SIZE 360, 200 STYLE SS_OWNERDRAW BACKCOLOR CLR_BROWN_2 ON SIZE { || .T. }
AAdd( AChildList, oPane5 )
@ 20, 76 EDITBOX "Vasilievich" OF oPane5 SIZE 200, 26
oPane5:oFont := oFont
@ 20, 116 LENTA oLenta ;
SIZE 60 * Len( aChildList ), 28 ;
FONT oFont ;
ITEMS LentaNames( aChildList ) ;
ITEMSIZE 60 ;
HSTYLES LentaStyles( aChildList ) ;
ON CLICK { || LentaClick( oLenta, aChildList ) }
oLenta:Value := 1
LentaClick( oLenta, aChildList )
ACTIVATE DIALOG oDlg CENTER
oFont:Release()
RETURN Nil
STATIC FUNCTION LentaClick( oLenta, aChildList )
LOCAL oChild
IF ! Empty( aChildList )
FOR EACH oChild IN aChildList
IF oChild:__EnumIndex() == oLenta:Value
oChild:Show()
ELSE
oChild:Hide()
ENDIF
NEXT
ENDIF
RETURN .T.
STATIC FUNCTION LentaStyles( aChildList )
LOCAL nIndex := 0, aList := {}, nCont
LOCAL aStyleList := { ;
HStyle():New( { CLR_BROWN_2 }, 1 ), ;
HStyle():New( { CLR_BROWN_3, CLR_BROWN_4 }, 1, , 2, CLR_LIGHTGRAY_2 ) }
FOR nCont = 1 TO Len( aChildList )
nIndex += 1
IF nIndex > Len( aStyleList )
nIndex := 1
ENDIF
AAdd( aList, aStyleList[ nIndex ] )
NEXT
RETURN aList
STATIC FUNCTION LentaNames( aChildList )
LOCAL nIndex, aList := {}
FOR nIndex = 1 TO Len( aChildList )
AAdd( aList, Replicate( Chr( 64 + nIndex ), 5 ) )
NEXT
RETURN aList