Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Adding & centering a checkbox in a grid
Message
From
28/11/2002 19:18:34
 
 
To
23/10/2002 10:24:41
Cetin Basoz
Engineerica Inc.
Izmir, Turkey
General information
Forum:
Visual FoxPro
Category:
Forms & Form designer
Miscellaneous
Thread ID:
00714202
Message ID:
00728056
Views:
31
Hi Cetin,

nice code; thanks.

I found it useful to adjust the checkbox height in the container resize, using the rowheight of the grid (this goes inside the with/endwith of the RESIZE:
	IF LOWER(THIS.PARENT.BASECLASS) = "column"
		.TOP = (THIS.PARENT.PARENT.ROWHEIGHT - .HEIGHT)/2
	ENDIF
thanks again,

Hank

>>Running into a slight problem with a checkbox inside of a grid column. When we put the checkbox into a column, I can either set the box to the left or to the right side of the column but not center. And center is where we would prefer it. There is no text or caption to preclude it from being centered in the column and the column is set for center-middle.
>>
>>So the question is, what am I doing wrong and how do you get it centered? Am I using the wrong Form Control or am I trying to do something that is not possible with VFP. I have seen it done in other programs.
>>
>>Thanks in Advance...
>>
>>Jack Wilson
>
>Jack,
>I use a conatiner class as David and Mark suggested. Here is class code :
>
>Define Class grdcheckbox As Container
>  Width = 14
>  Height = 17
>  BackStyle = 0
>  BorderWidth = 0
>  Name = "grdcheckbox"
>  Add Object check1 As Checkbox With ;
>    Top = 0, ;
>    Left = 0, ;
>    Width = 13, ;
>    BackStyle = 0, ;
>    Caption = "", ;
>    SpecialEffect = 1, ;
>    Name = "Check1"
>
>  Procedure Init
>    With This
>      .Resize()
>      If Lower(.Parent.BaseClass)='column'
>        .check1.ControlSource=.Parent.ControlSource
>      Endif
>    Endwith
>  Endproc
>
>  Procedure Resize
>    With This.check1
>      .Left = (This.Parent.Width - .Width)/2
>    Endwith
>  Endproc
>
>  Procedure check1.InteractiveChange
>    If Lower(This.Parent.Parent.BaseClass)='column'
>      This.Parent.Parent.Parent.Refresh
>    Endif
>  Endproc
>
>  Procedure check1.KeyPress
>    Lparameters nKeyCode, nShiftAltCtrl
>    Local lnRows
>    If nKeyCode=32
>      Nodefault
>      This.Value = !This.Value
>      This.Refresh
>    Endif
>    If Inlist(nKeyCode,4,19,5,56,141,24,50,145,18,57,31,3,51,30)
>      Nodefault
>      With This.Parent.Parent.Parent
>        lnRows = (.Height-(.HeaderHeight+Iif( .ScrollBars % 2 = 1, Sysmetric(8),0)))/.RowHeight
>        Do Case
>          Case Inlist(nKeyCode,5,56,141) && Up
>            If !Bof(.RecordSource)
>              Skip -1 In (.RecordSource)
>            Endif
>            If Bof(.RecordSource)
>              Go Top In (.RecordSource)
>            Endif
>          Case Inlist(nKeyCode,24,50,145) && Down
>            If !Eof(.RecordSource)
>              Skip In (.RecordSource)
>            Endif
>            If Eof(.RecordSource)
>              Go Bottom In (.RecordSource)
>            Endif
>          Case Inlist(nKeyCode,18,57,31) && PageUp
>            If !Bof(.RecordSource)
>              Skip -1*lnRows In (.RecordSource)
>            Endif
>            If Bof(.RecordSource)
>              Go Top In (.RecordSource)
>            Endif
>          Case Inlist(nKeyCode,3,51,30) && PageDown
>            If !Eof(.RecordSource)
>              Skip lnRows In (.RecordSource)
>            Endif
>            If Eof(.RecordSource)
>              Go Bottom In (.RecordSource)
>            Endif
>          Case nKeyCode=4 && RightArrow
>            Keyboard("{TAB}")
>          Case nKeyCode=19 && LeftArrow
>            Keyboard("{BACKTAB}")
>        Endcase
>      Endwith
>    Endif
>  Endproc
>Enddefine
>
Cetin
Previous
Reply
Map
View

Click here to load this message in the networking platform