Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Center a checkbox in the column of a grid

Status
Not open for further replies.

RedLion

Programmer
Sep 13, 2000
342
NL
Hello,

I would like to center a checkbox in the column of a grid. In the VFP help is described that you should place a checkbox on a container-object. And place this object in the column of the grid.

I've done this, the only problem is that when I run the form with the grid on it, I can't browse with the keys (up and down arrow) through the grid anymore?

BTW
I've tried to catch the keypress event from the checkbox, and call the keypress event from a hidden textbox in the same column with the parameters from the checkbox keypress event, but this didn't work.

Thanks,

Charl
 
HI
I suggest you to do the following.
1. Delete the Text1 from the column containing the CheckBox. To do this, select the Text1 control in the column containing the chech box.. in the properties window.. then click on the form designer header band .. and then press delete key. The control will be deleted.
2. Change the SPARSE value of the column containing the check box to .F.
3. Change the CHeckBox controls Alignment property to Right.
4. Suitably space the Caption of the checkBox control with leading spaces so that it appears at the centre of the column as you wish.

Hope this will help you :) ramani :)
(Subramanian.G),FoxAcc, ramani_g@yahoo.com
 
Thanks for your quick response Remani,

I did what you said, but it didn’t work. I’ve also tried to set the columns alignment on middle-left, but this worked either. What happens is that the checkbox aligns to the right side, and the spaces are on the left side (in the center where the checkbox should be ;-)). I’ve tested it with VFP6SP5 and VFP7SP1.

I guess I forgot to set an important property. I’ve made a new project with a form a grid with a checkbox in it, bound to a table with three records. You can download it from and you can see that it’s not working this way. I hope you can immediately see what I’m doing wrong.

Thanks,

Charl
 
I downloaded your project and tried it, and I just wanted to lend my support: It doesn't seem to be possible to center the checkbox!
 
HI I checked your form. I suggest adding "Aanwezig" as the Caption for the check box control. This will give a better way showing the field. Center alignment for only the check box is not possible. What I mentioned above is to centre the caption so that the field display will look better along with the displayed caption and the grids column header/width..
Hope this helps you :) ramani :)
(Subramanian.G),FoxAcc, ramani_g@yahoo.com
 
Thanks for your time Ramani and Wgcs!

But, in the VFP help stays a tip how a checkbox should be centered in a column, see the link:


Under the steps wich descibe how to interactively add controls to a grid column, stays a header called 'Tip' which explains:

"Tip If you want to be able to center a check box in a grid column, create a container class, add a check box to the container class, and adjust the position of the check box in the container class. Add the container class to the grid column and set the ControlSource of the check box to the desired field."

I've tried to do this, but it's not reacting to keypress and other problems occur.

Any suggestions?

Thanks,

Charl
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top