Exemplo de lenta

Projeto HwGui - Biblioteca visual para Harbour/xHarbour

Moderador: Moderadores

Avatar do usuário
JoséQuintas
Administrador
Administrador
Mensagens: 20267
Registrado em: 26 Fev 2007 11:59
Localização: São Paulo-SP

Exemplo de lenta

Mensagem por JoséQuintas »

Como eu já disse, automático é comigo mesmo kkkkk

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()
Aba 2

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()
Aba3

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
Aba4

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
Aba5

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
Quantas tem mesmo ? sei lá perdi as contas, o Lenta que se vire....

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 ) }
E por último, forçar pintura

Código: Selecionar todos

   oLenta:Value := 1
   LentaClick( oLenta, aChildList )
O que faltou?
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.
Style pra cada coluna, sei lá quantas

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
E nomes, sei lá quantos

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
demolenta.png
Dá pra pensar em criar algo assim dentro da lenta, ou criar outro por herança, e deixar lenta mais flexível.

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

José M. C. Quintas
Harbour 3.2, mingw, gtwvg mt, fivewin 25.04, multithread, dbfcdx, MySQL, ADOClass, PDFClass, SefazClass, (hwgui mt), (hmg3), (hmg extended), (oohg), PNotepad, ASP, stored procedure, stored function, Linux (Flagship/harbour 3.2)
"The world is full of kings and queens, who blind our eyes and steal our dreams Its Heaven and Hell"

https://github.com/JoseQuintas/
Avatar do usuário
JoséQuintas
Administrador
Administrador
Mensagens: 20267
Registrado em: 26 Fev 2007 11:59
Localização: São Paulo-SP

Exemplo de lenta

Mensagem por JoséQuintas »

Isso deixou o fonte mais legível, com menos poluição.

O que talvez precise melhorar:
Tem limite, não pode ter mais abas do que a largura.
Aí é conforme o uso, expandir as possibilidades.
Só um botão de cada lado, ou os dois juntos, avançando colunas, tá cheio de controle que faz isso, não seria problema.

Mas é legal, dá pra fazer testes variados, antes de mexer num controle adicional ou não.

Eu disse quando começaram essas mudanças na hwgui:
Poder criar controles, o limite é a imaginação.
José M. C. Quintas
Harbour 3.2, mingw, gtwvg mt, fivewin 25.04, multithread, dbfcdx, MySQL, ADOClass, PDFClass, SefazClass, (hwgui mt), (hmg3), (hmg extended), (oohg), PNotepad, ASP, stored procedure, stored function, Linux (Flagship/harbour 3.2)
"The world is full of kings and queens, who blind our eyes and steal our dreams Its Heaven and Hell"

https://github.com/JoseQuintas/
Avatar do usuário
JoséQuintas
Administrador
Administrador
Mensagens: 20267
Registrado em: 26 Fev 2007 11:59
Localização: São Paulo-SP

Exemplo de lenta

Mensagem por JoséQuintas »

Código: Selecionar todos

   FOR nCont = 1 TO Len( aPaneList )
      @ 20, 150 PANEL aPaneList[nCont] SIZE 600, 200 STYLE SS_OWNERDRAW BACKCOLOR NextBackColor() ON SIZE { || .T. }
      aPaneList[ nCont ]:oFont := oFont
      aCaptionList[ nCont ] := Chr( 64 + nCont )
      aPaneList[ nCont ]:Hide()
   NEXT

   aCaptionList[ 1 ] := "One"
   @ 20,  16 EDITBOX "Edit One" OF aPaneList[1] SIZE 200, 26
   @ 20,  46 EDITBOX "Edit Two" OF aPaneList[1] SIZE 200, 26
   @ 20,  76 EDITBOX "Edit Three" OF aPaneList[1] SIZE 200, 26

   aCaptionList[ 3 ] := "Three"
   @ 20, 16 EDITBOX "Edit Four" OF aPaneList[3] SIZE 200, 26
   @ 20, 46 EDITBOX "Edit Five" OF aPaneList[3] SIZE 200, 26
   @ 20, 76 EDITBOX "Edit Six" OF aPaneList[3] SIZE 200, 26

   aCaptionList[ 5 ] := "Five"
   @ 20, 16 EDITBOX "Edit Seven" OF aPaneList[5] SIZE 200, 26

   aCaptionList[ 7 ] := "Seven"
   @ 20, 46 EDITBOX "Edit Eight" OF aPaneList[7] SIZE 200, 26

   aCaptionList[ 9 ] := "Nine"
   @ 20, 76 EDITBOX "Edit Nine" OF aPaneList[9] SIZE 200, 26
