clique no browse

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

clique no browse

Mensagem por JoséQuintas »

Código: Selecionar todos

FUNCTION gui_Browse( xDlg, xControl, nRow, nCol, nWidth, nHeight, oTbrowse, cField, xValue, workarea )

   LOCAL aItem

   @ nCol, nRow BROWSE xControl DATABASE SIZE nWidth, nHeight STYLE WS_BORDER + WS_VSCROLL + WS_HSCROLL

   FOR EACH aItem IN oTBrowse
      ADD COLUMN { || Transform( FieldGet( FieldNum( aItem[2] ) ), aItem[3] ) } TO xControl ;
         HEADER aItem[1] ;
         LENGTH Max( Len( aItem[1] ), Len( Transform( FieldGet( FieldNum( aItem[2] ) ), aItem[3] ) ) ) ;
         JUSTIFY LINE DT_LEFT
   NEXT

   xControl:bOther := { |xControl, msg, wParam, lParam| gui_BrowseKeyDown( xControl, msg, wParam, lParam, cField, @xValue ) }

   (xDlg); (workarea)

   RETURN Nil

STATIC FUNCTION gui_BrowseKeyDown( xControl, msg, wParam, lParam, cField, xValue )

   LOCAL nKEY

   IF msg == WM_KEYDOWN
      nKey := hwg_PtrToUlong( wParam )
      IF nKey = VK_RETURN
         IF ! Empty( cField )
            xValue := FieldGet( FieldNum( cField, xValue ) )
         ENDIF
         hwg_EndDialog()
      ENDIF
   ENDIF
   (xControl)
   (lParam)

   RETURN .T.
ENTER ok, agora como fazer funcionar com clique do mouse.
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

clique no browse

Mensagem por alxsts »

Olá!
@ <x>,<y> BROWSE <oBrowse>
[ ARRAY ]
[ DATABASE ] && Default
[ OF <oWnd> ];
[ ID <nId> ]
[ SIZE <width>, <height> ]
[ ON INIT <bInit> ]
[ ON SIZE <bSize> ]
[ ON PAINT <bDraw> ]
[ ON CLICK <bClick> ]
[ ON RIGHTCLICK <bRClick> ]
[ ON GETFOCUS <bGetFocus> ]
[ ON LOSTFOCUS <bLostFocus> ]
[ STYLE <nStyle> ]
[ <lNoVScr: NO VSCROLL> ]
[ <lNoBord: NO BORDER> ]
[ FONT <oFont> ]
[ APPEND ]
[ AUTOEDIT ]
[ ON UPDATE <bUpdate> ]
[ ON KEYDOWN <bKeyDown> ]
[ ON POSCHANGE <bPosChg> ]
[ MULTISELECT ]
É só associar codeblocks às propriedades bClick e bRClick...
[]´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

clique no browse

Mensagem por JoséQuintas »

Não sei qual o codeblock correto, pelo menos este de bOther não serviu.
Em bOther funciona o ENTER.

Código: Selecionar todos

FUNCTION gui_Browse( xDlg, xControl, nRow, nCol, nWidth, nHeight, oTbrowse, cField, xValue, workarea )

   LOCAL aItem

   @ nCol, nRow BROWSE xControl DATABASE SIZE nWidth, nHeight STYLE WS_BORDER + WS_VSCROLL + WS_HSCROLL

   FOR EACH aItem IN oTBrowse
      ADD COLUMN { || Transform( FieldGet( FieldNum( aItem[2] ) ), aItem[3] ) } TO xControl ;
         HEADER aItem[1] ;
         LENGTH Max( Len( aItem[1] ), Len( Transform( FieldGet( FieldNum( aItem[2] ) ), aItem[3] ) ) ) ;
         JUSTIFY LINE DT_LEFT
   NEXT

   xControl:bOther := { |xControl, msg, wParam, lParam| gui_BrowseKeyDown( xControl, msg, wParam, lParam, cField, @xValue ) }

   (xDlg); (workarea)

   RETURN Nil

STATIC FUNCTION gui_BrowseKeyDown( xControl, msg, wParam, lParam, cField, xValue )

   LOCAL nKEY

   IF msg == WM_KEYDOWN
      nKey := hwg_PtrToUlong( wParam )
      IF nKey = VK_RETURN
         IF ! Empty( cField )
            xValue := FieldGet( FieldNum( cField, xValue ) )
         ENDIF
         hwg_EndDialog()
      ENDIF
   ENDIF
   (xControl)
   (lParam)

   RETURN .T.
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

