Get Disabled (Solved )

Get Disabled (Solved )

Postby lailton.webmaster » Fri Sep 11, 2009 11:20 pm

Why this no work when Get is disabled ?

someone can help ?

Code: Select all  Expand view
#include "fivewin.ch"
function main()

 local  odlg, oget, cVar:=space(50),ogetb, cVarb:=space(50)

 define dialog odlg

  @ 5, 10 get oGet  var cVar  of odlg pixel size 120, 10 noborder color CLR_WHITE
  @ 20, 10 get oGetb var cVarb of odlg pixel size 120, 10 noborder color CLR_WHITE

  oGet:lTransparent = .T.
  oGetb:lTransparent = .T.

 activate dialog odlg centered on init( GradGet( Self ) )


return nil

function GradGet( _oDlg )
local oControl
local aColors :=   { { 0.4, nRGB( 75, 144, 223 ), nRGB( 41, 85, 145 ) },;
                     { 0.6, nRGB( 24,  61, 118 ), nRGB( 50, 95, 158 ) } }
local hBmp, n
local oBrush


  for n = 1 to Len(_oDlg:aControls)
     oControl:= _oDlg:aControls[ n ]
     if "TGET" $ oControl:ClassName()
        hBmp = GradientBmp( oControl, oControl:nWidth, oControl:nHeight, aColors )
        oBrush = TBrush():New( , , , , hBmp )
        oControl:SetBrush( oBrush )
        DeleteObject( hBmp )
     endif

  next

return Nil


thanks
Last edited by lailton.webmaster on Mon Sep 14, 2009 12:16 pm, edited 1 time in total.
lailton.webmaster
 
Posts: 603
Joined: Sun May 04, 2008 8:44 pm

Re: Get Disabled

Postby lailton.webmaster » Sun Sep 13, 2009 12:34 am

SOmeone
lailton.webmaster
 
Posts: 603
Joined: Sun May 04, 2008 8:44 pm

Re: Get Disabled

Postby Daniel Garcia-Gil » Sun Sep 13, 2009 1:17 am

Hello lailton..

Sorry for late reply...
please try with

Code: Select all  Expand view
...
 oGet:bPainted = {| hDC, PS, oGet | filldis( hDC, oGet ) }
...

function filldis( hDC, oGet )
   FillRect( hDC, GetClientRect( oGet:hWnd ), oGet:oBrush:hBrush )
return nil
User avatar
Daniel Garcia-Gil
 
Posts: 2365
Joined: Wed Nov 02, 2005 11:46 pm
Location: Isla de Margarita

Re: Get Disabled

Postby lailton.webmaster » Sun Sep 13, 2009 3:57 am

Daniel thanks for your help

a ask

oGet:bPainted = {| hDC, PS, oGet | filldis( hDC, oGet ) }

hDc es lo mesmo que oGet:hDc ?
se no existe alguna forma de retornar a ele somiente con lo oGET ou com lo oDLG ?

gracias.
lailton.webmaster
 
Posts: 603
Joined: Sun May 04, 2008 8:44 pm

Re: Get Disabled

Postby lailton.webmaster » Sun Sep 13, 2009 4:01 am

