setcolor on a get with a conditional checkbox

setcolor on a get with a conditional checkbox

Postby Rick Lipkin » Sat May 21, 2011 3:25 pm

To All

I have two simple fields I want to setcolor to ??? ( grey out ) when the top checkbox is .t.

Image

I have two onclick functions that blank out the fields and because of the when clause on the get .. they are disabled when the top checkbox is .t. .. but I can not seem to set the background color of the two disabled get fields to grey .. here is my code .. Checkfield1() seems to be the right place .. and I use oXXX:Setcolor("w/n") but the field does not grey out .. Color only seems to effect active get .. Is there a code block to set the color or to set the field to readonly and grey out the two fields ?

Code: Select all  Expand view

   REDEFINE CHECKBOX oCBX_LINK var lCBX_LINK ID 114 of oEMPL ;
            when lCBX_HTML <> .t. ;
            On Click _ChkField1(lCBX_LINK) UPDATE

   REDEFINE CHECKBOX oCBX_HTML var lCBX_HTML ID 119 of oEMPL ;
            when lCBX_LINK <> .t. ;
            On Click _ChkField2(lCBX_HTML) UPDATE
   
   REDEFINE GET oHBD       VAR cHBD       ID 120 of oEMPL ;
            when lCBX_HTML = .t. UPDATE
   REDEFINE GET oHSD       VAR cHSD       ID 121 of oEMPL ;
            when lCBX_HTML = .t. UPDATE

//--------------------------------
Static Func _ChkField1( lClick )

msginfo( "chkfield1")
MSGINFO( LCLICK )

DO CASE
CASE lCLICK = .T.
   MSGINFO( "CLICK =  T  SETTING FIELDS TO GREY")
  * lCBX_HTML := .F.
   cHBD      := SPACE(50)
   cHSD      := SPACE(50)
   *  oCBX_HTML:ReFresh()
   oHBD:Disable()
   msginfo( "disable")
   oHBD:Setcolor("r/r")
   msginfo( "color")
   oHBD:ReFresh()
 *  oHSD:Setcolor("W/N")
   oHSD:ReFresh()

CASE lClick = .f.
   lCBX_LINK := .F.
   oCBX_LINK:ReFresh()
  * lCBX_HTML := .F.
   cHBD      := SPACE(50)
   cHSD      := SPACE(50)
 *  oCBX_HTML:ReFresh()
   oHBD:ReFresh()
   oHSD:ReFresh()


ENDCASE

SysReFresh()

RETURN(.T.)


//--------------------------------
Static Func _ChkField2( lClick )

IF lClick = .f.
   lCBX_HTML := .F.
   cHBD      := SPACE(50)
   cHSD      := SPACE(50)
   oCBX_HTML:ReFresh()
 *  oHBD:Setcolor("n/w")
   oHBD:ReFresh()
 *  oHSD:Setcolor("n/w")
   oHSD:ReFresh()
ENDIF

SysReFresh()

RETURN(.T.)

 
User avatar
Rick Lipkin
 
Posts: 2665
Joined: Fri Oct 07, 2005 1:50 pm
Location: Columbia, South Carolina USA

Re: setcolor on a get with a conditional checkbox

Postby Enrico Maria Giordano » Sat May 21, 2011 5:19 pm

Code: Select all  Expand view
oGet:lDisColors = .T.
oGet:nClrTextDis = ...
oGet:nClrPaneDis = ...


EMG
User avatar
Enrico Maria Giordano
 
Posts: 8712
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia

Re: setcolor on a get with a conditional checkbox

Postby Rick Lipkin » Mon May 23, 2011 12:53 pm

Enrico

Your suggestion worked to disabled the text, however I am zero'ing out the fields with spaces .. in this view you see the text is grayed out and the background is still white .. what I want to do is blank out the fields and set the background to a disabled gray ..

Image

Code: Select all  Expand view

//--------------------------------
Static Func _ChkField1( lClick )

