Mais outro teste daqueles
Enviado: 26 Mai 2025 13:03
Mais outro teste daqueles....
Vamos por partes, ou por fonte....
demo.ch
Apenas faz o include conforme a lib utilizada: hmg3, hmge, ou oohg
demoaux.prg
Criação de tab e tabpage
Aí começa a brincadeira.
demoa.prg
O exemplo que cria buttons pra clicar.
Compilando esses acima......
A HMG3 já se perde.
Tudo bem com HMGE e OOHG
As cores, sei lá, não me preocupei em entender porque não funciona o recurso que existe (ou parece que existe)
Vamos por partes, ou por fonte....
demo.ch
Apenas faz o include conforme a lib utilizada: hmg3, hmge, ou oohg
Código: Selecionar todos
#ifdef HBMK_HAS_HMG3
#include "minigui.ch"
MEMVAR _HMG_SYSDATA
#endif
#ifdef HBMK_HAS_HMGE
#include "minigui.ch"
#endif
#ifdef HBMK_HAS_OOHG
#include "oohg.ch"
#endif
Criação de tab e tabpage
Código: Selecionar todos
/*
demo_buildtabs.prg
*/
#include "demo.ch"
FUNCTION demo_BuildTabs( xDlg, aOptionList, nRow )
LOCAL aOption, xTab
DEFINE TAB ( xTab := ze_Name( "TAB" ) ) ;
OF ( xDlg ) ;
AT nRow, 60 ;
WIDTH 900 ;
HEIGHT 600
FOR EACH aOption IN aOptionList
PAGE aOption[ 1 ]
Eval( aOption[ 3 ], xDlg )
END PAGE
NEXT
END TAB
(xTab)
RETURN Nil
FUNCTION ze_name( cTipo )
STATIC nIndex := 0
nIndex += 1
RETURN cTipo + Ltrim( Str( nIndex ) )
FUNCTION ze_ListEval( aEvalList )
LOCAL bCode
FOR EACH bCode IN aEvalList
Eval( bCode )
NEXT
RETURN Nil
demoa.prg
O exemplo que cria buttons pra clicar.
Código: Selecionar todos
/*
test codeblock
Based on sample of Valteçom - Uberaba - MG - Brasil
*/
#include "demo.ch"
// don't initialize values here
STATIC nRowPos, nColPos
FUNCTION DemoA( lWithDialog, xDlg )
LOCAL aList := {}, nCont, nTable, xButton
hb_Default( @lWithDialog, .T. )
nColPos := -1
nRowPos := -1
FOR nCont = 1 TO 35
AAdd( aList, nCont + 50 )
NEXT
IF lWithDialog
DEFINE WINDOW ( xDlg := "DLGANY" ) ;
AT 0,0 ;
WIDTH 1000 ;
HEIGHT 500 ;
MAIN;
TITLE 'demoa' ;
NOSIZE ;
NOMAXIMIZE
END WINDOW
ENDIF
FOR nCont := 1 TO Len( aList )
// two variables uniques
FOR EACH nTable, xButton IN { Nil }, { Nil }
nTable := aList[ nCont ]
xButton := ze_Name( "BTN" )
RowPos( xDlg )
@ nRowPos, nColPos BUTTON ( xButton ) ;
PARENT ( xDlg ) ;
CAPTION iif( Mod( nCont, 2 ) == 0, "Table ", "Room " ) + CRLF + StrZero( nTable, 2 ) ;
; // ICON iif( Mod( nCont, 2 ) == 0, "icotable.ico", "icohouse.ico" ) ;
; // BACKCOLOR GREEN ;
; // FLAT ;
WIDTH 120 ;
HEIGHT 60 ;
; // TEXTALIGNH RIGHT ;
ACTION ShowTable( xDlg, nTable, xButton )
NEXT
NEXT
IF lWithDialog
CENTER WINDOW ( xDlg )
ACTIVATE WINDOW ( xDlg )
ENDIF
RETURN Nil
STATIC FUNCTION RowPos( xDlg )
IF nColPos == -1
nRowPos := 35
nColPos := 5
ELSE
nColPos += 125
IF nColPos > GetProperty( xDlg, "width" ) - 200
nRowPos += 65
nColPos := 5
ENDIF
ENDIF
RETURN nRowPos
STATIC FUNCTION ShowTable( xDlg, nTable, xButton )
MsgInfo( "Table " + StrZero( nTable, 2 ) + " clicked" )
IF ArrayEqual( GetProperty( xDlg, xButton, "BACKCOLOR" ), RED )
SetProperty( xDlg, xButton, "BACKCOLOR", GREEN )
ELSE
SetProperty( xDlg, xButton, "BACKCOLOR", RED )
ENDIF
RETURN Nil
STATIC FUNCTION ArrayEqual( a, b )
LOCAL nCont
IF ValType( A ) != "A" .OR. ValType( B ) != "A"
RETURN .F.
ENDIF
IF Len( A ) != Len( B )
RETURN .F.
ENDIF
FOR nCont = 1 TO Len( A )
IF ! A[ nCont ] == B[ nCont ]
RETURN .F.
ENDIF
NEXT
RETURN .T.
A HMG3 já se perde.
A HMG3 considera WINDOW (xDlg) como sendo função.hbmk2: Error: Referenced, missing, but unknown function(s): WINDOW()
Tudo bem com HMGE e OOHG
As cores, sei lá, não me preocupei em entender porque não funciona o recurso que existe (ou parece que existe)