Ownerbutton styles/etc

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

Ownerbutton styles/etc

Mensagem por JoséQuintas »

Aonde encontro informação sobre quais styles existem, ou que coordenadas são necessárias para o texto, etc.

Quero ele transparente, e com texto, mas tá difícil encontrar informação, tanto na documentação, includes, prg, etc.

Coloquei posição de texto, mas tá difícil ficar chutando pra descobrir a posição correta.

tamanho 50, 50
posição ... agora vou chutar 5, 5, 10, 10, e depois aumentar de 1 em 1 pra ver o que acontece.
agora style... dependendo do que colocar, nem abre a janela.

Código: Selecionar todos

      @ nCol, nRow OWNERBUTTON SIZE 55,55 ;
         ON CLICK bCode ;
         HSTYLES { TRANSPARENT } ;
         BITMAP HICON():AddResource( IconFromCaption( cCaption ), 50, 50 ) ;
         TEXT cCaption COORDINATES 5, 5, 10, 10 ;
         Tooltip cCaption
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

Ownerbutton styles/etc

Mensagem por JoséQuintas »

hwgui.png
Tá complicado.
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

Ownerbutton styles/etc

Mensagem por JoséQuintas »

ide.png
Lembrei da IDE, mas também não ajuda.
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/
alxsts
Colaborador
Colaborador
Mensagens: 3092
Registrado em: 12 Ago 2008 15:50
Localização: São Paulo-SP-Brasil

Ownerbutton styles/etc

Mensagem por alxsts »

Olá!

Não sei se ajuda mas, tem um exemplo no Tutorial (C:\hwgui\utils\tutorial\tutor.exe).
Anexos
Capturar.JPG
[]´s
Alexandre Santos (AlxSts)
Avatar do usuário
JoséQuintas
Administrador
Administrador
Mensagens: 20267
Registrado em: 26 Fev 2007 11:59
Localização: São Paulo-SP

Ownerbutton styles/etc

Mensagem por JoséQuintas »

ide.png
Achei a janela da ide, tava escondida no outro canto....
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

Ownerbutton styles/etc

Mensagem por JoséQuintas »

Ok, encontrei o EXE de tutorial.

Pode ser bom pra mostrar minha mudança também.

E poderia ser bom colocar no lugar de todos os exemplos.
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

Ownerbutton styles/etc

Mensagem por JoséQuintas »

Isso me deu uma grande idéia.

É só fazer fonte igual GTWVG, e tudo está resolvido.
Depois eu mostro, e provavelmente vão concordar.
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

Ownerbutton styles/etc

Mensagem por JoséQuintas »

Não resisti... uma prévia:

Com certeza, todo aplicativo vai seguir um padrão.

Então, ao invés de:

Código: Selecionar todos

      oStyleNormal  := HStyle():New({16759929,16772062},1)
      oStylePressed := HStyle():New({16759929},1,,3,0)
      oStyleOver    := HStyle():New({16759929},1,,2,12164479)
      @ nCol, nRow OWNERBUTTON SIZE 55,55 ;
         ON CLICK bCode ;
         BITMAP HICON():AddResource( IconFromCaption( cCaption ), 40, 40 ) ;
         HSTYLES oStyleNormal, oStylePressed, oStyleOver ;
         TEXT cCaption COORDINATES 5,35, 5, 40 ;
         Tooltip cCaption
Podemos usar:

Código: Selecionar todos

Meubutton( nCol, nRow, cCaption, cIcon )
E colocamos nessa função a criação com toda a tranqueirada padrão.
Nem vai precisar ser igual gtwvg, fica mais fácil ainda.

Vamos poder trocar até de button pra owner button, ou nice button, ou o que aparecer depois.
Ou trocar todo visual do aplicativo mexendo em apenas algumas funções.
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

Ownerbutton styles/etc

Mensagem por JoséQuintas »

Ou assim talvez dê certo, se não houver conflito:

Código: Selecionar todos

#include "hbclass.ch"
#include "hwgui.ch"

CREATE CLASS Button INHERIT HOWNBUTTON, MeuControle
   METHOD Create( nRow, nCol, nWidth, nHeight, cCaption, cIcon, bClick )
   METHOD Show()
   ENDCLASS

CREATE CLASS Dialog INHERIT HDIALOG, MeuControle
   METHOD Create( nRow, nCol, nWidth, nHeight, cCaption, cIcon, bClick )
   METHOD Show( lModal )
   ENDCLASS

CREATE CLASS MeuControle
   VAR nRow     INIT 0
   VAR nCol     INIT 0
   VAR nWidth   INIT 55
   VAR nHeight  INIT 55
   VAR cCaption INIT "button"
   VAR cIcon    INIT ""
   VAR bOnLoad  INIT Nil
   VAR bOnEnd   INIT Nil
   ENDCLASS
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

Ownerbutton styles/etc

Mensagem por JoséQuintas »

É por isso que eu evito LIB gráfica...
Não aguento, e fico querendo mexer.
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

Ownerbutton styles/etc

Mensagem por Itamar M. Lins Jr. »

Olá!
Esse HSTYLES é novo.
Tem o STYLES que usamos no SAY, GET para colocar na esquerda, direita, minúsculas...

Código: Selecionar todos

 @ 750,600 OwnerButton oBtDel of oDlg Size 68,68 ;
     ON CLICK {||Apagar(oDlg)} FLAT BITMAP oImgLixo FROM RESOURCE TRANSPARENT Coordinates 0,0,68,68 TOOLTIP "Apagar Lançamento"

