LindaRichard
Programmer
I am trying to add a custom text box to a grid without
success.
I created a custom textbox called mytextbox using the
class editor. In the click event I placed the text
messagebox ("Hello"
I then created a form and added a grid control to the form.
Using tools,options,controls,visual class librairies,
I added the custom class that I created to the form.
I then set the recordsource for the grid to my data table
and placed the following code in forms INIT
WITH thisform.grid1
LOCAL i
FOR i=1 TO .columncount
.columns(i).addobject("mytextbox1","mytextbox"
.columns(i).CurrentControl="mytextbox1"
.columns(i).removeobject("Text1"
.columns(i).sparse=.t.
NEXT i
ENDWITH
When I run the form the data appears in the grid,
but when I click no message.
When I check for currentcontrol in each column I get
mytextbox1. So that seems to be setting fine.
If I drag my custom text box from the form controls
dialog (view classes) onto the form, a text control called
mytextbox1 is created. I then run the form
and click on the custom text box and get the
message Hello. So the custom text box works outside the
grid but not when placed in the grid.
Does anyone have any suggestion as to why adding the
custom text box to the grid control is not working.
What am I forgetting to set in the grid?
Thanks for your help
Linda
success.
I created a custom textbox called mytextbox using the
class editor. In the click event I placed the text
messagebox ("Hello"
I then created a form and added a grid control to the form.
Using tools,options,controls,visual class librairies,
I added the custom class that I created to the form.
I then set the recordsource for the grid to my data table
and placed the following code in forms INIT
WITH thisform.grid1
LOCAL i
FOR i=1 TO .columncount
.columns(i).addobject("mytextbox1","mytextbox"
.columns(i).CurrentControl="mytextbox1"
.columns(i).removeobject("Text1"
.columns(i).sparse=.t.
NEXT i
ENDWITH
When I run the form the data appears in the grid,
but when I click no message.
When I check for currentcontrol in each column I get
mytextbox1. So that seems to be setting fine.
If I drag my custom text box from the form controls
dialog (view classes) onto the form, a text control called
mytextbox1 is created. I then run the form
and click on the custom text box and get the
message Hello. So the custom text box works outside the
grid but not when placed in the grid.
Does anyone have any suggestion as to why adding the
custom text box to the grid control is not working.
What am I forgetting to set in the grid?
Thanks for your help
Linda