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 Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Grid problems 3

Status
Not open for further replies.

audiopro

Programmer
Apr 1, 2004
3,165
GB
I have been using VFP6 for a number of years, on and off but have never been able to fully understand grids. I need to add one to an existing app but I am having problems. Is it possible to add a check box to a grid from within the form designer or has it to be hard coded?

Keith
 
Keith,

Yes, this is certainly possible, but a bit tricky.

You first need to select the grid column that is to hold the checkbox. To do so, select the column from the drop-down list at the top of the property window. Then drop a checkbox onto the column. At first, it looks like it didn't work, but in fact the checkbox is present, but hidden behind the existing textbox.

To remove the textbox, select it in the drop-down list, then click on the title bar of the form designer itself (not the form, the form designer). This is necessary because you would otherwise de-select the textbox. Finally, press the Delete key.

You will now see the checkbox in the designer. But when you run the form, you will only see it in the selected row. If that's not what you want, set the column's Sparse property to .F.

Hope this helps.

Mike




__________________________________
Mike Lewis (Edinburgh, Scotland)

My Visual FoxPro site: www.ml-consult.co.uk
 
If your grid is a standard control, find the Text1 of Column1 at the top of the properties window. Click it and then click back on the grid, press delete, and the text "AB" box in the grid will dissapear. Next, click the check box in form tools, and drop it on that column.
wjwjr

This old world keeps spinning round - It's a wonder tall trees ain't layin' down
 
Thanks guys
Grids have always been a bit of a mystery to me but all has suddenly become clear, I hadn't realised that they are made up of text boxes. I thought they were just cells as in browse windows. I now need to spend some time working out what else they do. Strange that I can't find that information in the programmer's guide, unless I have missed it.

Keith
 
Keith,

If you can get hold of a copy of "Kilofox" (1001 Things you always wanted to know about Visual FoxPro), you'll find an excellent chapter on grids. Better still, its author, Marcia Akins, is always willing to answer questions on it in this forum.

Mike


__________________________________
Mike Lewis (Edinburgh, Scotland)

My Visual FoxPro site: www.ml-consult.co.uk
 
I am finding my way through the maze but still hitting problems.
How can I format a text field to display only lower case?
I have an email field which historically has a mixture of upper and lower case letters due to them being imported form a number of sources. They are forced to lower case in the main app but I would like to make them look pretty in the grid. I could do a global replace but other apps are adding to the list without case control.
I tried lower(mysource) in the format property but made no difference.

Keith
 
audiopro,

no, that's no difference to browse, browse also is made up of textboxes...

Code:
USE browser IN 0
BROWSE NAME oBrowse Nowait
? oBrowse.Column1.CurrentControl

Bye, Olaf.
 
Inclose the control source of the column in LOWER() this will display all the rows in that column in Lower Case. Or if you want to pretty it up use PROPER() instead

Example: Control source of Column 1 is customer.company, change it to LOWER(customer.company) or PROPER(customer.company)
 
Thanks, I had tried that but I made the control source of the text box 'lower' rather than the column. I am still learning about grids and I think I have a way to go yet.

Keith
 
Keith,
an on top of all the very goood advises you have received here today, here comes the most important one: Upgrade to VFP9 instantly.
You will be amazed together with 1001 Things from Marcia and Andy what you can do with Visual FoxPro. VFP6 is realy buggy try to get rid of it even this weekend!
Jockey

jockey.gif
 
Thank You; Glad I could help.
Though a little "cumbersome", grids, once you understand how they work are really pretty simple...
 
I have discovered an additional annoyance, setting the column to 'lower' also makes it read only, is this one of the bugs which have been mentioned?

Keith
 
Keith,

I have discovered an additional annoyance, setting the column to 'lower' also makes it read only, is this one of the bugs which have been mentioned?

No, it's not really a bug. When you set a control source to an expression, the grid has got no way of knowing what needs to be updated. It's in the nature of things.

I understand your frustration with grids, but please don't give up on them completely. My own approach is to use grids for navigation and record-selection, rather than as a vehicle for data entry.

For example, I might display search results in a grid, and have the user double-click on a row to open a modal form for editing the contents of the row. I tend to make all my grids read-only, with AllowCellSelect set to .F., which avoids some of the issues you are seeing (although I do occasionally add a checkbox to a column and allow that column to be edited).

Mike


__________________________________
Mike Lewis (Edinburgh, Scotland)

My Visual FoxPro site: www.ml-consult.co.uk
 
Thanks Mike
That does make sense.
I have considered upgrading but do very little local app work these days as most of my apps are web based.
I am getting a bit more used grids and they are proving to be a much prettier alternative to browse windows which I use extesively throughout this particular app without problems. I needed to create an interface between his local app and his website in order to target his email advertising campaigns. There are 8 different categories of customer and all his customers could fall within any or all of the categories, hence the check boxes. Some of the boxes are auto filled by analysing his sales table but others need to be manually set. A grid is ideal for the purpose and is already being used, I have only today discovered that the email column is read only. I have worked round it by doing a universal 'lower' when the upload file is created and that seems to work ok.

Keith
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top