Skip to content

Commit 39888d0

Browse files
committed
Checkbox: add FILLRECT/NOFILLRECT and fix outline
2022-05-24 20:22 UTC-0300 Fernando Yurisich <[email protected]> * ide\prgs\formedit.prg + Support for FILLRECT and NOFILLRECT clauses for CheckBox control. #27 ! Click on CheckBox control does not outline it. #35
1 parent e5fa19c commit 39888d0

File tree

1 file changed

+18
-7
lines changed

1 file changed

+18
-7
lines changed

prgs/formedit.prg

+18-7
Original file line numberDiff line numberDiff line change
@@ -160,6 +160,7 @@
160160
{ "aFields", "" }, ;
161161
{ "aFile", "" }, ;
162162
{ "aFileType", "" }, ;
163+
{ "aFillRect", "NIL" }, ;
163164
{ "aFirstItem", .F. }, ;
164165
{ "aFit", .F. }, ;
165166
{ "aFitImg", .F. }, ;
@@ -3748,7 +3749,7 @@ METHOD CreateControl( nControlType, i, nWidth, nHeight, aCtrls ) CLASS TFormEdit
37483749
ENDIF
37493750
oCtrl:FontColor := ::myIde:StrToColor( ::aFontColor[i] )
37503751
oCtrl:BackColor := ::myIde:StrToColor( ::aBackColor[i] )
3751-
oCtrl:OnClick := { || ::DrawOutline( oCtrl ) }
3752+
oCtrl:OnChange := { || ::DrawOutline( oCtrl ) } // OnClick codeblock is ignored
37523753
oCtrl:OnDblClick := { || ::DrawOutline( oCtrl ), ::PropertiesClick() }
37533754

37543755
CASE nControlType == TYPE_CHECKBUTTON
@@ -7813,10 +7814,10 @@ METHOD pButton( i ) CLASS TFormEditor
78137814
/*--------------------------------------------------------------------------------------------------------------------------------*/
78147815
METHOD pCheckBox( i ) CLASS TFormEditor
78157816

7816-
LOCAL aBackColor, aFontColor, cBackground, cCaption, cCargo, cField, cFocusRect, cFontName, cHelpID, cNoFocusRect, cObj
7817-
LOCAL cOnChange, cOnGotFocus, cOnLostFocus, cOOHGDraw, cParent, cSubClass, cToolTip, cVal, cValue, cWinDraw, l3State, lAutoSize
7818-
LOCAL lBold, lEnabled, lItalic, lLeftJust, lNoTabStop, lRTL, lStrikeout, lTrans, lUnderline, lVisible, nCol, nFontSize, nHeight
7819-
LOCAL nRow, nWidth, oCtrl, uFontName, uFontSize
7817+
LOCAL aBackColor, aFontColor, cBackground, cCaption, cCargo, cField, cFillRect, cFocusRect, cFontName, cHelpID, cNoFillRect
7818+
LOCAL cNoFocusRect, cObj, cOnChange, cOnGotFocus, cOnLostFocus, cOOHGDraw, cParent, cSubClass, cToolTip, cVal, cValue, cWinDraw
7819+
LOCAL l3State, lAutoSize, lBold, lEnabled, lItalic, lLeftJust, lNoTabStop, lRTL, lStrikeout, lTrans, lUnderline, lVisible, nCol
7820+
LOCAL nFontSize, nHeight, nRow, nWidth, oCtrl, uFontName, uFontSize
78207821

78217822
/* Load properties */
78227823
nRow := Val( ::ReadCtrlRow( i ) )
@@ -7883,6 +7884,8 @@ METHOD pCheckBox( i ) CLASS TFormEditor
78837884
cParent := ::ReadStringData( i, "PARENT", "" )
78847885
cParent := ::ReadStringData( i, "OF", cParent )
78857886
cCargo := ::ReadCargo( i, "LASTFORM.LASTCONTROL.CARGO" )
7887+
cFillRect := ::ReadLogicalData( i, "FILLRECT", "N" )
7888+
cNoFillRect := ::ReadLogicalData( i, "NOFILLRECT", "N" )
78867889

78877890
/* Save properties */
78887891
::aCtrlType[i] := ::ControlType[ TYPE_CHECKBOX ]
@@ -7919,6 +7922,7 @@ METHOD pCheckBox( i ) CLASS TFormEditor
79197922
::aNoFocusRect[i] := ( cFocusRect == "F" .AND. cNoFocusRect == "T" )
79207923
::aParent[i] := cParent
79217924
::aCargo[i] := cCargo
7925+
::aFillRect[i] := iif( cFillRect == cNoFillRect, "NIL", iif( cFillRect == "T" .OR. cNoFillRect == "F", "YES", "NO" ) )
79227926

