Jump to content
Fivewin Brasil

Tem como colocar 02 botoes dentro do GET


marcioe

Recommended Posts

Olá amigos, bom dia, não sei se é possível, mas será que tem como colocar 02 botoes dentro do GET
Hoje está assim

    REDEFINE GET oPROCURA_PESQUISA                     var PROCURA_PESQUISA                                                                               ID 4038      OF oDLG_INVENTARIO PICTURE "@!K"  ACTION ( PROCURA_PRODUTOS_SQL_INVENTARIO( '',PROCURA_PESQUISA, IF(cOrder='A','D','A')  )  )  BITMAP "#8393" FONT O_F_GET CUEBANNER 'Digite Sua Pesquisa (F5=Buscar)'
 

Desde já agradeço aos amigos

 

inventario.jpg

Link to comment
Share on other sites

Amiguinhos

BTNGET.CH

/*
 * $Id: btnget.ch,v 1.1 2000/11/20 20:45:09 RRamirez Exp $
 */

#ifndef TBTNGET_CH
#define TBTNGET_CH

#define CGET TBTNGET
#define TBTNGET BTNGET

#xcommand REDEFINE BTNGET [ <oGet> VAR ] <uVar> ;
             [ ID <nId> ] ;
             [ <dlg: OF, WINDOW, DIALOG> <oDlg> ] ;
             [ <help:HELPID, HELP ID> <nHelpId> ] ;
             [ VALID   <ValidFunc> ]       ;
             [ PICTURE <cPict> ] ;
             [ <color:COLOR,COLORS> <nClrFore> [,<nClrBack>] ] ;
             [ FONT <oFont> ] ;
             [ CURSOR <oCursor> ] ;
             [ MESSAGE <cMsg> ] ;
             [ <update: UPDATE> ] ;
             [ WHEN <uWhen> ] ;
             [ ON CHANGE <uChange> ] ;
             [ <readonly: READONLY, NO MODIFY> ] ;
             [ <spin: SPINNER> [ON UP <SpnUp>] [ON DOWN <SpnDn>] [MIN <Min>] [MAX <Max>] ] ;
             [ <resource: BUTTON NAME, RESNAME, RESOURCE> <cResName> ];
             [ <bact: BUTTON ACTION, ACTION> <uAction> ] ;
       => ;
          [ <oGet> := ] TBtnGet():ReDefine( <nId>, bSETGET(<uVar>), <oDlg>,;
             <nHelpId>, <cPict>, <{ValidFunc}>, <nClrFore>, <nClrBack>,;
             <oFont>, <oCursor>, <cMsg>, <.update.>, <{uWhen}>,;
             [ \{|nKey,nFlags,Self| <uChange> \}], <.readonly.>,;
             <.spin.>, <{SpnUp}>, <{SpnDn}>, <{Min}>, <{Max}>, [<cResName>], [<{uAction}>])

#command @ <nRow>, <nCol> BTNGET [ <oGet> VAR ] <uVar> ;
            [ <dlg: OF, WINDOW, DIALOG> <oWnd> ] ;
            [ PICTURE <cPict> ] ;
            [ VALID <ValidFunc> ] ;
            [ <color:COLOR,COLORS> <nClrFore> [,<nClrBack>] ] ;
            [ SIZE <nWidth>, <nHeight> ]  ;
            [ FONT <oFont> ] ;
            [ <design: DESIGN> ] ;
            [ CURSOR <oCursor> ] ;
            [ <pixel: PIXEL> ] ;
            [ MESSAGE <cMsg> ] ;
            [ <update: UPDATE> ] ;
            [ WHEN <uWhen> ] ;
            [ <lCenter: CENTER, CENTERED> ] ;
            [ <lRight: RIGHT> ] ;
            [ ON CHANGE <uChange> ] ;
            [ <readonly: READONLY, NO MODIFY> ] ;
            [ <pass: PASSWORD> ] ;
            [ <lNoBorder: NO BORDER, NOBORDER> ] ;
            [ <help:HELPID, HELP ID> <nHelpId> ] ;
            [ <resource: BUTTON NAME, RESNAME, RESOURCE> <cResName> ];
            [ <bact: BUTTON ACTION, ACTION> <uAction> ] ;
       => ;
          [ <oGet> := ] TBtnGet():New( <nRow>, <nCol>, bSETGET(<uVar>),;
             [<oWnd>], <nWidth>, <nHeight>, <cPict>, <{ValidFunc}>,;
             <nClrFore>, <nClrBack>, <oFont>, <.design.>,;
             <oCursor>, <.pixel.>, <cMsg>, <.update.>, <{uWhen}>,;
             <.lCenter.>, <.lRight.>,;
             [\{|nKey, nFlags, Self| <uChange>\}], <.readonly.>,;
             <.pass.>, [<.lNoBorder.>], <nHelpId>, [<cResName>],[\{|Self| <uAction>\}] )

