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 »

Está claro qual é o problema.
Quero criar o ownerbutton com a mesma cor de fundo da dialog, e parece impossível.
pegar oDlg:bColor não funciona, porque a janela não existe.
É lógico que se isso não funciona, também não vai funcionar pegar o handle ou qualquer outra coisa.
Qual a saída?
Sei lá... talvez criar janela invisível, como a gtwvg faz.
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/
Fernando queiroz
Usuário Nível 4
Usuário Nível 4
Mensagens: 779
Registrado em: 13 Nov 2014 00:41
Localização: Porto Alegre/RS

Ownerbutton styles/etc

Mensagem por Fernando queiroz »

Código: Selecionar todos

#define BrowseStyleHead             HStyle():New( { 4339747,4339747,4339747, 12632256 }, 1,, 0.4, 16759929 )
#define OwnerbuttonStyle            { HStyle():New( {0, 0}, 1,{8,8,8,8}, ),  HStyle():New( {0, 0, 0, 16777215}, 1,{8,8,8,8}, 0, 0 ), HStyle():New( {0, 0}, 1,{8,8,8,8},  ) }
#define OwnerbuttonStyleMenu        { HStyle():New( {0, 0}, 1,{8,8,8,8}, ),  HStyle():New( {0, 0, 0, 16777215}, 1,{8,8,8,8}, 0, 0 ), HStyle():New( {0, 0}, 1,{8,8,8,8},  ) }
#define OwnerbuttonStyleNoBorder    { HStyle():New( {0, 0}, 1,{8,8,8,8}, ),  HStyle():New( {0, 0, 0, 16777215}, 3,{8,8,8,8}, 0, 0 ), HStyle():New( {0, 0}, 1,{8,8,8,8},  ) }
#define OwnerbuttonLupa             { HStyle():New( {16777215}, 1,, ),  HStyle():New( {16777215}, 1,, 2, 0 ), HStyle():New( {16777215}, 1,  ) }	
#define OwnerbuttonPrinter          { HStyle():New( {16777215}, 1,, ),  HStyle():New( {16777215}, 1,, 2, 0 ), HStyle():New( {16777215}, 1,  ) }	
#define GradienteColor              {4339747,4339747,4339747, 4339747}
#define OwnerbuttonLogin1           { HStyle():New( {2631720}, 1,, 1 ), HStyle():New( {1842204}, 2,, 1 ), HStyle():New( {04210752}, 1,, 2, 16777215 ) }
#define OwnerbuttonLogin2           { HStyle():New( {0}, 1,, ),  HStyle():New( { 0}, 1,, 2, 16777215 ), HStyle():New( {0}, 1,, 2, 16777215  ) }
#define OwnerbuttonLogin3           { HStyle():New( {0},,,),  HStyle():New( { 0},,,, 16777215 ), HStyle():New( {0},,,,) }
#define PanelMenuColor              HStyle():New( { 4339747,4339747,4339747,4339747},, {8,8,8,8} )
#define BrowseBarColorPrimary       {0,16777215,16777215,8421504 }
#define BrowseBarColorSecondary     {255, 16777215 ,16777215,255 }
#define DashboardPanelColor         HStyle():New( { 4339747,4339747,4339747, 12632256}, 1, , 1, 16759929 )   
quintas tenho usado as cores assim , facilita as mudancas

criei um .ch de cores CORES.CH

Uso os OwnnerButton assim

Código: Selecionar todos

	@ 5,10 OWNERBUTTON oOwnerbutton1  OF oPanel1  SIZE 73,63 ;
			ON CLICK {|| ::CADASTRO_PRODUTOS_MANUTENCAO( "INCLUIR"  ), oPage1:oBrowse1:aArray := ::CADASTRO_PRODUTOS_MANUTENCAO_CARREGA( "ORDER BY " + cAlvo_Consulta ), ::CADASTRO_PRODUTOS_MANUTENCAO_onDlgInit( oDlg ), oPage1:obrowse1:REFRESH()};
			FLAT  ;
			TEXT 'Inclui' COLOR 16777215  ;
			COORDINATES 0, 40, 0, 0  ;
			BITMAP HBitmap():Addresource('add-file-256-30')    ;
			COORDINATES 0, 5, 0, 0  ;
			TOOLTIP 'Incluir novo Produto'
			oOwnerbutton1:aStyle := OwnerbuttonStyle
HARBOUR 3.2, HWGUI 2.23 B3, SEFAZCLASS, PDFClass, ADO + MariaDB/MySQL, RMChart
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 »

Muito bom isso mas.... cuidado
Assim confunde o que é variável ou #define, porque geralmente #define é tudo letra maiúscula
E se não usar compilação -w3 -es2.... vai ser complicado.

Lembre-se que esses defines vão deixar o fonte grande pra compilação, isso é diferente de variável.
Talvez assim:

Código: Selecionar todos

FUNCTION HStyleOwner(); RETURN ....
FUNCTION HStyleOwnerMenu(); RETURN ...
FUNCTION HStyleOwnerNoBorder(); RETURN ...
FUNCTION HStyleOwnerLupa(); RETURN ...
FUNCTION HStyleOwnerPrinter(); RETURN ...
FUNCTION HStyleOwnerLogin1(); RETURN ...
FUNCTION HStyleOwnerLogin2(); RETURN ...
FUNCTION HStyleOwnerLogin3(); RETURN ...
A diferença pode ser grande.
Imagine 1.000 componentes, com #define vai ter 1.000 vezes tudo aquilo no fonte.
Já com FUNCTION, vai ter uma vez só.
Se usa muito, só trocar e ver o tamanho do EXE no final.
O difícil pode ser encontrar nome único pra tudo, que não complique o uso, mas talvez ajude a chegar em algum padrão de uso interessante.

Outra opção seria criar os #defines para um número único, e ter uma função única:

Código: Selecionar todos

#define HSTYLE_OWNER 1
#define HSTYLE_OWNER_MENU 2
...
FUNCTION MyStyle( nOpc )
LOCAL hStyle
DO CASE
CASE nOpc == HSTYLE_OWNER; hStyle := ...
CASE nOpc == HSTYLE_OWNER_MENU; hStyle := ...
ENDCASE
RETURN hStyle
Vai usar muito, no aplicativo inteiro, melhor já ir pensando enquanto não aumenta o uso mais ainda.
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 »

Uia, amontoando geral:

Código: Selecionar todos

#define ZE_HSTYLE_OWNER 1
#define ZE_BACKCOLOR 2

Código: Selecionar todos

   INIT DIALOG ::oFrm CLIPPER NOEXIT TITLE ::cTitulo AT 20, 0 SIZE 800, 600 BACKCOLOR ze_Style( ZE_BACKCOLOR ) ON EXIT hwg_EndDialog()

Código: Selecionar todos

      oBtn:aStyle := ze_Style( ZE_HSTYLE_OWNER )

Código: Selecionar todos

FUNCTION ze_Style( nStyle )

   LOCAL xValue

   DO CASE
   CASE nStyle == ZE_HSTYLE_OWNER
      xValue := { ;
         HStyle():New({ze_Style(ZE_BACKCOLOR)},1), ;   /* normal color */
         HStyle():New({ze_Style(ZE_BACKCOLOR)},1,,3,0), ;       /* click color */
         HStyle():New({16759929,16771062},1,,2,12164479) } /* over color */
   CASE nStyle == ZE_BACKCOLOR
      xValue := 15790720
   ENDCASE

   RETURN xValue
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