*msginfo( "chkfield1")
*MSGINFO( LCLICK )

IF lClick = .f.
     lCBX_LINK := .F.
    oCBX_LINK:ReFresh()
 *  cHBD      := SPACE(50)
 *  cHSD      := SPACE(50)
 *  oCBX_HTML:ReFresh()
   oHBD:ReFresh()
   oHSD:ReFresh()
endif

SysReFresh()

RETURN(.T.)


//--------------------------------
Static Func _ChkField2( lClick )


IF lClick = .f.
   msginfo( "chkfield2 click f ")

   lCBX_HTML := .F.
*   cHBD      := SPACE(50)
*   cHSD      := SPACE(50)
   oCBX_HTML:ReFresh()

   // just want a gray background
   oHBD:lDisColors = .T.
  * oHBD:nClrBack = CLR_RED
  * oHBD:nClrTextDis = CLR_RED
  * oHBD:nClrPaneDis = CLR_GRAY
   oHBD:ReFresh()
   oHBD:ReFresh()
   oHSD:ReFresh()
ENDIF

SysReFresh()

RETURN(.T.)
 
User avatar
Rick Lipkin
 
Posts: 2665
Joined: Fri Oct 07, 2005 1:50 pm
Location: Columbia, South Carolina USA

Re: setcolor on a get with a conditional checkbox

Postby Daniel Garcia-Gil » Mon May 23, 2011 1:12 pm

Hello Rick

deactivate lDisColors and use nClrTextDis and nClrPaneDis

Code: Select all  Expand view
#include "fivewin.ch"

function main()

   local oWnd
   local oMenu
   
   menu oMenu
      MenuItem "Test" action Test( oWnd )
   endmenu  

   define window oWnd title "Test Button Get Transparent" menu oMenu pixel
   
   
   activate window oWnd
 
return oWnd  
   
   

Function test( oWnd )
   local oDlg
   local oGet3, oGet4
   local cVar3, cVar4
   local lActive := .f.
   
   cVar1 := 0
   cVar2 := 0
   cVar3 := 0
   cVar4 := 0
   
   
   define dialog oDlg title "From Code" pixel size 300,300
   
   @ 10, 10 checkbox oChk var lActive prompt "Avtivated" of oDlg pixel size 120, 12 on change ( oDlg:Update() )

   @ 70,10 get oGet3 var cVar3 of oDlg pixel size 120,12 when lActive update
   @ 100,10 get oGet4 var cVar4 of oDlg pixel size 120,12 when lActive update
   
   
   oGet3:lDisColors      := .f.       // Deactive disable color
   oGet3:nClrTextDis     := CLR_WHITE // Color text disable status
   oGet3:nClrPaneDis     := CLR_GRAY  // Color Pane disable status

   oGet4:lDisColors      := .f.       // Deactive disable color
   oGet4:nClrTextDis     := CLR_WHITE // Color text disable status
   oGet4:nClrPaneDis     := CLR_GRAY  // Color Pane disable status
   
   
   activate dialog oDlg centered
 
return nil
   
User avatar
Daniel Garcia-Gil
 
Posts: 2365
Joined: Wed Nov 02, 2005 11:46 pm
Location: Isla de Margarita

Re: setcolor on a get with a conditional checkbox

Postby Enrico Maria Giordano » Mon May 23, 2011 1:22 pm

Daniel Garcia-Gil wrote:deactivate lDisColors and use nClrTextDis and nClrPaneDis


Of course. My fault.

EMG
User avatar
Enrico Maria Giordano
 
Posts: 8712
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia

Re: setcolor on a get with a conditional checkbox

Postby Rick Lipkin » Mon May 23, 2011 2:09 pm

Daniel and Enrico

Thank you both for your help !!

Rick
User avatar
Rick Lipkin
 
Posts: 2665
Joined: Fri Oct 07, 2005 1:50 pm
Location: Columbia, South Carolina USA


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: Google [Bot] and 100 guests