Façam as adaptações necessárias.
Código: Selecionar todos
aOpcao:={}
aAdd(aOpcao, {"1. Cadastrar Analista/Acesso ", "Permite cadastrar ou recadastrar um analista/acesso na base de desenvolvimento."})
aAdd(aOpcao, {"2. Cadastrar Usuário/Senha ", "Permite atribuir senha a um usuário para teste."})
aAdd(aOpcao, {"3. Importar Tarefas Produção ", "Permite importar as tarefas de produção para desenvolvimento."})
aAdd(aOpcao, {"4. Atualizar Situação Sistema ", "Permite atualizar a Situação de um Sistema a partir da produção."})
aAdd(aOpcao, {"5. Colocar/Tirar de Manutenção ", "Permite colocar ou retirar sistema em manutenção."})
aAdd(aOpcao, {"6. teste 1 "})
aAdd(aOpcao, {"7. teste 2 ", "Menssagem 2"})
nOpcao := AchoiceGui(aOpcao, "Opções do Cadastra", "Ok", "Sair", "", 1, 24)
Código: Selecionar todos
#include "windows.ch"
#include "hwgui.ch"
#include "common.ch"
#include "guilib.ch"
#include "wvgparts.ch"
#include "hbgtinfo.ch"
#define WM_USER 0x0400
#define TTM_SETTITLE (WM_USER + 32)
#define TTI_NONE 0
#define TTI_INFO 1
#define TTI_WARNING 2
#define TTI_ERROR 3
#define TTI_INFO_LARGE 4
#define TTI_WARNING_LARGE 5
#define TTI_ERROR_LARGE 6
FUNCTION AchoiceGui(aVetor, cTitle, cOk, cCancel, cToolTip, nPadrao, nTamFont )
LOCAL nChoice:=0, lNewFont:=.F.
LOCAL i, aLen, nLen:=0, addY:=80, minWidth:=0, x1
LOCAL hDC, aMetr, nWidth, aArea, aRect
LOCAL nStyle:=WS_POPUP + WS_VISIBLE + WS_CAPTION + WS_SYSMENU + DS_CENTER
LOCAL nLenArray
LOCAL oIconAchoice :=HIcon():AddFile("IMG\IACHOICE.ICO")
LOCAL oIconOk :=hBitMap():AddFile("IMG\IOK.BMP")
LOCAL oIconSair :=hBitMap():AddFile("IMG\IEXIT.BMP")
LOCAL addX:=20, nHeight, lBusca
LOCAL lContinua:=.T., aVetorOpc:={}, nCountArray
PRIVATE oDlgAchoice, cProgressKey:="", aVetorMens:={}, lPulaBaixo:=.F., lPulaCima:=.F.
hb_Default(@aVetor,{"",""})
hb_Default(@cTitle,"")
hb_Default(@cOk,"")
hb_Default(@cCancel,"")
hb_Default(@nPadrao,1)
hb_Default(@cToolTip,"")
hb_Default(@nTamFont,24)
IF Len(aVetor) = 0
hwg_MsgExclamation("Nenhum registro informado","Atenção")
RETURN 0
ENDIF
FOR nCountArray:=1 TO Len(aVetor)
nColunas:=Len(aVetor[nCountArray])
aAdd(aVetorOpc,aVetor[nCountArray,1])
IF nColunas = 1
aAdd(aVetorMens,"")
ELSE
aAdd(aVetorMens,aVetor[nCountArray,nColunas])
ENDIF
NEXT
aVetor:=aClone(aVetorOpc)
nWidth := hb_gtInfo( HB_GTI_SCREENWIDTH )
IF nWidth <= 1360
//nTamFont:=21
ENDIF
addY:=75
lNewFont:=.T.
aLen:=Len( aVetor )
IF ValType( aVetor[ 1 ] ) == "A"
FOR i:=1 TO aLen
nLen:=Max( nLen, Len( aVetor[ i, 1 ] ) )
NEXT
ELSE
FOR i:=1 TO aLen
nLen:=Max( nLen, Len( aVetor[ i ] ) )
NEXT
ENDIF
oFont1:=HFont():Add( "Lucida Console", 0, nTamFont )
oFont3:=HFont():Add( "Arial", 0, 14 )
nStyleListBox := ES_LEFT
hDC:=hwg_Getdc( hwg_GetActiveWindow() )
hwg_SelectObject( hDC, oFont1:handle )
aMetr:=hwg_GetTextMetric( hDC )
aArea:=hwg_GetDeviceArea( hDC )
aRect:=hwg_GetWindowRect( hwg_GetActiveWindow() )
hwg_Releasedc( hwg_GetActiveWindow(), hDC )
nHeight := ( aMetr[ 1 ] + 1 ) * aLen + 4 + addY + 8
IF nheight > aArea[ 2 ] - aRect[ 2 ] - 90
nheight := aArea[ 2 ] - aRect[ 2 ] - 90
ENDIF
nWidth:=(nLen * aMetr[ 2 ]) + 55
hwg_SetToolTipBalloon(.T.)
DO WHILE lContinua
INIT DIALOG oDlgAchoice TITLE cTitle ;
AT 0, 0 ;
ICON oIconAchoice;
SIZE nWidth, nHeight ;
STYLE nStyle ;
FONT oFont1 ;
CLIPPER ;
NOEXIT ;
ON INIT { | o | hwg_ResetWindowPos( o:handle ), o:nInitFocus:=oList, ToolTipTitulo(oDlgAchoice,cTitle,TTI_INFO) }
@ 0, 0 GET LISTBOX oList VAR nPadrao ;
ITEMS aVetor ;
STYLE nStyleListBox ;
BACKCOLOR 13827581 ;
ON DBLCLICK {||nChoice:=nPadrao, hwg_EndDialog( oDlgAchoice:handle )}
oList:oFont := oFont1
oList:bSize := { | o, x, y | hwg_MoveWindow( o:handle, addX / 2, 10, x - addX, y - addY ) }
oList:bChangeSel := {||AchoiceClick(oList)}
oList:bKeyDown := {|o, nKey| Saida(@nChoice,nPadrao,nKey) }
oList:bOther := {|this,m,wp,lp| AchoiceProc( this, m, wp, lp ) }
oList:Tooltip := cToolTip
IF !Empty(cOk)
x1 := Int( nWidth/2 ) - IIF( !Empty(cCancel), 90, 40 )
@ x1,nHeight-60 BUTTONEX oOk ;
CAPTION cOk ;
ON CLICK { || nChoice:=nPadrao, hwg_EndDialog( oDlgAchoice:handle ) } ;
FONT HFont():Add( "Arial", 0, -13,550 ) ;
SIZE 80, 30 ;
STYLE WS_TABSTOP ;
BITMAP oIconOk:handle ;
TRANSPARENT ;
TOOLTIP 'Escolher a seleção.'
IF !empty(cCancel)
@ x1 + 100,nHeight - 60 BUTTONEX oSaida ;
CAPTION cCancel ;
ON CLICK { || nChoice:=0, hwg_EndDialog( oDlgAchoice:handle ) } ;
FONT HFont():Add( "Arial", 0, -13,550 ) ;
SIZE 80, 30 ;
STYLE WS_TABSTOP ;
BITMAP oIconSair:handle ;
TRANSPARENT ;
TOOLTIP 'Abandonar a seleção.'
ENDIF
ENDIF
ADD STATUS oStatus TO oDlgAchoice PARTS 0 FONT oFont3 ON INIT {|This| Status(This) }
oStatus:Anchor:=15
oDlgAchoice:Activate()
ToolTipTitulo(oDlgAchoice,"",TTI_NONE)
oFont1:Release()
oFont3:Release()
EXIT
ENDDO
RETURN nChoice
STATIC FUNCTION Status(This)
This:SetTextPanel(1, aVetorMens[1])
This:SetIconPanel(1, "IMG\IACHOICE2.ICO",24,24)
RETURN .T.
STATIC FUNCTION Saida(nChoice,nPadrao,nKey)
IF nKey = 13
nChoice:=nPadrao
ELSEIF nKey = 27
nChoice:=0
ENDIF
IF nKey = 13 .OR. nKey = 27
hwg_EndDialog( oDlgAchoice:handle)
ENDIF
RETURN -1
STATIC FUNCTION AchoiceClick( oList )
hwg_WriteStatus( oDlgAchoice,1,AvetorMens[oList:value])
RETURN .T.
STATIC FUNCTION AchoiceProc( oList, Msg, wParam, lParam )
LOCAL nVirtCode
IF Msg == WM_KEYUP
nVirtCode := wParam
hwg_WriteStatus( oDlgAchoice,1,AvetorMens[oList:value])
oList:Refresh()
ENDIF
RETURN -1
STATIC FUNCTION ToolTipTitulo(oJanela, cTitulo, nIconIndex)
hb_Default(@cTitulo,"")
hb_Default(@nIconIndex,TTI_INFO)
SendMessageString(hwg_GetToolTipHandle(oJanela:handle),TTM_SETTITLE, nIconIndex, cTitulo)
RETURN Nil
#pragma BEGINDUMP
#include <windows.h>
#include "hbapi.h"
#include <olectl.h>
#include <time.h>
HB_FUNC( INKEYGUI )
{
MSG Msg;
BOOL lNoLoop=FALSE;
UINT dwTimer, nRet=0, uTimeout=10, uMilisec=1000;
if( HB_ISNUM(1) ) uTimeout = hb_parni(1);
if( HB_ISNUM(2) ) uMilisec = hb_parni(2);
if( uTimeout==0 ) uTimeout = 0x0FFFFFFF;
if( uTimeout>0 ) uTimeout = uTimeout * uMilisec;
dwTimer = SetTimer( NULL, 0, uTimeout, NULL);
while( GetMessage(&Msg, NULL, 0, 0) )
{
switch( Msg.message )
{
case WM_KEYDOWN :
case WM_SYSKEYDOWN : { nRet = Msg.wParam; lNoLoop = TRUE; break; }
case WM_TIMER : { lNoLoop = Msg.wParam == dwTimer; break; }
}
if( lNoLoop )
{
KillTimer( NULL, dwTimer );
hb_retni( nRet );
return ;
}
else
{
TranslateMessage( &Msg ); // Translates virtual key codes
DispatchMessage( &Msg ); // Dispatches message to window
}
}
}
HB_FUNC( SENDMESSAGESTRING )
{
hb_retnl( ( LONG ) SendMessage( ( HWND ) hb_parnl( 1 ), ( UINT ) hb_parni( 2 ), ( WPARAM ) hb_parnl( 3 ), ( LPARAM ) ( LPSTR ) hb_parc( 4 ) ) );
}
HB_FUNC (DELAY_DOEVENTS)
{
MSG Msg;
clock_t inicio = clock ();
clock_t ciclos = (clock_t) hb_parnl (1);
while (clock () - inicio <= ciclos)
{ if (PeekMessage((LPMSG) &Msg, 0, 0, 0, PM_REMOVE))
{
TranslateMessage (&Msg);
DispatchMessage (&Msg);
}
}
}
HB_FUNC( HRB_DOEVENTS )
{
MSG Msg;
while( PeekMessage( ( LPMSG ) &Msg, 0, 0, 0, PM_REMOVE ) )
{
TranslateMessage( &Msg );
DispatchMessage( &Msg );
}
}
#pragma ENDDUMP
