Clipper On Line • Ver Tópico - Ownerbutton styles/etc

Ownerbutton styles/etc

Projeto HwGui - Biblioteca visual para Harbour/xHarbour

Moderador: Moderadores

 

Ownerbutton styles/etc

Mensagempor JoséQuintas » 01 Nov 2021 01:04

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, multithread, dbfcdx, ADO+MySql, PNotepad
"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 de usuário

JoséQuintas
Membro Master

Membro Master
 
Mensagens: 18009
Data de registro: 26 Fev 2007 11:59
Cidade/Estado: São Paulo-SP
Curtiu: 15 vezes
Mens.Curtidas: 1206 vezes

Ownerbutton styles/etc

Mensagempor Fernando queiroz » 02 Nov 2021 09:57

#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
   @ 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
Fernando queiroz
Usuário Nível 4

Usuário Nível 4
 
Mensagens: 737
Data de registro: 12 Nov 2014 23:41
Cidade/Estado: Porto Alegre/RS
Curtiu: 12 vezes
Mens.Curtidas: 58 vezes

Ownerbutton styles/etc

Mensagempor JoséQuintas » 02 Nov 2021 12:19

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:

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:
#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, multithread, dbfcdx, ADO+MySql, PNotepad
"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 de usuário

JoséQuintas
Membro Master

Membro Master
 
Mensagens: 18009
Data de registro: 26 Fev 2007 11:59
Cidade/Estado: São Paulo-SP
Curtiu: 15 vezes
Mens.Curtidas: 1206 vezes

Ownerbutton styles/etc

Mensagempor JoséQuintas » 02 Nov 2021 13:22

Uia, amontoando geral:

#define ZE_HSTYLE_OWNER 1
#define ZE_BACKCOLOR 2

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

      oBtn:aStyle := ze_Style( ZE_HSTYLE_OWNER )

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, multithread, dbfcdx, ADO+MySql, PNotepad
"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 de usuário

JoséQuintas
Membro Master

Membro Master
 
Mensagens: 18009
Data de registro: 26 Fev 2007 11:59
Cidade/Estado: São Paulo-SP
Curtiu: 15 vezes
Mens.Curtidas: 1206 vezes

Anterior



Retornar para HwGui

Quem está online

Usuários vendo este fórum: Nenhum usuário registrado online e 5 visitantes


Ola Amigo, espero que meu site e forum tem lhe beneficiado, com exemplos e dicas de programacao.
Entao divulgue o link da Doacao abaixo para seus amigos e redes sociais ou faça uma doacao para o site forum...
MUITO OBRIGADO PELA SUA DOACAO!
Faça uma doação para o forum
cron
v
Olá visitante, seja bem-vindo ao Fórum Clipper On Line!
Efetue o seu login ou faça o seu Registro