Jump to content
Fivewin Brasil

Dialog


oliveiros

Recommended Posts

https://forums.fivetechsupport.com/viewtopic.php?f=3&t=43499&p=262082&hilit=gradient&sid=5c9bd1e5ee8b75a75785af5bb811fd2e#p262068

// \SAMPLES\ALVAREZ.PRG - 23/01/2022.
	#Include "FiveWin.ch"  //-> The Best...
	FUNCTION Espera_Alvarez()
	   LOCAL oDlg, oFld, oFont, aGrad, oBrush1, oBrush2, oBtn
   LOCAL aBitmaps := { "..\bitmaps\alphabmp\facebook.bmp", ;
                       "..\bitmaps\alphabmp\windows.bmp" }
	   LOCAL nTempo_espera, cNome_funcao, lTimercontinua
	   // -> 1 hora tem 3600 segundos.
   nTempo_espera := 15  // segundos.
	   cNome_funcao := "LOGOFF()"   
	   lTimercontinua := .F.
	   aGrad := { { 0.30, CLR_WHITE, CLR_HBLUE },{ 0.50, CLR_HBLUE, CLR_WHITE } }
	   DEFINE BRUSH oBrush1 COLOR nRGB( 250, 213, 174 ) STYLE HORIZONTAL
   DEFINE BRUSH oBrush2 COLOR nRGB( 192, 192, 192 ) STYLE HORIZONTAL
	   DEFINE FONT oFont   NAME "Ms Sans Serif" SIZE 00, -14 BOLD
                      
   DEFINE DIALOG oDlg TITLE "- TFolderex - Testing -" SIZE 350, 350          ;
      PIXEL TRUEPIXEL RESIZABLE GRADIENT aGrad
     
   @ 1, 0 FOLDEREX oFld PIXEL ADJUST OF oDlg ;
      PROMPT "Prenotazioni", "Pagamenti"     ;
      BITMAPS aBitmaps                       ;
      TAB HEIGHT 26 OPTION 1 ROUND 5 FONT oFont COLOR CLR_HGREEN TOP
	   oFld:aEnable = { .T., .T., .F. }
	   @ 245, 10 BTNBMP oBtn CENTER SIZE 100, 100 PIXEL OF oDlg NOROUND 2007
	   oBtn:bClrGrad := {| lInvert | If( lInvert, oBrush2:hBrush, oBrush1:hBrush  ) }
   oBtn:Disable()
	   ACTIVATE DIALOG oDlg CENTERED ;
      ON INIT( oFld:Resize(), TINATIVO():NEW( nTempo_espera, cNome_funcao,   ;
                              lTimerContinua ) )
	RETURN NIL
	// tinativo.prg - By William Adami
