From b1895dc4430e417b7d828e538f2fb224cdd3a340 Mon Sep 17 00:00:00 2001 From: Luiz Rafael Culik Date: Sat, 8 Dec 2001 18:07:33 +0000 Subject: [PATCH] See changelog 2001-12-18 16:20 GMT -3 --- harbour/source/rtl/checkbox.prg | 103 ++++++++++++++++++-------------- harbour/source/rtl/radiobtn.prg | 15 +---- harbour/source/rtl/radiogrp.prg | 12 ++-- 3 files changed, 68 insertions(+), 62 deletions(-) diff --git a/harbour/source/rtl/checkbox.prg b/harbour/source/rtl/checkbox.prg index d853ada8b9..20424fcf85 100644 --- a/harbour/source/rtl/checkbox.prg +++ b/harbour/source/rtl/checkbox.prg @@ -52,63 +52,75 @@ #include "common.ch" #include "hbsetup.ch" +#include "hbclass.ch" #ifdef HB_COMPAT_C53 -FUNCTION CHECKBOX(nRow,nCol,cCaption) +CLASS HBCHECKBOX +Data Buffer init .f. +Data Caption +Data CapRow +Data CapCol +Data Cargo +Data Col +Data colorspec +Data FBlock +Data HasFocus init .f. +Data Message init "" +Data Row +Data SBlock +Data Style init "[û ]" +Data lCursor +Data Typeout init .f. +DATA ClassName init "CHECKBOX" +METHOD New(nRow,nCol,cCaption) +METHOD SetFocus() +MESSAGE Select() METHOD _Select() +METHOD KillFocus() +METHOD DisPlay() + +endclass + +METHOD New(nRow,nCol,cCaption) Local cColor:='' -Local oClass - if ( ( ISNUMBER( nRow ) ) ) .and. ( ( ISNUMBER( nCol ) ) ) - oClass:=HBClass():New("CHECKBOX") - if(!( ISCHARACTER( cCaption ) ) ) - cCaption := "" - endif +Local oCheck - oClass:AddData( "Buffer" , .f. ) - oClass:AddData( "Caption" , cCaption ) - oClass:AddData( "CapRow" , nRow ) - oClass:AddData( "CapCol" , nCol+3+1 ) - oClass:AddData( "Cargo" ) - oClass:AddData( "Col" , nCol ) - if ( !isdefcolor() ) - oClass:AddData( "ColorSpec" ,"W/N,W+/N,W/N,W+/N" ) +::Buffer := .f. +::Caption := cCaption +::CapRow := nRow +::CapCol := nCol+3+1 + +::Col := nCol + if ( isdefcolor() ) + ::ColorSpec:="W/N,W+/N,W/N,W+/N" else cColor := SetColor() - oClass:AddData( "ColorSpec" , __guicolor(cColor, 5) + "," + ; + ::ColorSpec:= __guicolor(cColor, 5) + "," + ; __guicolor(cColor, 2) + "," + __guicolor(cColor, 1) + ; - "," + __guicolor(cColor, 4)) + "," + __guicolor(cColor, 4) endif - oClass:AddData( "FBlock" ) - oClass:AddData( "HasFocus" , .f. ) - oClass:AddData( "Message" , "" ) - oClass:AddData( "Row" , nRow ) - oClass:AddData( "SBlock" ) - oClass:AddData( "Style" , "[û ]" ) - oClass:AddData( "lCursor" ) - oClass:AddData( "Typeout" , .f. ) +::HasFocus := .f. +::Message := "" +::Row := nRow - oClass:AddMethod( "SetFocus()" , @SetFocus() ) - oClass:AddMethod( "Select()" , @_Select() ) - oClass:AddMethod( "KillFocus()" , @KillFocus() ) - oClass:AddMethod( "Display()" , @DisPlay() ) - oClass:Create() - else - return nil - endif +::Style := "[û ]" -return oClass:Instance() +::Typeout := .f. + + +return Self + +METHOD SetFocus() CLASS HBCHECKBOX -STATIC Function SetFocus() - Local Self := QSelf() if ( !::HasFocus .AND. ISBLOCK( ( ::lCursor := setcursor(0), ; ::HasFocus := .T., ::display(), ::FBlock ) ) ) eval(::FBlock) endif RETURN Self -STATIC Function _Select(lState) +Method _Select(lState) CLASS HBCHECKBOX + - Local Self := QSelf() local lStatus := ::Buffer if ( ISLOGICAL( lState ) ) ::Buffer := lState @@ -121,8 +133,8 @@ STATIC Function _Select(lState) endif RETURN Self -STATIC Function KillFocus() - Local Self := QSelf() +Method KillFocus() CLASS HBCHECKBOX + if ( ::HasFocus ) ::HasFocus := .F. if ( ISBLOCK( ::FBlock ) ) @@ -134,9 +146,9 @@ STATIC Function KillFocus() RETURN Self -STATIC Function Display() +Method Display() CLASS HBCHECKBOX + - Local Self := QSelf() local cColor := SetColor(), nCurRow:= Row(), nCurCol:= Col(), ; cOldStyle := ::Style, cCaption, nPos @@ -190,11 +202,13 @@ return ccolor function _CHECKBOX_( Arg1, Arg2, Arg3, Arg4, Arg5, Arg6, Arg7) LOCAL oCheck - oCheck := checkbox(Row(), Col(), Arg2) + oCheck := hbcheckbox():new(Row(), Col(), Arg2) if ( !( ISNIL( oCheck ) ) ) oCheck:select(Arg1) oCheck:caption :=Arg2 + if arg4!=nil oCheck:colorspec :=Arg4 + endif oCheck:message:=Arg3 if arg7 !=NIL oCheck:style:=Arg7 @@ -206,6 +220,7 @@ LOCAL oCheck return oCheck function IsDefColor() - Return (SETCOLOR() == "W/N,N/W,N/N,N/N,N/W") + local cColor:=SETCOLOR() + Return ( ccolor== "W/N,N/W,N/N,N/N,N/W") #endif diff --git a/harbour/source/rtl/radiobtn.prg b/harbour/source/rtl/radiobtn.prg index bbdfd0b22a..cfbd958359 100644 --- a/harbour/source/rtl/radiobtn.prg +++ b/harbour/source/rtl/radiobtn.prg @@ -95,7 +95,7 @@ METHOD New(nRow,nCol,cCaption,xData) CLASS HBRadioButton ::Caption:= cCaption ::Cargo:=NIL ::Col:= nCol - if ( !isdefcolor() ) + if ( isdefcolor() ) ::ColorSpec:="W/N,W+/N,W+/N,N/W,W/N,W/N,W+/N" else cColor := SetColor() @@ -157,18 +157,9 @@ METHOD DISPLAy() CLASS HBRadioButton cCurStyle := ::Style dispbegin() if ( ::hasfocus ) - cPairs3 := __guicolor(::ColorSpec, 3) - cPairs := __guicolor(::ColorSpec, 4) - cPairs4 := __guicolor(::ColorSpec, 7) + set color to (__guicolor(::colorspec, 2)) else - cPairs3 := __guicolor(::ColorSpec, 1) - cPairs := __guicolor(::ColorSpec, 2) - cPairs4 := __guicolor(::ColorSpec, 6) - endif - if ( ::Buffer ) - set color to (cPairs) - else - set color to (cPairs3) + set color to (__guicolor(::colorspec, 1)) endif SetPos(::Row, ::Col) ?? Left(cCurStyle, 1) diff --git a/harbour/source/rtl/radiogrp.prg b/harbour/source/rtl/radiogrp.prg index 4b1a3818de..93e8123329 100644 --- a/harbour/source/rtl/radiogrp.prg +++ b/harbour/source/rtl/radiogrp.prg @@ -75,7 +75,7 @@ CLASS HBRadioGroup METHOD SetFocus() METHOD SetStyle(xItem) METHOD New(nTop, nLeft, nBottom, nRight ) - METHOD GetColor(xColor) +// METHOD GetColor(xColor) DATA Bottom DATA Buffer init NIL @@ -114,8 +114,8 @@ CLASS HBRadioGroup DATA Value init 0 DATA Color - ACCESS colorspec inline ::GetColor() - ASSIGN Colorspec(xColor) inline if(xColor!=Nil,::GetColor(xColor),) + Data colorspec init "" +// ASSIGN Colorspec(xColor) inline if(xColor!=Nil,::GetColor(xColor),) ENDCLASS @@ -141,7 +141,7 @@ METHOD ADDITEM( xItem ) CLASS HBRadioGroup if ( !( ISOBJECT( xItem ) ) ) - elseif ( xItem:classname() == "RADIOBUTTN" ) + elseif ( xItem:classname() == "RADIOBUTTO" ) AAdd(::aItems, xItem) ::ItemCount++ endif @@ -422,14 +422,14 @@ METHOD DELITEm( xItem ) CLASS HBRadioGroup endif return self -METHOD GetColor(xColor) CLASS HBRadioGroup +/*METHOD GetColor(xColor) CLASS HBRadioGroup if ( !( ISNIL( xColor ) ) ) ::Color := iif( Valtype(xColor)=="C" .and. !Empty(__guicolor(xColor, 3)) .AND. ; Empty(__guicolor(xColor, 4)),xColor,) endif return ::Color - +*/ static function CHANGEBUTT( oItems, xVal, nPos )