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

Drop Textbox Onto Grid/Textbox 1

Status
Not open for further replies.

xBaseDude

MIS
Jan 31, 2002
357
US
Amigos, my ultimate goal is to have 4 textbox objects on a gridtext box. 2 textbox across and 2 textbox down in One row One column of a grid/textbox.

I have been following previous threads for how to do this, but am experiencing this issue. The "dropped" textbox is not visible to me in the grid/textbox and I can't see it to position it.

ramani and Mike have indicated these are the steps to follow...


1) Right click on the grid
2) Select "Modify"
3) Now click on checkbox button in the forms toolbar
4) Left click in the white area (the record area) in the grid
5) Now left click in any empty space in the form (to deselect the grid)
6) Since initially the text object is selected for that column, you need the tell the grid to use the checkbox for that column: Left click the grid. Choose Properties. In the combobox in the properties window select the column where the checkbox is. Select "CurrentControl" property and change its value to the checkbox you just added.


1st issue Item 2 - Click "modify" I'm not seeing modify any where. (I'm using 70).

Should I be able to "see" the "dropped" textbox on the grid?

Thanx in Advance for your kind assistance.

(I will be in and out today...please forgive me if I don't respond immediately.)

sig_jugler.gif
...all this and tap dancing too!
 
If you want to configure four textboxes in a grid column with all of the visible at once during runtime and have them 2x2 side-by-side you are going to have to create a container class and put all 4 textboxes on it in the configuration you desire. Once you have your VCX ready with this new class then change the standard form cotrols toolbar to show your VCX instead, delete the textbox that is natively in the grid column and add this new container class and you now have 4 textboxes in a single column sitting side-by-side like you want.

Slighthaze = NULL
 
Amigos, my ultimate goal is to have 4 textbox objects on a gridtext box. 2 textbox across and 2 textbox down in One row One column of a grid/textbox.

Here is an example (by code) to acheive what may be useful (two column wide grid and two textboxes "high" for each records using a container). But in order to achieve what you need, you would need a container. Copy the following in a program and run it.

Code:
Public oform1
oform1=Newobject("form1")
oform1.AddObject("grid1","grid1")
oform1.grid1.column1.addobject("mytextboxes","myTextboxes")
oform1.grid1.column2.addobject("mytextboxes","myTextboxes")
oform1.grid1.column1.currentcontrol="mytextboxes"
oform1.grid1.column2.currentcontrol="mytextboxes"
oForm1.grid1.column1.sparse = .f.
oForm1.grid1.column2.sparse = .f.
oForm1.grid1.column1.width = 150
oForm1.grid1.column2.width  = 150
Oform1.grid1.column1.myTextboxes.text1.controlsource="myCursor.name"
Oform1.grid1.column1.myTextboxes.text2.controlsource="myCursor.address"
Oform1.grid1.column2.myTextboxes.text1.controlsource="myCursor.phone"
Oform1.grid1.column2.myTextboxes.text2.controlsource="myCursor.zip"
oform1.Show
Return
Define Class form1 As Form
	Top = 4
	Left = -1
	DoCreate = .T.
	Caption = "Form1"
	Name = "Form1"
	Procedure Load
	Create Cursor myCursor (Name c(10),address c(10),phone c(10),zip c(7))
	Insert Into myCursor (Name,address,phone,zip) Values ("Mike","123","555-123-1234","213456")
	Insert Into myCursor (Name,address,phone,zip) Values ("John","321","555-321-4321","99876")
	Go Top
Endproc
Enddefine
Define Class grid1 As Grid
	ColumnCount =2
	RowHeight = 81
	Visible = .T.
Enddefine
DEFINE CLASS mytextboxes AS container
	Width = 133
	Height = 84
	Name = "mytextboxes"
	visible = .t.
	ADD OBJECT text1 AS textbox WITH ;
		Height = 23, ;
		Left = 12, ;
		Top = 12, ;
		Width = 100, ;
		Name = "Text1",;
		visible = .t.
	ADD OBJECT text2 AS textbox WITH ;
		Height = 23, ;
		Left = 12, ;
		Top = 48, ;
		Width = 100, ;
		Name = "Text2",;
		visible = .t.
ENDDEFINE


Mike Gagnon

If you want to get the best response to a question, please check out FAQ184-2483 first.
 
Slighthaze...Mike!!!

Eureka Moment!!!

Tres Kewl...it took a few times, but I got it!

Maybe some more questions later as I am still playing with it. But it's great, thank-you!

But does that "container" have to be visible on the grid prior to a qry being run? imho I don't want the container/texboxes to be there prior to running the query.

Mike...you never cease to amaze me with your "hand coded" examples...I can barely whip them off with the forms designer, and they just seem to flow off your finger tips.

I salute you sir!

Regards - Wayne

sig_jugler.gif
...all this and tap dancing too!
 
xBaseDude,

Create examples as a class and then export your class code from the class browser. This will give you most of the code you need to post a working example to this forum similar to what Mike does. When I first saw Mike do this I could see the value of it and appreciated Mike explaining what he does to create it. I mean what could be better than posting a cut-n-paste solution or example of a problem?!

Slighthaze = NULL
 
XbaseDude
But does that "container" have to be visible on the grid prior to a qry being run? imho I don't want the container/texboxes to be there prior to running the query.

No, no record, no container appears.

Mike...you never cease to amaze me with your "hand coded" examples...I can barely whip them off with the forms designer, and they just seem to flow off your finger tips.

The difference is after so many years of doing this, you got the idea now, but I did it 5 years ago, and still using that double record in a grid record. So I just remember how to do it, while you have to figure out how to do it.


SlightHaze is right in the way to achieve what I do, although I must admit that I've gotten use to it, and I use this technique in actual application design. But it does work nicely for Tek-Tips, and "most" of the time the code produce in the class browser is usable as cut and paste, except for grids maybe where the code produced do not work in a cut and paste.


Mike Gagnon

If you want to get the best response to a question, please check out FAQ184-2483 first.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top