// exemplo do uso da classe Tinativo
// Apos um tempo de inatividade do mouse
// e do teclado chama uma funcao qualquer.
	//#include "fivewin.ch"
	// STATIC oWnd
	//************
	/*
FUNCTION Main()
	   LOCAL nTempo_espera, cNome_funcao, lTimercontinua
	   // Tempo a ser esperado ate chamar a funcao
   // -> 1 hora tem 3600 segundos.
   nTempo_espera := 10  // segundos. 
	   // nome da funcao a ser chamada quando
   // chegar no tempo de espera
   cNome_funcao := "LOGOFF()"   
   // se apos executar a funcao , continua
   // monitorando a inatividade do mouse e teclado.
   lTimercontinua := .F.
	   define window oWnd title "Teste de teclado e mouse"
	   activate window oWnd ;
      ON INIT tinativo():new( nTempo_espera, cNome_funcao, lTimerContinua )
	RETURN NIL
*/
	FUNCTION LOGOFF()
	   // msgalert( "AQUI ENTRA SUA FUNCAO DE LOGOFF !", "AVISO" )
	   IF MsgYesNo( OemToAnsi( "ATEN€ÇO USUµRIO:                       " )+CRLF+ ;
                OemToAnsi( "PROTEJA OS BANCOS DE DADOS DO PROGRAMA." )+CRLF+ ;
                OemToAnsi( "SE NÇO ESTIVER USANDO O ALVAREZ.EXE,   " )+CRLF+ ;
                OemToAnsi( "DESLIGUE-O PARA NÇO CORRER RISCOS.     " )+CRLF+ ;
                OemToAnsi( "POSSO DESLIGAR O PROGRAMA? <S> ou <N>??" ),      ;
                OemToAnsi( "AVISO PARA DESLIGAR O ALVAREZ.EXE...   " ) )
	      HB_GCALL( .T. )
	      CLEAR MEMORY
	      PostQuitMessage( 0 )
	      QUIT
	   ENDIF
	RETURN NIL
	//   tinativo.prg -> By William Adami
	// #include "fivewin.ch"
	CLASS TINATIVO
	   DATA nTimeInpAntes
   DATA nTimeInpDepois
   DATA cTimeAtu
   DATA nTempo
   DATA oTimerTime
   DATA cFunc
   DATA lContinuar
	   METHOD NEW( nTime, cFuncao, lContinua )  CONSTRUCTOR
	   METHOD ver_tempo()
	ENDCLASS
	METHOD new( ntime, cFuncao, lContinua ) CLASS TINATIVO
	   ::cfunc := cfuncao
   ::ntempo := ntime
   ::lContinuar := lContinua
   ::oTimerTime := TTimer():New( 1000, { || ::VER_TEMPO() } )
   ::oTimerTime:Activate()
   ::cTimeAtu := time()
   ::nTimeInpAntes := getInputState()    // 0 = erro
	RETURN self
	METHOD VER_TEMPO CLASS TINATIVO
	   LOCAL AUX
	   ::nTimeInpDepois := getInputState()
	   IF ( ::nTimeInpDepois - ::nTimeInpAntes ) > 0
	      ::nTimeInpAntes := getInputState()
	      ::cTimeAtu := time()
	   ENDIF
	
   IF ( CONVTIME( time() ) - CONVTIME( ::cTimeAtu ) ) > ::ntempo
	      ::oTimerTime:DeActivate()
	      aux := ::cfunc
   
      // aqui executa a funcao
	      &aux
	      if ::lContinuar
	         ::oTimerTime:Activate()
         ::cTimeAtu := time()
	      ENDIF
	
   ENDIF
	RETURN NIL
	FUNCTION CONVTIME( ZZ )
	   LOCAL Z
	   Z := ( VAL( LEFT(ZZ,2 ) ) * 360 ) + ( VAL( SUBSTR(ZZ,4,2 ) ) * 60 ) + ;
          VAL( RIGHT( ZZ,2 ) )
	RETURN Z
	//*----------------------------------------------------------------------
#pragma BEGINDUMP
#define _WIN32_WINNT 0x0500
#define WINVER 0x0500
#include "windows.h"
#include "hbapi.h"
HB_FUNC( GETINPUTSTATE )
{
LASTINPUTINFO lpi;
lpi.cbSize = sizeof(LASTINPUTINFO);
if (!GetLastInputInfo(&lpi))
{
hb_retni(0);
}
hb_retni(lpi.dwTime);
}
#pragma ENDDUMP
	// fin / end

Regards, saludos.
 

Link to comment
Share on other sites

Inicie um tópico e termine aqui. Ele pergunta aqui, e depois vai para o inter e:

https://forums.fivetechsupport.com/viewtopic.php?f=3&t=43749&p=264029&sid=7fe8dc243c37086d6cbb921f4a2b4010#p264029

// C:\FWH..\SAMPLES\GRADHOR2.PRG
	#include "fivewin.ch"
	FUNCTION Main()
	   LOCAL oDlg, aGrad, oBrush, oBrush1, oBrush2
	   aGrad := { { 0.4, CLR_GREEN,  CLR_HGREEN }, ;
              { 0.6, CLR_HGREEN, CLR_GREEN  } }
	   DEFINE BRUSH oBrush GRADIENT aGrad STYLE HORIZONTAL // or VERTICAL
   DEFINE BRUSH oBrush1 COLOR nRGB( 250, 213, 174 ) STYLE HORIZONTAL
   DEFINE BRUSH oBrush2 COLOR nRGB( 192, 192, 192 ) STYLE HORIZONTAL
	   DEFINE DIALOG oDlg TITLE "- Gradient Horizontal -" SIZE 350, 350          ;
      PIXEL TRUEPIXEL RESIZABLE BRUSH oBrush // OR GRADIENT aGrad
	   oDlg:lhelpIcon := .F.
	   ACTIVATE DIALOG oDlg CENTERED
	   RELEASE BRUSH oBrush
	RETURN NIL
	// FIN / END

