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!

Losing dblclick method on grid column

Status
Not open for further replies.

jrajesh

Programmer
Aug 12, 2001
72
HK
Hi gurus,
I have a grid on my form with its recordsource pointing to a cursor. The cursor is populated by an sql statement based on the user selected id in a combo box.

In the double-click event of every column and every column's control, I've inserted code to activate a form.

In the interactive change of the combobox, I set the grid's recordsource to nothing, populate the cursor and reset the grids' recordsource to the cursor's alias.

The grid gets populated ok but the dblclick event is not getting fired at all.
could someone help me please?

Thanks and regards,
Rajesh
 
Rajesh

I will assume that your a using the dblclick event of the texbox of the columns since columns do not have a dblclick event (unless you are refering to the header)
I cannot seem to be able to duplicate your problem. Does your grid end up disabled?
 
as mgagnon, I can not duplicate your problem.

have you tried just using the doubleclick method of the grid? Attitude is Everything
 
Hi,
Thanks for your responses.
I've the dblclick method in every column and its control as well.
Column1 as well as Column1.text1.
I solved the problem by creating custom textbox classes with the relevant code.
In the form load and page activate events, I 'removeobject' the default textcontrol and then addobject mytextbox to every column.
Much as this seems to work, this has created a new problem.
Every time the page gets activated, I get the following error message:
"A member object with this name already exists"

This, i get, despite having the statements:

Thisform.grid1.colselect.removeobject("Mytext")
Thisform.grid1.colselect.addobject("mytext","grdTxt")
thisform.grid1.colselect.currentcontrol="mytext"

Could someone please help?
Thanks all,
Regards,
Rajesh
 
jrajesh

I've the dblclick method in every column and its control as well.Column1 as well as Column1.text1.

Not that this is part of your current problem, can you explain how you get a dblclick event in a grid column, since the event by default do not exist?

>Thisform.grid1.colselect.removeobject("Mytext")
>Thisform.grid1.colselect.addobject("mytext","grdTxt")
>thisform.grid1.colselect.currentcontrol="mytext"

How do you reference your different columns? "colselect" do that loop through the different columns of the grid. You may also want to add a control with a different name then the one you are removing. This code might help (In the Init of the grid):
Code:
WITH THIS
	FOR EACH oColName IN .COLUMNS
	    LOCAL lcName
	    lcName = oColName.Name
		THIS.&lcName..REMOVEOBJECT("text1")
		THIS.&lcName..ADDOBJECT("text2","textbox")
		THIS.&lcName..CURRENTCONTROL="text2"
	ENDFOR
ENDWITH
N.B. The double dots (..) is NOT a typo. It's the correct syntax.






 
mgagnon,
Thanks for your response.
In my earlier post, I meant to type dblclick method for the grid as well as every columns' control. My mistake :)


How do you reference your different columns? "colselect" do that loop through the different columns of the grid. You may also want to add a control with a different name then the one you are removing. This code might help (In the Init of the grid):

Colselect is the name of the first column. I reference each column by its name (prefixed by the qualifier this.grid1....)

I'll certainly try what you've suggested. (for each ocolname....)

My problem is, apart from the dblclick method, I have valid, when etc., methods that should fire. But, once that I populate the grid from the cursor, I'm getting a readonly control despite having explicity set the enabled to .t. and readonly to .f. for the controls and the grid as well.

Thanks again for your response.
Warm regards,
Rajesh

 
Rajesh

One thing I found, adding controls to a grid, the visible property is by default set to .f. (I'm not sure why), but try setting it to .T.
 
mgagnon,
Thanks again for your response.
I've set the visible property to .t. in code.
Now, I've changed my approach and am sending the sql output to a temp. dbf instead of a cursor and all is fine.
But, this is a work-around and am not too happy with it.
I'll take a look at it when i get some free time and try to find/fix the problem.
Thanks a lot for all the help.
Warm regards,
Rajesh
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top