Ok? Esse funcionou.

Mas tem o funcionamento do demoall, de reutilizar samples.

Código: Selecionar todos

   aCaptionList[ 1 ] := "checkbox"
   DemoCheckbox( .F., aPaneList[ 1 ] )

   aCaptionList[ 2 ] := "bitmap"
   DemoBitmap( .F., aPaneList[ 2 ] )
Em TAB dá certo, em PANEL nada fica dentro do panel, e as posições não são relativas ao panel.
Precisa mais testes.
José M. C. Quintas
Harbour 3.2, mingw, gtwvg mt, fivewin 25.04, multithread, dbfcdx, MySQL, ADOClass, PDFClass, SefazClass, (hwgui mt), (hmg3), (hmg extended), (oohg), PNotepad, ASP, stored procedure, stored function, Linux (Flagship/harbour 3.2)
"The world is full of kings and queens, who blind our eyes and steal our dreams Its Heaven and Hell"

https://github.com/JoseQuintas/
Avatar do usuário
JoséQuintas
Administrador
Administrador
Mensagens: 20267
Registrado em: 26 Fev 2007 11:59
Localização: São Paulo-SP

Exemplo de lenta

Mensagem por JoséQuintas »

Quem mandou testar isso kkkkk

cerca de 50 PRGs alterados hoje, só pra começar.....

Para que funcione direito no demolenta2, é obrigatória a indicação de parent.
Nota: O demolenta2 pode ficar parecido com demoall.
José M. C. Quintas
Harbour 3.2, mingw, gtwvg mt, fivewin 25.04, multithread, dbfcdx, MySQL, ADOClass, PDFClass, SefazClass, (hwgui mt), (hmg3), (hmg extended), (oohg), PNotepad, ASP, stored procedure, stored function, Linux (Flagship/harbour 3.2)
"The world is full of kings and queens, who blind our eyes and steal our dreams Its Heaven and Hell"

https://github.com/JoseQuintas/
Avatar do usuário
JoséQuintas
Administrador
Administrador
Mensagens: 20267
Registrado em: 26 Fev 2007 11:59
Localização: São Paulo-SP

Exemplo de lenta

Mensagem por JoséQuintas »

demolenta2.png
Uia....
Isso é normal, o fonte nem tanto...
Não dá pra facilitar mais que isso...

Código: Selecionar todos

   aCaptionList[ 2 ] := "checkbox"
   DemoCheckBox( .F., aPanelList[ 2 ] )
José M. C. Quintas
Harbour 3.2, mingw, gtwvg mt, fivewin 25.04, multithread, dbfcdx, MySQL, ADOClass, PDFClass, SefazClass, (hwgui mt), (hmg3), (hmg extended), (oohg), PNotepad, ASP, stored procedure, stored function, Linux (Flagship/harbour 3.2)
"The world is full of kings and queens, who blind our eyes and steal our dreams Its Heaven and Hell"

https://github.com/JoseQuintas/
Avatar do usuário
JoséQuintas
Administrador
Administrador
Mensagens: 20267
Registrado em: 26 Fev 2007 11:59
Localização: São Paulo-SP

Exemplo de lenta

Mensagem por JoséQuintas »

Tem uma coisa interessante nisso....

O fonte tava bom pra dialog.
O fonte tava bom pra tab.
Mas chegou na hora do panel, fez falta o "OF oDlg".