What i think in make is: ( this insede of funcion background that is executed in painted of oDlg

if .not. oControl:lActive
filldis( oControl:hDC, oControl ) // i did it more no work :( think that o oControl:hDc is wrong... )
endif
lailton.webmaster
 
Posts: 603
Joined: Sun May 04, 2008 8:44 pm

Re: Get Disabled

Postby lailton.webmaster » Sun Sep 13, 2009 5:15 am

Daniel,

tua solucion funcionou pero lo Texto del GET no exibe es como no tive-se nada en lo campo,

tien como hacer un exemplo para nos ?

usando GET disabled, y color degrade del get disabled in vermelho y los get enabled azul

gracias.
lailton.webmaster
 
Posts: 603
Joined: Sun May 04, 2008 8:44 pm

Re: Get Disabled

Postby Daniel Garcia-Gil » Sun Sep 13, 2009 12:36 pm

Hello Lailton...

you need change the TGET CLASS, i'll explain you how to do
LOCATE:
Code: Select all  Expand view
#define EM_SETCUEBANNER   0x1501


ADD AFTER
Code: Select all  Expand view
#define TRANSPARENT         0x01


LOCATE:
Code: Select all  Expand view
  DATA   cCueText


ADD AFTER
Code: Select all  Expand view
  DATA   nTxtStyle


LOCATE (METHOD NEW):
Code: Select all  Expand view
  ::cCueText  = cCueText


ADD AFTER
Code: Select all  Expand view
  ::nTxtStyle = nOR( ETO_CLIPPED, ETO_OPAQUE )


LOCATE (METHOD REFEDINE):
Code: Select all  Expand view
  ::cCueText  = cCueText


ADD AFTER
Code: Select all  Expand view
  ::nTxtStyle = nOR( ETO_CLIPPED, ETO_OPAQUE )


LOCATE METHOD PAINT:
REPLACE WITH:
Code: Select all  Expand view
METHOD Paint() CLASS TGet

   local aInfo := ::DispBegin()
   local hOldFont
   local nClrBtnTxt, nClrBtnPane
   local nOldMode

   nClrBtnTxt := ::nClrText
   nClrBtnPane := ::nClrPane
   

   if ::oBrush != nil
      FillRect( ::hDC, GetClientRect( ::hWnd ), ::oBrush:hBrush )
   else
      CallWindowProc( ::nOldProc, ::hWnd, WM_ERASEBKGND, ::hDC, 0 )
   endif

   if IsWindowEnabled( ::hWnd )
      CallWindowProc( ::nOldProc, ::hWnd, WM_PAINT, ::hDC, 0 )
   else
         
      if ::lDisColors
         SetTextColor( ::hDC, GetSysColor( COLOR_GRAYTEXT ) )
         SetBkColor( ::hDC, GetSysColor( COLOR_WINDOW ) )
         nClrBtnPane := GetSysColor( COLOR_WINDOW )
      else
        if ValType( ::nClrTextDis ) == "B"
            SetTextColor( ::hDC, Eval( ::nClrTextDis ) )
        elseif ValType( ::nClrTextDis ) == "N"
            if ::nClrTextDis >= 0
                SetTextColor( ::hDC, ::nClrTextDis  )
                nClrBtnTxt := ::nClrTextDis
            else
           SetTextColor( ::hDC, ::nClrText )
          endif
        endif
       
        if ValType( ::nClrPaneDis ) == "B"
            SetBkColor( ::hDC, Eval( ::nClrPaneDis ) )
        elseif ValType( ::nClrPaneDis ) == "N"
            if ::nClrPaneDis >= 0
                SetBkColor( ::hDC, ::nClrPaneDis  )
                nClrBtnPane := ::nClrPaneDis
            else
           SetBkColor( ::hDC, ::nClrPane )
            endif
        endif
      endif
     
      if ::oFont != nil
         hOldFont = SelectObject( ::hDC, ::oFont:hFont )
      endif

      nOldMode = SetBkMode( ::hDC, TRANSPARENT )
     
      do case
         case lAnd( GetWindowLong( ::hWnd, GWL_STYLE ), ES_CENTER )
              SetTextAlign( ::hDC, TA_CENTER )
              if ::lSpinner
                 ExtTextOut( ::hDC, 1, ( ::nWidth() - 3 - GetSysMetrics( SM_CYHSCROLL ) ) / 2,;
                    { 0, 0, ::nHeight(), ::nWidth() }, GetWindowText( ::hWnd ), ::nTxtStyle )
              else
                 ExtTextOut( ::hDC, 1, ( ::nWidth() - 3 ) / 2,;  
                   { 0, 0, ::nHeight(), ::nWidth() }, GetWindowText( ::hWnd ), ::nTxtStyle )
              endif

                 case lAnd( GetWindowLong( ::hWnd, GWL_STYLE ), ES_RIGHT )
              SetTextAlign( ::hDC, TA_RIGHT )
              if ::lSpinner
                 ExtTextOut( ::hDC, 1, ::nWidth() - 7 - GetSysMetrics( SM_CYHSCROLL ),;
                    { 0, 0, ::nHeight(), ::nWidth() }, GetWindowText( ::hWnd ), ::nTxtStyle )
              else
                  if ValType( ::bAction ) == "B"                                                                
                      ExtTextOut( ::hDC, 1, ::nWidth() - 7 - ::nHeight,;                
                    { 0, 0, ::nHeight(), ::nWidth() }, GetWindowText( ::hWnd ), ::nTxtStyle )
                 else                                                                                                                      
                    ExtTextOut( ::hDC, 1, ::nWidth() - 7 ,;
                    { 0, 0, ::nHeight(), ::nWidth() }, GetWindowText( ::hWnd ), ::nTxtStyle )
                  endif                                                                                                                    
              endif

         otherwise
              SetTextAlign( ::hDC, TA_LEFT )
              ExtTextOut( ::hDC, 1, 2,;
                { 0, 0, ::nHeight(), ::nWidth() }, GetWindowText( ::hWnd ), ::nTxtStyle )
      endcase
     
      if ::oFont != nil
         SelectObject( ::hDC, hOldFont )
      endif
     
      SetBkMode( ::hDC, nOldMode )

   endif

   
   if ValType( ::bPainted ) == "B"
      Eval( ::bPainted, ::hDC, ::cPS, Self )
   endif

// button

  if ::oBtn != nil .and. ::lBtnTransparent
     ::oBtn:SetColor( nClrBtnTxt, nClrBtnPane )        
  endif


  ::DispEnd( aInfo )

return 1


PRG SAMPLE
http://www.sitasoft.com/fivewin/test/getfill.zip

Code: Select all  Expand view

#include "fivewin.ch"
function main()

 local  odlg, oget, cVar:="This a TGET Gradient Test",ogetb, cVarb:=space(50)


 define dialog odlg SIZE 600, 600

  @ 5, 10 get oGet var cVar  of odlg pixel size 120, 10  color CLR_WHITE when( ! empty( cVarb ) )
  @ 20, 10 get cVarb of odlg pixel size 120, 10 color CLR_WHITE
  @ 35, 10 get cVar  of odlg pixel size 120, 10 color CLR_WHITE
  @ 50, 10 get cVarb of odlg pixel size 120, 10 noborder color CLR_WHITE
  @ 65, 10 get cVar  of odlg pixel size 120, 10 noborder color CLR_WHITE
  @ 80, 10 get cVarb of odlg pixel size 120, 10 noborder color CLR_WHITE
  @ 95, 10 get cVar  of odlg pixel size 120, 10 noborder color CLR_WHITE
  @ 110, 10 get cVarb of odlg pixel size 120, 10 noborder color CLR_WHITE
  @ 125,10 say "this a test" of odlg pixel

  oGet:lDisColors = .f.
  oGet:nClrTextDis = CLR_BLACK

 activate dialog odlg centered on init( GradGet( Self ) )


return nil

function GradGet( _oDlg )
local oControl
local aColors :=    { { 0.4, nRGB( 75, 144, 223 ), nRGB( 41, 85, 145 ) },;
                     { 0.6, nRGB( 24,  61, 118 ), nRGB( 50, 95, 158 ) } }
local hBmp, n
local oBrush


  for n = 1 to Len(_oDlg:aControls)
     oControl:= _oDlg:aControls[ n ]
     if oControl:ClassName() == "TGET"
        oControl:lTransparent = .T.
        oControl:nTxtStyle = 4
        hBmp = GradientBmp( oControl, oControl:nWidth, oControl:nHeight, aColors )
        oBrush = TBrush():New( )
        oBrush:hBrush = CreatePatternBrush( hBmp )
        oControl:SetBrush( oBrush )
        DeleteObject( hBmp )
     endif

  next

return Nil


function GradientBmp( oWnd, nWidth, nHeight, aColors )

   local hDC, hBmp, hBmpOld
   local aRect := GetClientRect( oWnd:hWnd )

   default nHeight := aRect[ 3 ] , nWidth := aRect[ 4 ]

   hDC     = CreateCompatibleDC( oWnd:GetDC() )
   hBmp    = CreateCompatibleBitMap( oWnd:hDC, nWidth, nHeight )
   hBmpOld = SelectObject( hDC, hBmp )
   GradientFill( hDC, 0, 0, nHeight, nWidth, aColors )
   SelectObject( hDC, hBmpOld )
   DeleteDC( hDC )
   DeleteObject( hBmpOld )
   oWnd:ReleaseDC()

return hBmp
 

Image
User avatar
Daniel Garcia-Gil
 
Posts: 2365
Joined: Wed Nov 02, 2005 11:46 pm
Location: Isla de Margarita

Re: Get Disabled

Postby Daniel Garcia-Gil » Sun Sep 13, 2009 2:01 pm

Hello...

This feature will be include in next build FWH
User avatar
Daniel Garcia-Gil
 
Posts: 2365
Joined: Wed Nov 02, 2005 11:46 pm
Location: Isla de Margarita

Re: Get Disabled

Postby lailton.webmaster » Sun Sep 13, 2009 2:51 pm

I will try


thanks Daniel
lailton.webmaster
 
Posts: 603
Joined: Sun May 04, 2008 8:44 pm

Re: Get Disabled

Postby lailton.webmaster » Sun Sep 13, 2009 3:30 pm

Daniel in fwh902 don´t have
Data cCueText, so i added lanter of all data
i change all that you say me more no solved.

when is disabled, FillRect do hidden value of GET

look it.
Image

:(
lailton.webmaster
 
Posts: 603
Joined: Sun May 04, 2008 8:44 pm

Re: Get Disabled

Postby Daniel Garcia-Gil » Mon Sep 14, 2009 3:05 am

Lailton...

i'll prepare the TGET change for your FWH version
User avatar
Daniel Garcia-Gil
 
Posts: 2365
Joined: Wed Nov 02, 2005 11:46 pm
Location: Isla de Margarita

Re: Get Disabled

Postby lailton.webmaster » Mon Sep 14, 2009 3:13 am

Thanks so much Daniel i will wait.
lailton.webmaster
 
Posts: 603
Joined: Sun May 04, 2008 8:44 pm

Re: Get Disabled

Postby Daniel Garcia-Gil » Mon Sep 14, 2009 9:24 am

Lailton...

i made same change in TGET ver 9.02 and work fine

you need create the data TxtStyle for TGET class and init in NEW and REDEFINE

can use the same Paint method posted here

ps: don't forget define TRANSPARENT
User avatar
Daniel Garcia-Gil
 
Posts: 2365
Joined: Wed Nov 02, 2005 11:46 pm
Location: Isla de Margarita

Re: Get Disabled

Postby lailton.webmaster » Mon Sep 14, 2009 12:11 pm

Daniel,

I replace all the method PAINT and now it WORK FINE !!!!!!!!!!!!!

thanks so much !
lailton.webmaster
 
Posts: 603
Joined: Sun May 04, 2008 8:44 pm


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 66 guests

cron