Deve ser GEMINIANO. kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk

Regards, saludos.

Link to comment
Share on other sites

Veja este exemplo se é o que procura.

#include "FiveWin.ch"

#translate TRUE         => .T.
#translate FALSE        => .F.

//-------------------------------------------------------------------------//
Function fitcadexe() // (tip_fun)
   local itcadexe
   local lsalva:=.F.
   Local ncodexe, cdesexe, ocodexe, odesexe

   DEFINE DIALOG itcadexe  FROM 0,0 TO  216, 513  TITLE 'Inclui novo exemplo'  PIXEL TRANSPARENT
   itcadexe:lhelpIcon := .F.

   tgradtela( itcadexe , (46) ) // altura faixa do BTNBMP 
   
   ncodexe :=space( 04 ) 
   cdesexe :=space( 50 )

   @    20,    3 SAY "Codigo do exemplo:"    SIZE  86,  10 PIXEL OF itcadexe
   @    33,    3 SAY "Descricao do exemplo:" SIZE  86,  10 PIXEL OF itcadexe

   @    19,   89 GET ocodexe  VAR ncodexe  SIZE   24,  10 PIXEL OF itcadexe readonly
   @    32,   89 GET odesexe  VAR cdesexe  SIZE  162,  10 PIXEL OF itcadexe picture "@!"

   @    70,   76 BTNBMP oBtn2_itcadexe PROMPT "Confirma"  2007 CENTER CANCEL UPDATE OF itcadexe PIXEL SIZE 42, 35 action ( lsalva:=.T., itcadexe:end() )
   @    70,  138 BTNBMP oBtn8_itcadexe PROMPT "Voltar"    2007 CENTER CANCEL UPDATE OF itcadexe PIXEL SIZE 42, 35 action ( lsalva:=.F., itcadexe:end() )

   ACTIVATE DIALOG itcadexe CENTERED on init odesexe:setfocus()
   If     lsalva // .and. tip_fun=1
          //inclui_cadexe( ncodexe , cdesexe )
   ElseIf lsalva
          //altera_cadexe( ncodexe , cdesexe )
   EndIf
   Release ncodexe, cdesexe, ocodexe, odesexe , itcadexe

Return .T.

//----------------------------------------------------------------------------//
function tgradtela( par_obj , par_percent )
   local naltura_BTN := par_percent*2
   local npercent_par_obj := round( ( naltura_BTN / par_obj:nHeight ) , 2 )
	par_obj:aGradcolors := {{ ( 1 - npercent_par_obj ) , nRGB(110,193,248), nRGB(0,64,254)} ,;
	                         {       npercent_par_obj   , nRGB(255,255,255), nRGB(255,255,255)} }
Return .T.
//----------------------------------------------------------------------------//

 

Link to comment
Share on other sites

Daniel, eu faria o seu exemplo assim:

// C:\FWH..\SAMPLES\GRADHOR3.PRG
	#include "FiveWin.ch"
	#define CLR_MSPURPLE RGB( 0,  120, 215 )
#define CLR_MSRED    RGB( 232,  17,  35 )
#define CLR_MSGRAY   RGB( 229, 229, 229 )
	#translate TRUE         => .T.
