Bostaurus & Handle

Projeto MiniGui - 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

Bostaurus & Handle

Mensagem por JoséQuintas »

Dúvida:

É a bostaurus que não aceita handle em formato handle, ou esse handle não é handle?
Pelo menos que eu saiba, handle não é numérico....
wnd.png
wnd2.png
Nota: a imagem cortou, ValType() retorna "P"
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

Bostaurus & Handle

Mensagem por JoséQuintas »

É.... precisei usar função pra converter pointer para numérico....
GTWVG trabalha com pointer, mas HMG/Bostaurus trabalham com pointer convertido pra número...
wnd3.png
A propósito... essa é a função "supostamente" removida da biblioteca de compatibilidade com XHarbour.
Continua lá, só mudou o nome.... rs
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/
Claudio Soto
Colaborador
Colaborador
Mensagens: 566
Registrado em: 27 Ago 2012 12:31
Localização: Uruguay
Contato:

Bostaurus & Handle

Mensagem por Claudio Soto »

Un handle es una referencia a algún objeto, puede ser un puntero,un número o la posición en una tabla de símbolos, etc. Todo depende de como se implemente el sistema, en Windows los handle en general son algún tipo de puntero. En BT fue desarrollado para "servir" a HMG y por lo tanto trabaja con handle transformados en número, ej win_P2N ()

viewtopic.php?f=43&t=18879&p=120753&hilit=VoID&sid=ad2155813337e83a1c52c0dafd80f755#p120753
Saludos.
Dr. Claudio Soto
(Uruguay)
http://srvet.blogspot.com
Avatar do usuário
JoséQuintas
Administrador
Administrador
Mensagens: 20267
Registrado em: 26 Fev 2007 11:59
Localização: São Paulo-SP

Bostaurus & Handle

Mensagem por JoséQuintas »

Pois é, depende de como está no fonte C, e olhando o PRG não dá pra saber qual é o formato.

Funcionou o texto, mas não a cor de fundo.

À primeira vista, o HDC é o mesmo, mas não faço a menor idéia se a janela GTWVG tem algum Style diferente que não permite o gradiente.
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

Bostaurus & Handle

Mensagem por JoséQuintas »

Erro meu, acrescentei o parâmetro na função, mas esqueci de passar o parâmetro Cont.... rs
tela1.png
tela2.png
É o mesmo exemplo da HMG3, apenas troquei a janela por uma da GTWVG, e o GET só como uma forma rápida de ter pausa.

Código: Selecionar todos

#include "inkey.ch"
#include "bostaurus.ch"
#include "i_color.ch"

#define MYWIN_HANDLE __xhb_p2n( wvgSetAppWindow():hWnd )

FUNCTION MAIN

   LOCAL nCont := 6, A := " ", GetList := {}

   wvt_SetGui( .T. )
   SetMode(25,80)
   CLS
   DO WHILE .T.
      @ 1, 1 GET A
      READ
      IF LastKey() == K_ESC
         EXIT
      ENDIF
      nCont := iif( nCont >= 6, 1, nCont + 1 )
      ? MYWIN_HANDLE
      ? ValType( MYWIN_HANDLE )
      Inkey(0)
      BT_ClientAreaInvalidateAll( MYWIN_HANDLE )
      Proc_On_Paint( nCont )
   ENDDO

   RETURN NIL