#command @ <nRow>, <nCol> BTNGET [ <oGet> VAR ] <uVar> ;
            [ <dlg: OF, WINDOW, DIALOG> <oWnd> ] ;
            [ PICTURE <cPict> ] ;
            [ VALID <ValidFunc> ] ;
            [ <color:COLOR,COLORS> <nClrFore> [,<nClrBack>] ] ;
            [ SIZE <nWidth>, <nHeight> ]  ;
            [ FONT <oFont> ] ;
            [ <design: DESIGN> ] ;
            [ CURSOR <oCursor> ] ;
            [ <pixel: PIXEL> ] ;
            [ MESSAGE <cMsg> ] ;
            [ <update: UPDATE> ] ;
            [ WHEN <uWhen> ] ;
            [ <lCenter: CENTER, CENTERED> ] ;
            [ <lRight: RIGHT> ] ;
            [ ON CHANGE <uChange> ] ;
            [ <readonly: READONLY, NO MODIFY> ] ;
            [ <help:HELPID, HELP ID> <nHelpId> ] ;
            [ <spin: SPINNER> [ON UP <SpnUp>] [ON DOWN <SpnDn>] [MIN <Min>] [MAX <Max>] ] ;
       => ;
          [ <oGet> := ] TBtnGet():New( <nRow>, <nCol>, bSETGET(<uVar>),;
             [<oWnd>], <nWidth>, <nHeight>, <cPict>, <{ValidFunc}>,;
             <nClrFore>, <nClrBack>, <oFont>, <.design.>,;
             <oCursor>, <.pixel.>, <cMsg>, <.update.>, <{uWhen}>,;
             <.lCenter.>, <.lRight.>,;
             [\{|nKey, nFlags, Self| <uChange>\}], <.readonly.>,;
             .f., .f., <nHelpId>,;
             <.spin.>, <{SpnUp}>, <{SpnDn}>, <{Min}>, <{Max}> )


#endif

BTNGET CLASS

*-- PROGRAM FILE -------------------------------------------------------
*  Application: Addon for FiveWin
*  Description: TBtnGet - Colored TGet class with button
*    File Name: tbtnget.prg
*       Author: Ricardo Ramirez       Tester: Ricardo Ramirez
* Date created: 1998-01-01            Date updated: þ2001-03-26
* Time created: 8:17:12PM             Time updated: þ16:028:17M
*    Copyright: (c) 1998-2000 by Punto-Co
*
 * $Id: btnget.prg,v 1.4 2001/08/10 18:12:21 RRamirez Exp $
*
* Compliments of:
*  George Georguiev
*-----------------------------------------------------------------------

#include "FiveWin.ch"

#define GWL_STYLE         -16
#define GWL_EXSTYLE       -20
#define DS_3DLOOK           4
#define SM_CYVSCROLL       20