Código: Selecionar todos

     @ 420,415 say "NCM:" SIZE 060,20 TRANSPARENT
     @ 420,430 get oNCM var cNCM picture "99999999" size 70,20 STYLE ES_LEFT
Na pasta include\windows.ch tem as definições.

Código: Selecionar todos

/*
 * Edit Control Styles
 */
#define ES_LEFT             0
#define ES_CENTER           1
#define ES_RIGHT            2
#define ES_MULTILINE        4
#define ES_UPPERCASE        8
#define ES_LOWERCASE        16
#define ES_PASSWORD         32
#define ES_AUTOVSCROLL      64
#define ES_AUTOHSCROLL      128
#define ES_NOHIDESEL        256
#define ES_OEMCONVERT       1024
#define ES_READONLY         2048       // 0x0800L
#define ES_WANTRETURN       4096       // 0x1000L
#define ES_NUMBER           8192       // 0x2000L
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

Ownerbutton styles/etc

Mensagem por JoséQuintas »

Foi o que pensei, mas não tem nada a ver.

Código: Selecionar todos

      oStyleNormal  := HStyle():New({16759929,16772062},1)
      oStylePressed := HStyle():New({16759929},1,,3,0)
      oStyleOver    := HStyle():New({16759929},1,,2,12164479)
      @ nCol, nRow OWNERBUTTON SIZE 55,55 ;
         ON CLICK bCode ;
         BITMAP HICON():AddResource( IconFromCaption( cCaption ), 40, 40 ) ;
         HSTYLES oStyleNormal, oStylePressed, oStyleOver ;
         TEXT cCaption COORDINATES 5,35, 5, 40 ;
         Tooltip cCaption
owner.png
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

Ownerbutton styles/etc

Mensagem por JoséQuintas »

Código: Selecionar todos

CLASS HStyle INHERIT HObject

   CLASS VAR aStyles   INIT { }

   DATA id
   DATA nOrient
   DATA aColors
   DATA oBitmap
   DATA nBorder
   DATA tColor
   DATA oPen
   DATA aCorners

   METHOD New( aColors, nOrient, aCorners, nBorder, tColor, oBitmap )
   METHOD Draw( hDC, nLeft, nTop, nRight, nBottom )
ENDCLASS

METHOD New( aColors, nOrient, aCorners, nBorder, tColor, oBitmap ) CLASS HStyle

   LOCAL i, nlen := Len( ::aStyles )

   nBorder := Iif( nBorder == Nil, 0, nBorder )
   tColor := Iif( tColor == Nil, -1, tColor )
   nOrient := Iif( nOrient == Nil .OR. nOrient > 9, 1, nOrient )

   FOR i := 1 TO nlen
      IF hwg_aCompare( ::aStyles[i]:aColors, aColors ) .AND. ;
         hwg_aCompare( ::aStyles[i]:aCorners, aCorners ) .AND. ;
         Valtype(::aStyles[i]:tColor) == Valtype(tColor) .AND. ;
         ::aStyles[i]:nBorder == nBorder .AND. ;
         ::aStyles[i]:tColor == tColor .AND. ;
         ::aStyles[i]:nOrient == nOrient .AND. ;
         ( ( ::aStyles[i]:oBitmap == Nil .AND. oBitmap == Nil ) .OR. ;
         ( ::aStyles[i]:oBitmap != Nil .AND. oBitmap != Nil .AND. ::aStyles[i]:oBitmap:name == oBitmap:name ) )

         RETURN ::aStyles[ i ]
      ENDIF
   NEXT

   ::aColors  := aColors
   ::nOrient  := nOrient
   ::nBorder  := nBorder
   ::tColor   := tColor
   ::aCorners := aCorners
   ::oBitmap := oBitmap
   IF nBorder > 0
      ::oPen := HPen():Add( BS_SOLID, nBorder, tColor )
   ENDIF

   AAdd( ::aStyles, Self )
   ::id := Len( ::aStyles )

   RETURN Self

METHOD Draw( hDC, nLeft, nTop, nRight, nBottom ) CLASS HStyle

   IF ::oBitmap == Nil
      hwg_drawGradient( hDC, nLeft, nTop, nRight, nBottom, ::nOrient, ::aColors,, ::aCorners )
   ELSE
      hwg_SpreadBitmap( hDC, ::oBitmap:handle, nLeft, nTop, nRight, nBottom )
   ENDIF

   IF !Empty( ::oPen )
      hwg_Selectobject( hDC, ::oPen:handle )
      hwg_Rectangle( hDC, nLeft, nTop, nRight-1, nBottom-1 )
   ENDIF

   RETURN Nil
Esse HStyle faz o desenho da janela, seja controle ou Dialog mesmo.
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

Ownerbutton styles/etc

Mensagem por JoséQuintas »

E acho que tem um problema nisso aí...

Quando é que isso é destruído? nunca?

CLASS VAR significa que a lista vai sempre aumentar....

E esse IF apenas impede que existam duplicados.
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

Ownerbutton styles/etc

Mensagem por JoséQuintas »

Também deu certo assim.
Precisou só da variável do buttom.
Somente não é didático, porque não mostra pra que serve cada HStyle.

Código: Selecionar todos

      @ nCol, nRow OWNERBUTTON oBtn SIZE 55,55 ;
         ON CLICK bCode ;
         BITMAP HICON():AddResource( IconFromCaption( cCaption ), 40, 40 ) ;
         TEXT cCaption COORDINATES 5,35, 5, 40 ;
         Tooltip cCaption
      oBtn:aStyle := { HStyle():New({16759929,16772062},1), ;
                       HStyle():New({16759929},1,,3,0), ;
                       HStyle():New({16759929},1,,2,12164479) }
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