PROCEDURE Proc_ON_PAINT( Cont )

   LOCAL Width  := BT_ClientAreaWidth( MYWIN_HANDLE )
   LOCAL Height := BT_ClientAreaHeight( MYWIN_HANDLE )
   LOCAL hDC, BTstruct, nAlignText, nTypeText

   hDC = BT_CreateDC ( MYWIN_HANDLE, BT_HDC_INVALIDCLIENTAREA, @BTstruct)

   DO CASE
   CASE cont = 1
      BT_DrawGradientFillHorizontal (hDC, 0,       0, Width/2, Height, BLACK, BLUE)
      BT_DrawGradientFillHorizontal (hDC, 0, Width/2, Width/2, Height, BLUE,  BLACK)

   CASE cont = 2
      BT_DrawGradientFillVertical (hDC,        0,   0, Width, Height/2, BLACK, RED)
      BT_DrawGradientFillVertical (hDC, Height/2,   0, Width, Height/2, RED,   BLACK)

   CASE cont = 3
      BT_DrawGradientFillVertical (hDC,        0,   0, Width, Height/2, RED,   GREEN)
      BT_DrawGradientFillVertical (hDC, Height/2,   0, Width, Height/2, GREEN, BLUE)

   CASE cont = 4
      BT_DrawGradientFillHorizontal (hDC, 0,       0, Width/2, Height, GREEN, BLUE)
      BT_DrawGradientFillHorizontal (hDC, 0, Width/2, Width/2, Height, BLUE,  RED)

   CASE cont = 5
      BT_DrawGradientFillVertical   (hDC,   0,       0,  Width,  Height, WHITE, BLACK)

   CASE cont = 6
      BT_DrawGradientFillHorizontal (hDC,   0,       0,  Width,  Height, {100,0,123}, BLACK)

   END CASE

   nTypeText  := BT_TEXT_TRANSPARENT + BT_TEXT_BOLD + BT_TEXT_ITALIC + BT_TEXT_UNDERLINE
   nAlignText := BT_TEXT_CENTER + BT_TEXT_BASELINE
   BT_DrawText (hDC, Height/2-3, Width/2+3, "The Power of HMG", "Comic Sans MS", 42, GRAY, BLACK, nTypeText, nAlignText ) // Shadow Effect
   BT_DrawText (hDC, Height/2, Width/2, "The Power of HMG", "Comic Sans MS", 42, YELLOW, BLACK, nTypeText, nAlignText )

   BT_DeleteDC (BTstruct)

   RETURN
O nome da janela é porque é o nome do EXE, não foi proposital.
É que outro fonte que acrescentei foi este, justamente o que chamei de lixo.prg, e na hora que compilei assumiu esse nome.

Código: Selecionar todos

FUNCTION CallDll32(...); RETURN CallDll(...)
FUNCTION Win_P2N(a,...); RETURN __xhb_p2n( a )
//FUNCTION hb_IsNil(a); RETURN a == NIL
FUNCTION hb_OsNewLine(); RETURN hb_Eol()
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

Bostaurus & Handle

Mensagem por JoséQuintas »

Só pra completar....

Não sei no Harbour 3.2, 3.4 e HMG3 normais... mas aqui compilei assim:

C.BAT hmg3.hbc GTWVG.hbc -lxhb

C.BAT é minha compilação padrão, que pega todos os PRGs ou HBPs da pasta
HBMK.HBC minha configuração padrão do Harbour
HMG3.HBC pra acrescentar HMG3 (óbvio)
GTWVG.HBC idem pra GTWVG (óbvio)
-lxhb é a lib de compatibilidade com XHarbour

Usei Harbour 3.4
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

Bostaurus & Handle

Mensagem por JoséQuintas »

Compliquei um pouquinho.... usei meu retângulo de base... 4 vezes...

Código: Selecionar todos

FUNCTION MAIN

   LOCAL nCont := 6, A := " ", GetList := {}, oWin := { NIL, NIL, NIL, NIL }, oJanela

   wvt_SetGui( .T. )
   SetMode(25,80)
   CLS
   oWin[ 1 ] := wvgtstRectangle():New( , , { -1, -1 }, { -12, -40 } )
   oWin[ 1 ]:Create()
   oWin[ 2 ] := wvgtstRectangle():New( , , { -1, -41 }, { -12, -40 } )
   oWin[ 2 ]:Create()
   oWin[ 3 ] := wvgtstRectangle():New( , , { -13, -1 }, { -12, -40 } )
   oWin[ 3 ]:Create()
   oWin[ 4 ] := wvgtstRectangle():New( , , { -13, -41 }, { -12, -40 } )
   oWin[ 4 ]:Create()
   DO WHILE .T.
      @ 1, 1 GET A
      READ
      IF LastKey() == K_ESC
         EXIT
      ENDIF
      //? MYWIN_HANDLE
      //? ValType( MYWIN_HANDLE )
      Inkey(0)
      FOR EACH oJanela IN oWin
         nCont := iif( nCont >= 6, 1, nCont + 1 )
         BT_ClientAreaInvalidateAll( __xhb_p2n( oJanela:hWnd ) )
         Proc_On_Paint( nCont, __xhb_p2n( oJanela:hWnd ) )
      NEXT
   ENDDO

   RETURN NIL
tela3.png
Tive que acrescentar josequintas.hbc, que é aonde está o wvgTstRectangle()
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