CLASS TBtnGet FROM TGet

   DATA   bAction, cResName, oBtn, lBtnORBmp
   DATA   nClrPFoText, nClrPFoPane, nClrDef
   DATA   nBmpWidth, bTmpValid
   DATA   nClrFocusText, nClrFocusPane // added. There was erased from FW 2.2c

   METHOD ClassName() INLINE "TGET"

   METHOD New( nRow, nCol, bSetGet, oWnd, nWidth, nHeight, cPict, ;
               bValid, nClrFore, nClrBack, oFont, lDesign, oCursor, ;
               lPixel, cMsg, lUpdate, bWhen, lCenter, lRight, bChanged,;
               lReadOnly, lPassword, lNoBorder, nHelpId, cResName, ;
               bAction, lSpinner, bUp, bDown, bMin, bMax, nBmpWidth ) ;
               CONSTRUCTOR

   METHOD ReDefine( nId, bSetGet, oWnd, nHelpId, cPict, bValid, ;
               nClrFore, nClrBack, oFont, oCursor, cMsg, lUpdate, ;
               bWhen, bChanged, lReadOnly, lSpinner, bUp, bDown, bMin, ;
               bMax, cResName, bAction ) CONSTRUCTOR

   METHOD Default()
   METHOD Initiate( hDlg ) INLINE Super:Initiate( hDlg ), ::Default()
   METHOD SetIniClr()
   METHOD Move()
   METHOD CalcDims( nTop, nLeft, nWidth, nHeight )

END CLASS

METHOD New( nRow, nCol, bSetGet, oWnd, nWidth, nHeight, cPict, bValid,;
            nClrFore, nClrBack, oFont, lDesign, oCursor, lPixel, cMsg,;
            lUpdate, bWhen, lCenter, lRight, bChanged, lReadOnly,;
            lPassword, lNoBorder, nHelpId, cResName, bAction, lSpinner,;
            bUp, bDown, bMin, bMax, nBmpWidth ) CLASS TBtnGet

   Super:New( nRow, nCol, bSetGet, oWnd, nWidth, nHeight, cPict, ;
            bValid, nClrFore, nClrBack, oFont, lDesign, oCursor, ;
            lPixel, cMsg, lUpdate, bWhen, lCenter, lRight, bChanged, ;
            lReadOnly, lPassword, lNoBorder, nHelpId, lSpinner,;
            bUp, bDown, bMin, bMax )

   DEFAULT nBmpWidth := 17

   ::nStyle := nOr( ::nStyle, ES_MULTILINE )

   ::bAction   := bAction
   ::cResName  := cResName
   ::lBtnORBmp := .F.
   ::nBmpWidth := nBmpWidth
   ::SetIniClr()

Return Self

METHOD ReDefine( nId, bSetGet, oWnd, nHelpId, cPict, bValid, nClrFore,;
                 nClrBack, oFont, oCursor, cMsg, lUpdate, bWhen, ;
                 bChanged, lReadOnly, lSpinner, bUp, bDown, bMin, ;
                 bMax, cResName, bAction, nBmpWidth ) CLASS TBtnGet

   Super:ReDefine( nId, bSetGet, oWnd, nHelpId, cPict, bValid, ;
                 nClrFore, nClrBack, oFont, oCursor, cMsg, lUpdate, ;
                 bWhen, bChanged, lReadOnly, lSpinner, bUp, bDown, ;
                 bMin, bMax )

   DEFAULT nBmpWidth := 22

   ::nStyle    := nOr(::nStyle, ES_MULTILINE )
   ::bAction   := bAction
   ::cResName  := cResName
   ::lBtnORBmp := .F.
   ::nBmpWidth := nBmpWidth
   ::SetIniClr()

   SetWindowLong( ::hWnd, GWL_STYLE, nOr( GetWindowLong( ::hWnd, GWL_STYLE ) , ES_MULTILINE ) )

Return Self