79237927
/* Create control */
79247928
oCtrl := ::CreateControl( AScan( ::ControlType, ::aCtrlType[i] ), i, nWidth, nHeight, NIL )
@@ -13352,7 +13356,7 @@ METHOD MakeControls( j, Output, nRow, nCol, nWidth, nHeight, nSpacing, nLevel )
1335213356
IF ::aCheckBoxes[j]
1335313357
Output += " ;" + CRLF + Space( nSpacing * ( nLevel + 1 ) ) + "CHECKBOXES"
1335413358
ENDIF
13355-
IF NOTEMPTY( ::aOnCheckChg[j] )
13359+
IF NOTEMPTY( ::aOnCheckChg[j] )
1335613360
Output += " ;" + CRLF + Space( nSpacing * ( nLevel + 1 ) ) + "ON CHECKCHANGE " + AllTrim( ::aOnCheckChg[j] )
1335713361
ENDIF
1335813362
IF NOTEMPTY( ::aOnRowRefresh[j] )
@@ -13656,6 +13660,11 @@ METHOD MakeControls( j, Output, nRow, nCol, nWidth, nHeight, nSpacing, nLevel )
1365613660
IF ::aNoFocusRect[j]
1365713661
Output += " ;" + CRLF + Space( nSpacing * ( nLevel + 1 ) ) + "NOFOCUSRECT"
1365813662
ENDIF
13663+
IF ::aFillRect[j] == "YES"
13664+
Output += " ;" + CRLF + Space( nSpacing * ( nLevel + 1 ) ) + "FILLRECT"
13665+
ELSEIF ::aFillRect[j] == "NO"
13666+
Output += " ;" + CRLF + Space( nSpacing * ( nLevel + 1 ) ) + "NOFILLRECT"
13667+
ENDIF
1365913668
IF NOTEMPTY( ::aCargo[j] )
1366013669
Output += CRLF + CRLF + Space( nSpacing * nLevel ) + "LastForm.LastControl.Cargo := " + AllTrim( ::aCargo[j] )
1366113670
ENDIF
@@ -14425,7 +14434,7 @@ METHOD MakeControls( j, Output, nRow, nCol, nWidth, nHeight, nSpacing, nLevel )
1442514434
IF NOTEMPTY( AllTrim( ::aDynBackColor[j] ) )
1442614435
Output += " ;" + CRLF + Space( nSpacing * ( nLevel + 1 ) ) + "DYNAMICBACKCOLOR " + AllTrim( ::aDynBackColor[j] )
1442714436
ENDIF
14428-
IF NOTEMPTY( AllTrim( ::aDynForeColor[j] ) )
14437+
IF NOTEMPTY( AllTrim( ::aDynForeColor[j] ) )
1442914438
Output += " ;" + CRLF + Space( nSpacing * ( nLevel + 1 ) ) + "DYNAMICFORECOLOR " + AllTrim( ::aDynForeColor[j] )
1443014439
ENDIF
1443114440
IF NOTEMPTY( ::aOnGotFocus[j] )
@@ -17884,6 +17893,7 @@ METHOD PropertiesClick() CLASS TFormEditor
1788417893
{ "Disabled", ::aDisabled[j], .F. }, ;
1788517894
{ "DrawBy", AScan( { "OOHGDRAW", "WINDRAW" }, ::aDrawBy[j] ) + 1, { "NIL", "OOHGDRAW", "WINDRAW" } }, ;
1788617895
{ "Field", ::aField[j], 1000 }, ;
17896+
{ "FillRect", AScan( { "YES", "NO" }, ::aFillRect[j] ) + 1, { "NIL", "YES", "NO" } }, ;
1788717897
{ "HelpID", ::aHelpID[j], 1000 }, ;
1788817898
{ "Invisible", ::aInvisible[j], .F. }, ;
1788917899
{ "LeftAlign", ::aLeftJust[j], .F. }, ;
@@ -17916,6 +17926,7 @@ METHOD PropertiesClick() CLASS TFormEditor
1791617926
::aDisabled[j] := aResults[ ++k ]
1791717927
::aDrawBy[j] := { "NIL", "OOHGDRAW", "WINDRAW" } [ aResults[ ++k ] ]
1791817928
::aField[j] := aResults[ ++k ]
17929+
::aFillRect[j] := { "NIL", "YES", "NO" } [ aResults[ ++k ] ]
1791917930
::aHelpID[j] := aResults[ ++k ]
1792017931
::aInvisible[j] := aResults[ ++k ]
1792117932
::aLeftJust[j] := aResults[ ++k ]

0 commit comments

Comments
 (0)