#translate FALSE        => .F.
	FUNCTION FitcadExe() // (tip_fun)
	   LOCAL itcadexe, oFont
   LOCAL lsalva := .F.
   LOCAL ncodexe, cdesexe, ocodexe, odesexe
   LOCAL oBtn2_itcadexe, oBtn8_itcadexe
   LOCAL oCursorBtn := TCursor():New(, 'HAND' )
	   ncodexe := Space( 04 )
   cdesexe := Space( 50 )
	   DEFINE FONT oFont  NAME "Ms Sans Serif"  SIZE 00, -16 // BOLD
	   DEFINE DIALOG itcadexe FROM 0, 0 TO  216, 513 TITLE 'Inclui novo exemplo' ;
      PIXEL TRANSPARENT FONT oFont STYLE nOR( DS_MODALFRAME, WS_POPUP,       ;
      WS_CAPTION, WS_SYSMENU, WS_MINIMIZEBOX )
	   itcadexe:lhelpIcon := .F.
	   // tgradtela( itcadexe, ( 46 ) ) // altura faixa do BTNBMP
	   /* // DENTRO DO LOOPING NAO E LEGAL. PODE EXPLODIR O DIALOGO
   ncodexe := Space( 04 )
   cdesexe := Space( 50 )
   */
	   @ 20,  3 SAY "Codigo do exemplo:" SIZE 86, 10 PIXEL OF itcadexe UPDATE    ;
      COLOR CLR_WHITE, CLR_BLACK
	   @ 33,  3 SAY "Descricao do exemplo:" SIZE 86, 10 PIXEL OF itcadexe UPDATE ;
      COLOR CLR_WHITE, CLR_BLACK
	   @ 19, 89 GET ocodexe VAR ncodexe SIZE 24, 12 PIXEL OF itcadexe ;
      READONLY UPDATE  COLOR CLR_MSPURPLE, CLR_BLACK
	   ocodexe:lBtnTransparent := .T.       // transparent button get oGet3
   ocodexe:lAdjustBtn      := .T.       // Button Get Adjust Witdh oGet3
   ocodexe:lDisColors      := .F.       // Deactive disable color
   ocodexe:nClrTextDis     := CLR_WHITE // Color text disable status
   ocodexe:nClrPaneDis     := CLR_BLUE  // Color Pane disable status
	   @ 32, 89 GET odesexe VAR cdesexe SIZE 162, 12 PIXEL OF itcadexe ;
      PICTURE "@!" UPDATE COLOR CLR_MSPURPLE, CLR_BLACK
	   @ 70, 76 BTNBMP oBtn2_itcadexe PROMPT "Confirma" FLAT 2007 CENTER UPDATE ;
      OF itcadexe PIXEL SIZE 42, 35 action ( lsalva := .T., itcadexe:end() )
	   oBtn2_itcadexe:lCancel := .T.
	   oBtn2_itcadexe:nClrBorder := iif( oBtn2_itcadexe:lMOver, RGB( 219, 230, 244 ), RGB( 219, 230, 244 ) )
   oBtn2_itcadexe:oCursor :=   oCursorBtn
	   @ 70, 138 BTNBMP oBtn8_itcadexe PROMPT "Voltar" FLAT 2007 CENTER UPDATE ;
      OF itcadexe PIXEL SIZE 42, 35 action ( lsalva := .F., itcadexe:end() )
	   oBtn8_itcadexe:lCancel := .T.
	   oBtn8_itcadexe:nClrBorder := iif( oBtn8_itcadexe:lMOver, RGB( 219, 230, 244 ), RGB( 219, 230, 244 ) )
   oBtn8_itcadexe:oCursor :=   oCursorBtn
	   tGradtela( itcadexe, ( 46 ) ) // altura faixa do BTNBMP
	   ACTIVATE DIALOG itcadexe CENTERED // ON INIT( odesexe:setfocus() ) //??
	   IF lsalva // .and. tip_fun=1
      // inclui_cadexe( ncodexe , cdesexe )
   ELSEIF lsalva
      // altera_cadexe( ncodexe , cdesexe )
   ENDIF
	   // RELEASE ncodexe, cdesexe, ocodexe, odesexe, itcadexe //??
	   oFont:End()
	RETURN NIL //  .T.
	// ----------------------------------------------------------------------------//
FUNCTION tGradtela( par_obj, par_percent )
	   LOCAL naltura_BTN := par_percent * 2
   LOCAL npercent_par_obj := Round( ( naltura_BTN / par_obj:nHeight ), 2 )
	   par_obj:aGradcolors := { { ( 1 - npercent_par_obj ), nRGB( 110, 193, 248 ), nRGB( 0, 64, 254 ) }, ;
      {  npercent_par_obj, nRGB( 255, 255, 255 ), nRGB( 255, 255, 255 ) } }
	
RETURN .T.
	// FIN / END - kapiabafwh@gmail.com

Regards, saludos.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...