Como eu já disse, é testar todas as situações que poderiam acontecer num aplicativo.
Esse negócio de reutilizar exemplo tá ajudando a testar isso mais rápido.

Alguma complicação no exemplo de demolenta2?
Só tem o nIndex, que é o número do Panel atual.
Qualquer coisa, é só clicar no botão de fonte, pra ver o fonte.

Código: Selecionar todos

   aCaptionList[ ++nIndex ] := "check"
   DemoCheckBox( .F., aPanelList[ nIndex ] )

   aCaptionList[ ++nIndex ] := "image2"
   DemoImage2( .F., aPanelList[ nIndex ] )

   aCaptionList[ ++nIndex ] := "tab"
   DemoTab( .F., aPanelList[ nIndex ] )

   aCaptionList[ ++nIndex ] := "One"
   @ 20,  16 EDITBOX "Edit One" OF aPanelList[ nIndex ] SIZE 200, 26
   @ 20,  46 EDITBOX "Edit Two" OF aPanelList[ nIndex ] SIZE 200, 26
   @ 20,  76 EDITBOX "Edit Three" OF aPanelList[ nIndex ] SIZE 200, 26
No caso, o outro exemplo usa oDLG, que passa a ser esse panel, que é passado por parâmetro.
José M. C. Quintas
Harbour 3.2, mingw, gtwvg mt, fivewin 25.04, multithread, dbfcdx, MySQL, ADOClass, PDFClass, SefazClass, (hwgui mt), (hmg3), (hmg extended), (oohg), PNotepad, ASP, stored procedure, stored function, Linux (Flagship/harbour 3.2)
"The world is full of kings and queens, who blind our eyes and steal our dreams Its Heaven and Hell"

https://github.com/JoseQuintas/
Avatar do usuário
JoséQuintas
Administrador
Administrador
Mensagens: 20267
Registrado em: 26 Fev 2007 11:59
Localização: São Paulo-SP

Exemplo de lenta

Mensagem por JoséQuintas »

Código: Selecionar todos

