Welcome To The Home Of The Visual FoxPro Experts  
home. signup. forum. archives. search. google. articles. downloads. faq. members. weblogs. file info. rss.
 From: Mike Gagnon
  Where is Mike Gagnon?
 Pointe Claire
 Canada
 Mike Gagnon
 To: Geirr Eggen
  Where is Geirr Eggen?
 Vestnes
 Norway
 Geirr Eggen
 Tags
Subject: RE: Multiple lines when browseing records
Thread ID: 78352 Message ID: 78485 # Views: 2 # Ratings: 0
Version: Visual FoxPro 9 Category: Forms
Date: Tuesday, October 04, 2005 12:08:10 PM         
   


As Barbara states, it is difficult to see what is wrong. But here is the solution via code. Run the following in a program to make sure it works for you and check all the properties to see which one is missing.
Public oform1
oform1=Newobject("form1")
oform1.AddObject("grid1","grid1")
oform1.grid1.column1.AddObject("mycontainer1","mycontainer")
oform1.grid1.column1.Width = 200
oform1.grid1.column1.CurrentControl="mycontainer1"
oform1.grid1.column1.Sparse=.F.
oform1.Show
Return
Define Class form1 As Form
	Top = 0
	Left = 0
	Height = 278
	Width = 293
	DoCreate = .T.
	Caption = "Form1"
	Name = "Form1"
	Procedure Load
		Create Cursor mycursor (Name c(20),address c(20))
		Insert Into mycursor (Name,address) Values ("Mike","12345")
		Insert Into mycursor (Name,address) Values ("Frank","54321")
		Locate
	Endproc
Enddefine
Define Class grid1 As Grid
	ColumnCount = 1
	DeleteMark = .F.
	Height = 224
	Left = 24
	Panel = 1
	RowHeight = 92
	Top = 24
	Width = 216
	Name = "Grid1"
	Visible = .T.
Enddefine
Define Class mycontainer As Container
	Width = 168
	Height = 88
	Name = "mycontainer"
	Add Object text1 As TextBox With ;
		ControlSource = "mycursor.name", ;
		Height = 23, ;
		Left = 36, ;
		Top = 12, ;
		Width = 100, ;
		Name = "Text1"
	Add Object text2 As TextBox With ;
		ControlSource = "mycursor.address", ;
		Height = 23, ;
		Left = 36, ;
		Top = 48, ;
		Width = 100, ;
		Name = "Text2"
Enddefine



> Ok, ok.
> Yes I did set seperatly ControlSource for each field, coresponding to the underlaying table. I am sorry if my lousy english writing make any misunderstandings!
>
> Maybe if I explain what happening here, it will be easier to understand what I have done wrong.
>
> In the table I have put three record for testing purpose. The main index field are an autonumber (integer) field. For some reason, the record nr. 1 where a blank record, only the autonumer field has a value (1).
>
> When I run the app, the grid apears with three empty containers - or empty records - in the grid.
>
> When I tried to browse the records through the new controll(container) in the grid, every text field where empty. When I tried to put a value in one of the field, the same value where DISPLAYED in the same text field in all record, when I select the those records. e.g.: if I put Geirr in text field named FirstName, I got displayed this value in every FirtName box in the grid, when records are selected.
>
> Then I browsed (Through the project manager) the table, and I find this value (Geirr) in the first record only.
> But when I run the app againg, the text box (FirstName) is empty in all record displayed in the grid.
>
> It seems like the container don't get any values from the underlaying table for displaying. But when exiting the app, I hav seen the written value have beed saved to the coresponding fiels in the underlaying table.
>
> Mvh
> Geirr
>
> > You only answered part of the question Barbara asked;
> > You need to set the ControlSource for each textbox in the control.
> >
> > That is the important part.
> >
> >
> > > Sorry, I used the "elpise" ... just as a shorthand for telling You that the rest of the controls are set up with similar underlaying fields in the table.
> > > And yes, both the Grid.column.bound and -.sparse = .F.
> > >
> > > > As I understand it, you have more than one textbox in the tagg41 container, correct? Is taggid the name of one of those textboxes? It looks like that's the only one you're setting the ControlSource for. You need to set the ControlSource for each textbox in the control.
> > > >
> > > > Also, have you set Grid.column.bound = .F.?
> > > >
> > > >
> > > > -BP
> > > > www.peisch.com


ENTIRE THREAD

Multiple lines when browseing records Posted by Geirr Eggen @ 10/1/2005 9:06:50 AM
RE: Multiple lines when browseing records Posted by Mike Gagnon @ 10/1/2005 12:52:44 PM
RE: Multiple lines when browseing records Posted by Geirr Eggen @ 10/1/2005 10:18:39 PM
RE: Multiple lines when browseing records Posted by Barbara Peisch @ 10/2/2005 4:05:33 AM
RE: Multiple lines when browseing records Posted by Geirr Eggen @ 10/2/2005 8:47:34 AM
RE: Multiple lines when browseing records Posted by Barbara Peisch @ 10/2/2005 9:31:53 AM
RE: Multiple lines when browseing records Posted by Geirr Eggen @ 10/2/2005 6:22:13 PM
RE: Multiple lines when browseing records Posted by Barbara Peisch @ 10/2/2005 7:36:32 PM
RE: Multiple lines when browseing records Posted by Mike Gagnon @ 10/2/2005 4:07:29 AM
RE: Multiple lines when browseing records Posted by Geirr Eggen @ 10/2/2005 8:52:51 AM
RE: Multiple lines when browseing records Posted by Geirr Eggen @ 10/2/2005 6:13:33 PM
RE: Multiple lines when browseing records Posted by Mike Gagnon @ 10/2/2005 6:51:48 PM
RE: Multiple lines when browseing records Posted by Geirr Eggen @ 10/2/2005 10:39:26 PM
RE: Multiple lines when browseing records Posted by Barbara Peisch @ 10/2/2005 11:02:49 PM
RE: Multiple lines when browseing records Posted by Geirr Eggen @ 10/2/2005 11:59:09 PM
RE: Multiple lines when browseing records Posted by Mike Gagnon @ 10/3/2005 2:14:31 AM
RE: Multiple lines when browseing records Posted by Geirr Eggen @ 10/3/2005 6:19:07 PM
RE: Multiple lines when browseing records Posted by Barbara Peisch @ 10/3/2005 10:40:25 PM
RE: Multiple lines when browseing records Posted by Geirr Eggen @ 10/4/2005 8:24:24 PM
RE: Multiple lines when browseing records Posted by Barbara Peisch @ 10/4/2005 9:45:06 PM
RE: Multiple lines when browseing records Posted by Geirr Eggen @ 10/6/2005 10:36:33 PM
RE: Multiple lines when browseing records Posted by Barbara Peisch @ 10/7/2005 8:29:04 PM
RE: Multiple lines when browseing records Posted by Geirr Eggen @ 10/8/2005 10:44:44 PM
RE: Multiple lines when browseing records Posted by Barbara Peisch @ 10/9/2005 4:57:04 AM
RE: Multiple lines when browseing records Posted by Geirr Eggen @ 10/9/2005 9:01:11 AM
RE: Multiple lines when browseing records Posted by Mike Gagnon @ 10/4/2005 12:08:10 PM