METHOD Default() CLASS TBtnGet
   local nRectLen, l3Dlook
   Local nTop, nLeft, nWidth, nHeight

   IF empty( ::bAction )
      Return Nil
   ENDIF

   IF !lAnd( GetWindowLong( ::hWnd, GWL_STYLE ), ES_MULTILINE )
      //MsgStop("Sorry, but you need to define the ID " + ltrim( str( ::nId ) ) + " as MULTILINE ")
   endif

   if lAnd( GetWindowLong( ::hWnd, GWL_STYLE ) , ES_MULTILINE )
      //MsgInfo("Si soy")
   else
      //MsgInfo("no soy")
   Endif

   //SetWindowLong( ::hWnd, GWL_EXSTYLE, nOr( GetWindowLong( ::hWnd, GWL_EXSTYLE ) , ES_MULTILINE ) )

   nRectLen := ::CalcDims( @nTop, @nLeft, @nWidth, @nHeight )

   ::oBtn := TBtnDown():New( nTop, nLeft, nWidth, nHeight, ;
                 ::cResName,, ::cResName,, {|| Self:SetFocus(), ;
                 eval( ::bAction ) }, Self,"",, .F., .F.,"", ,, , .F. )

   ::bKeyDown        := { | nKey | IIF( nKey == VK_F3, eval( ::bAction ), IIF( nKey == VK_F2, TheHelp( ::nId ), "" ) ) }
   ::oBtn:bGotFocus  := {|| ::bTmpValid := ::bValid, ::bValid := nil, ;
                            ::oWnd:nLastKey := 0 }
   ::oBtn:bLostFocus := {|| ::bValid := ::bTmpValid }
   ::oBtn:lTransparent:=.t.
   ::oBtn:SetColor( RGB(255,255,255), RGB(255,255,255) )

   GetBtn( ::hWnd, nRectLen )

Return Nil

METHOD SetIniClr() CLASS TBtnGet

   ::nClrFocusText := nRGB(0,0,0)
   ::nClrFocusPane := nRGB(255,255,255) // nRGB(243,250,200)
   ::nClrPFoText   := ::nClrText
   ::nClrPFoPane   := ::nClrPane
   //
   ::bGotFocus  := {|| ::SetColor( ::nClrFocusText, ::nClrFocusPane) }
   ::bLostFocus := {|| ::SetColor( ::nClrPFoText  , ::nClrPFoPane  ) }

Return Self

METHOD Move( nTop, nLeft, nWidth, nHeight, lRepaint ) CLASS TBtnGet
   Local nRectLen

   Super:Move( nTop, nLeft, nWidth, nHeight, lRepaint )

   IF ::oBtn != Nil

      nRectLen := ::CalcDims( @nTop, @nLeft, @nWidth, @nHeight )
      ::oBtn:Move( nTop, nLeft, nWidth, nHeight )

   ENDIF

Return Nil

METHOD CalcDims( nTop, nLeft, nWidth, nHeight ) CLASS TBtnGet
   Local nRectLen

   nRectLen := ::nBmpWidth + 4

   IF lAnd( GetWindowLong( ::oWnd:hWnd, GWL_STYLE ), DS_3DLOOK )
      IF empty( ::cResName )
         nLeft   := ::nWidth() - 16
         nWidth  := 22
      else
         nLeft   := ::nWidth() - 26
         nWidth  := 22
      endif
      nTop    := 0
      nHeight := ::nHeight() - 4
   else
      IF empty( ::cResName )
         nLeft   := ::nWidth() - 15
         nWidth  := 14
      Else
         nLeft   := ::nWidth() - 25
         nWidth  := 22
      ENDIF
      nTop    := 1
      nHeight := ::nHeight() - 2
   ENDIF

   IF empty( ::cResName )
      nRectLen -= 9
   endif

   if ::oVScroll != Nil
      nLeft  -= GetSysMetrics( SM_CYVSCROLL )
      nLeft++
   endif

Return nRectLen

Exemplo:

	#include "btnget.ch"
...
	function main()
	        DEFINE DIALOG oDlgPainel RESOURCE "dlgPainel" //BRUSH oBrush //TRANSPARENT // STYLE WS_POPUP
	        REDEFINE BTNGET   oCtrl9014 VAR dCtrl9014 ID 9014 WHEN lCtrl9007 ;
            RESOURCE "calen" OF oDlgPainel SPINNER ;
            ON UP   (++dCtrl9014,oCtrl9014:Refresh(),nCtrl9009:=3,oCtrl9009:Refresh(),oCtrl9101:Enable()) ;
            ON DOWN (--dCtrl9014,oCtrl9014:Refresh(),nCtrl9009:=3,oCtrl9009:Refresh(),oCtrl9101:Enable()) ;
            ACTION (aRect       := GetCoors(oCtrl9014:hWnd),;
                    dCtrl9014   := FwCalendar(dCtrl9014,aRect[1],aRect[4],oDlgPainel),;
                    oCtrl9014:Refresh())
	...
	

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