/*
demolenta2.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 DemoLenta2( lWithDialog, oDlg )

   LOCAL oFont := HFont():Add( "MS Sans Serif", 0, - 13 )
   LOCAL aPanelList := Array(10), aCaptionList := Array(10), nCont
   LOCAL oLenta, nIndex := 0

   hb_Default( @lWithDialog, .T. )

   IF lWithDialog
      INIT DIALOG oDlg ;
         TITLE "demolenta2.prg - Lenta control"  ;
         AT 210, 10 ;
         SIZE 1024, 768 ;
         FONT oFont
   ENDIF

   ButtonForSample( "demolenta2.prg", oDlg )

   FOR nCont = 1 TO Len( aPanelList )

      @ 20, 150 PANEL aPanelList[nCont] ;
         SIZE 800, 600 ;
         STYLE SS_OWNERDRAW ;
         BACKCOLOR NextBackColor() ;
         ON SIZE { || .T. }

      aPanelList[ nCont ]:oFont := oFont
      aCaptionList[ nCont ] := Chr( 64 + nCont )
      aPanelList[ nCont ]:Hide()
   NEXT

   aCaptionList[ ++nIndex ] := "check"
   DemoCheckBox( .F., aPanelList[ nIndex ] )

   aCaptionList[ ++nIndex ] := "image2"
   DemoImage2( .F., aPanelList[ nIndex ] )

   aCaptionList[ ++nIndex ] := "tab"
   DemoTab( .F., aPanelList[ nIndex ] )

   aCaptionList[ ++nIndex ] := "One"
   @ 20,  16 EDITBOX "Edit One" OF aPanelList[ nIndex ] SIZE 200, 26
   @ 20,  46 EDITBOX "Edit Two" OF aPanelList[ nIndex ] SIZE 200, 26
   @ 20,  76 EDITBOX "Edit Three" OF aPanelList[ nIndex ] SIZE 200, 26

   aCaptionList[ ++nIndex ] := "Two"
   @ 20, 16 EDITBOX "Edit Four" OF aPanelList[ nIndex ] SIZE 200, 26
   @ 20, 46 EDITBOX "Edit Five" OF aPanelList[ nIndex ] SIZE 200, 26
   @ 20, 76 EDITBOX "Edit Six" OF aPanelList[ nIndex ] SIZE 200, 26

   aCaptionList[ ++nIndex  ] := "Three"
   @ 20, 16 EDITBOX "Edit Seven" OF aPanelList[ nIndex ] SIZE 200, 26

   aCaptionList[ ++nIndex ] := "Four"
   @ 20, 46 EDITBOX "Edit Eight" OF aPanelList[ nIndex ] SIZE 200, 26

   aCaptionList[ ++nIndex ] := "Five"
   @ 20, 76 EDITBOX "Edit Nine" OF aPanelList[ nIndex ] SIZE 200, 26

   @ 20, 116 LENTA oLenta ;
      OF oDlg ;
      SIZE 60 * Len( aPanelList ), 28 ;
      FONT oFont ;
      ITEMS aCaptionList ;
      ITEMSIZE 60 ;
      HSTYLES LentaStyles( aPanelList ) ;
      ON CLICK { || LentaClick( oLenta, aPanelList ) }

   //oLenta := HLenta():New( , , 20, 16, 160, 28, oFont, , , bTab, , , ;
   //   { "First", "Second" }, 80, aStyleLenta )

   oLenta:Value := 1
   LentaClick( oLenta, aPanelList )

   IF lWithDialog
      ACTIVATE DIALOG oDlg CENTER

      oFont:Release()
   ENDIF

   RETURN Nil

STATIC FUNCTION LentaClick( oLenta, aPanelList )

   LOCAL oChild

   IF ! Empty( aPanelList )
      FOR EACH oChild IN aPanelList
         IF oChild:__EnumIndex() == oLenta:Value
            oChild:Show()
         ELSE
            oChild:Hide()
         ENDIF
      NEXT
   ENDIF

   RETURN .T.

STATIC FUNCTION LentaStyles( aPanelList )

   LOCAL nIndex := 0, aList := {}, nCont
   LOCAL aStyleList := { ;
      HStyle():New( { CLR_LIGHTGRAY_2 }, 1 ), ;
      HStyle():New( { CLR_DLGBACK , CLR_BROWN_4 }, 1, , 2, CLR_DLGBACK ) }

   FOR nCont = 1 TO Len( aPanelList )
      nIndex += 1
      IF nIndex > Len( aStyleList )
         nIndex := 1
      ENDIF
      AAdd( aList, aStyleList[ nIndex ] )
   NEXT

   RETURN aList

STATIC FUNCTION NextBackColor()

   LOCAL aList := { ;
      16772062, ;
      CLR_LIGHTGRAY_2, ;
      CLR_BROWN_2 , ;
      CLR_BROWN_3 , ;
      CLR_BROWN_4 , ;
      CLR_DLGBACK  }

   STATIC nIndex := 0

   nIndex += 1
   IF nIndex > Len( aList )
      nIndex := 1
   ENDIF

   RETURN aList[ nIndex ]

#include "demo.ch"
Versão atual salva no source-forge.

passo a passo

Código: Selecionar todos

FUNCTION DemoLenta2( lWithDialog, oDlg )

   LOCAL oFont := HFont():Add( "MS Sans Serif", 0, - 13 )
   LOCAL aPanelList := Array(10), aCaptionList := Array(10), nCont
   LOCAL oLenta, nIndex := 0

Cria variáveis aPanelList pra lista de panels, aCaptionList pra lista de textos, nIndex como contador

Código: Selecionar todos

   hb_Default( @lWithDialog, .T. )

   IF lWithDialog
      INIT DIALOG oDlg ;
         TITLE "demolenta2.prg - Lenta control"  ;
         AT 210, 10 ;
         SIZE 1024, 768 ;
         FONT oFont
   ENDIF

   ButtonForSample( "demolenta2.prg", oDlg )
Default com dialog, se é com dialog cria a dialog, e cria os buttons normais de exemplo.

Código: Selecionar todos

   FOR nCont = 1 TO Len( aPanelList )

      @ 20, 150 PANEL aPanelList[nCont] ;
         SIZE 800, 600 ;
         STYLE SS_OWNERDRAW ;
         BACKCOLOR NextBackColor() ;
         ON SIZE { || .T. }

      aPanelList[ nCont ]:oFont := oFont
      aCaptionList[ nCont ] := Chr( 64 + nCont )
      aPanelList[ nCont ]:Hide()
   NEXT
Cria 10 panels (ou o tamanho do array), e deixa Hide(), escondidos.

Código: Selecionar todos

   aCaptionList[ ++nIndex ] := "check"
   DemoCheckBox( .F., aPanelList[ nIndex ] )

   aCaptionList[ ++nIndex ] := "image2"
   DemoImage2( .F., aPanelList[ nIndex ] )

   aCaptionList[ ++nIndex ] := "tab"
   DemoTab( .F., aPanelList[ nIndex ] )

   aCaptionList[ ++nIndex ] := "One"
   @ 20,  16 EDITBOX "Edit One" OF aPanelList[ nIndex ] SIZE 200, 26
   @ 20,  46 EDITBOX "Edit Two" OF aPanelList[ nIndex ] SIZE 200, 26
   @ 20,  76 EDITBOX "Edit Three" OF aPanelList[ nIndex ] SIZE 200, 26

   aCaptionList[ ++nIndex ] := "Two"
   @ 20, 16 EDITBOX "Edit Four" OF aPanelList[ nIndex ] SIZE 200, 26
   @ 20, 46 EDITBOX "Edit Five" OF aPanelList[ nIndex ] SIZE 200, 26
   @ 20, 76 EDITBOX "Edit Six" OF aPanelList[ nIndex ] SIZE 200, 26

   aCaptionList[ ++nIndex  ] := "Three"
   @ 20, 16 EDITBOX "Edit Seven" OF aPanelList[ nIndex ] SIZE 200, 26

   aCaptionList[ ++nIndex ] := "Four"
   @ 20, 46 EDITBOX "Edit Eight" OF aPanelList[ nIndex ] SIZE 200, 26

   aCaptionList[ ++nIndex ] := "Five"
   @ 20, 76 EDITBOX "Edit Nine" OF aPanelList[ nIndex ] SIZE 200, 26
Vai criando os panels.
Aproveita no texto pra aumentar o contador aCaptionList[ ++nIndex]

Código: Selecionar todos

   @ 20, 116 LENTA oLenta ;
      OF oDlg ;
      SIZE 60 * Len( aPanelList ), 28 ;
      FONT oFont ;
      ITEMS aCaptionList ;
      ITEMSIZE 60 ;
      HSTYLES LentaStyles( aPanelList ) ;
      ON CLICK { || LentaClick( oLenta, aPanelList ) }

   //oLenta := HLenta():New( , , 20, 16, 160, 28, oFont, , , bTab, , , ;
   //   { "First", "Second" }, 80, aStyleLenta )

   oLenta:Value := 1
   LentaClick( oLenta, aPanelList )

   IF lWithDialog
      ACTIVATE DIALOG oDlg CENTER

      oFont:Release()
   ENDIF
Cria a lenta pra navegação, e se for com dialog cria a dialog.
O resto já conhecem.
Criei o NextBackColor() pra fornecer uma cor diferente a cada chamada pra usar como backcolor em cada panel.

Acho que tá mais simples do que se fosse ficar criando variáveis diferentes, com nomes diferentes, e navegação mais confusa.
Desse jeito dá até pra usar copiar/colar pra trocar a ordem de tudo, sem alteração extra no fonte.
José M. C. Quintas
Harbour 3.2, mingw, gtwvg mt, fivewin 25.04, multithread, dbfcdx, MySQL, ADOClass, PDFClass, SefazClass, (hwgui mt), (hmg3), (hmg extended), (oohg), PNotepad, ASP, stored procedure, stored function, Linux (Flagship/harbour 3.2)
"The world is full of kings and queens, who blind our eyes and steal our dreams Its Heaven and Hell"

https://github.com/JoseQuintas/
Avatar do usuário
Itamar M. Lins Jr.
Administrador
Administrador
Mensagens: 7928
Registrado em: 30 Mai 2007 11:31
Localização: Ilheus Bahia
Curtiu: 1 vez

Exemplo de lenta

Mensagem por Itamar M. Lins Jr. »

Olá!
Captura de imagem_20250508_150717.png
E dois erros no demoall
Captura de imagem_20250508_150841.png
Mas é esse op_fl.bmp

Saudações,
Itamar M. Lins Jr.
Saudações,
Itamar M. Lins Jr.
Avatar do usuário
JoséQuintas
Administrador
Administrador
Mensagens: 20267
Registrado em: 26 Fev 2007 11:59
Localização: São Paulo-SP

Exemplo de lenta

Mensagem por JoséQuintas »

Isso em GTK/Linux ?
José M. C. Quintas
Harbour 3.2, mingw, gtwvg mt, fivewin 25.04, multithread, dbfcdx, MySQL, ADOClass, PDFClass, SefazClass, (hwgui mt), (hmg3), (hmg extended), (oohg), PNotepad, ASP, stored procedure, stored function, Linux (Flagship/harbour 3.2)
"The world is full of kings and queens, who blind our eyes and steal our dreams Its Heaven and Hell"

https://github.com/JoseQuintas/
Avatar do usuário
JoséQuintas
Administrador
Administrador
Mensagens: 20267
Registrado em: 26 Fev 2007 11:59
Localização: São Paulo-SP

Exemplo de lenta

Mensagem por JoséQuintas »

Código: Selecionar todos

d:\github\hwgui\image>dir *fl.bmp
 O volume na unidade D é TRABALHO
 O Número de Série do Volume é C4CC-0221

 Pasta de d:\github\hwgui\image

25/04/2025  03:03               246 cl_fl.bmp
25/04/2025  03:03               246 op_fl.bmp
               2 arquivo(s)            492 bytes
               0 pasta(s)   90.572.615.680 bytes disponíveis
Estranho, elas estão lá.

Alterei a mensagem pra colocar um " or " entre os dois nomes.
Mas isso não resolve a mensagem.
José M. C. Quintas
Harbour 3.2, mingw, gtwvg mt, fivewin 25.04, multithread, dbfcdx, MySQL, ADOClass, PDFClass, SefazClass, (hwgui mt), (hmg3), (hmg extended), (oohg), PNotepad, ASP, stored procedure, stored function, Linux (Flagship/harbour 3.2)
"The world is full of kings and queens, who blind our eyes and steal our dreams Its Heaven and Hell"

https://github.com/JoseQuintas/
Avatar do usuário
JoséQuintas
Administrador
Administrador
Mensagens: 20267
Registrado em: 26 Fev 2007 11:59
Localização: São Paulo-SP

Exemplo de lenta

Mensagem por JoséQuintas »

Pra Linux tava errado, com barras erradas.
É no demosplitter.prg

Cheguei a colocar uma janela de debug no demoall, mas pode parecer bug deixar lá.
O demoall executa todos os exemplos, aí quando dá erro fica sem saber qual foi.
Talvez nessa mensagem acrescentar o nome do fonte, pra esses casos
José M. C. Quintas
Harbour 3.2, mingw, gtwvg mt, fivewin 25.04, multithread, dbfcdx, MySQL, ADOClass, PDFClass, SefazClass, (hwgui mt), (hmg3), (hmg extended), (oohg), PNotepad, ASP, stored procedure, stored function, Linux (Flagship/harbour 3.2)
"The world is full of kings and queens, who blind our eyes and steal our dreams Its Heaven and Hell"

https://github.com/JoseQuintas/
Responder