clique no browse

Mensagem por JoséQuintas »

Tinha deixado de lado, agora voltei nele.

Três meses depois, o click no browse ainda não funciona.

HWGUI versão atual.

ON CLICK não resolveu - consta no doc
bClick não resolveu - consta no doc apenas como parâmetro
bEnter não resolveu - consta no fonte como método pra browse
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

clique no browse

Mensagem por JoséQuintas »

Para keydown, não precisa bOther.

Ficou chatinho, mas funcionou.

Código: Selecionar todos

      aKeyCodeList:= { { VK_RETURN, { || gui_BrowseEnter( cField, @xValue, xDlg, xControl ) } } }
...
   xControl:bKeyDown := { | o, k, nPos | nKey := k, ;
                          nPos := hb_ASCan( aKeyCodeList, { | e | e[1] == nkey } ), ;
                          Eval( iif( nPos == 0, {||Nil}, aKeyCodeList[ nPos, 2] ) ), ;
                          (o), (nKey) }
Num uso pra valer, com certeza não usaria isso.
E ainda precisa declarar LOCAL que não fiz.

Ainda pendente o click do mouse.
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

clique no browse

Mensagem por Fernando queiroz »

uso assim

Código: Selecionar todos

@ 2,30 BROWSE oBrowse1 ARRAY  OF oPage1  SIZE 1018,420 STYLE WS_BORDER + WS_VSCROLL + WS_HSCROLL ;
								ON CLICK {|| ::nProdutos_Id:=LTRIM(str(oDlg:oPage1:oBrowse1:aArray[ oDlg:oPage1:oBrowse1:nCurrent, 1])) ,  ::MANUTENCAO( "ALTERAR" ) , oDlg:oPage1:oBrowse1:aArray := ::MANUTENCAO_CARREGA( "ORDER BY " + cAlvo_Consulta ), oPage1:obrowse1:REFRESH()};
								ON KEYDOWN { | oBrowse1, nKeyPress | ::MANUTENCAO_onKeyDown( oDlg, oBrowse1, nKeyPress,  @cProgressKey ) };
								ON POSCHANGE {|| if(empty(oBrowse1:aArray), ,::nProdutos_Id:=LTRIM(str(oDlg:oPage1:oBrowse1:aArray[ oDlg:oPage1:oBrowse1:nCurrent, 1]))) }
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

clique no browse

Mensagem por JoséQuintas »

À primeira vista, com array ou ADO funciona, com DBF não.
Fiz um teste com ADO e funcionou.
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

clique no browse

Mensagem por JoséQuintas »

Coloquei hwg_MsgInfo() em tudo que é lugar, até mesmo na rotina de eventos do hbrowse, na parte de mouse e tecla.
Não aparece nunca.

Alguém por aí tem browse de dbf onde funciona o click no browse ?
Quero saber se alguém usa e funciona, com hwgui 2.23
Aqui esgotaram-se as tentativas.
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

clique no browse

Mensagem por alxsts »

Olá!
JoséQuintas escreveu:Quero saber se alguém usa e funciona, com hwgui 2.23
O Fernando postou acima o código que ele usa e informa que usa a verão 2.23. Deve funcionar para ele...

Teste especificando o alias no controle browse:

Código: Selecionar todos

xControl:alias := <nome do alias>
[]´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

clique no browse

Mensagem por JoséQuintas »

Desculpem, nenhum teste atual foi válido.
Tinha alterado o projeto pra lib, pra outros testes.
O EXE que eu estava executando não era atualizado.

Agora arrumar a bagunça, por conta de várias alterações sem teste válido.
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

clique no browse

Mensagem por JoséQuintas »

Só pra finalizar o post., ficou assim:

Código: Selecionar todos

   @ nCol, nRow BROWSE xControl DATABASE SIZE nWidth, nHeight STYLE WS_BORDER + WS_VSCROLL + WS_HSCROLL ;
   ON CLICK { |...| gui_browseenter( @cField, @xValue, @xDlg, @xControl ), .F. }
...
   xControl:bKeyDown := { | o, nKey | (o), ;
      gui_browsekeydown( xControl, xDlg, nKey, cField, workarea, xvalue, aKeyCodeList ) }
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