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

Close a Grid by Double Clicking a Cell

Status
Not open for further replies.

stanlyn

Programmer
Sep 3, 2003
945
US
Hi,

I need to setup a form grid where ColumnCount = -1 to allow double clicking a cell with code to close the grid while selecting the clicked record. This is easy when ColumnCount is not -1 and code in the cell's text methods. Just not been able to get it to work with a -1 value.

Thanks,
Stanley


 
Hi Tom,

I'll do some research and have never used it...

Thanks,
Stanley
 
If you want to execute code on a double click event of an element just register a listener, like tomk3 suggested, with the BINDEVENT function.


You can check the BINDEVENT documentation here:


The name of the event you have to register is "dblclick"


You can also register it from the GUI:
img_xwdnjm.png
 
Hello,

basically you can add a method dothefocus to the form
after grid is initialised :
FOR EACH loCol IN Thisform.myGrid.Columns
BINDEVENT( loCol.Text1 , "LostFocus" , Thisform , "dothefocus" )
ENDFOR

or se here for more details and a maybe matching sample :

hth
tom
 
If columncount is -1, well, there is no grid, there are no columns, no headers, no records, no grid lines.

I wonder if you overlook something in your usage of the grid. For example, that it grabs an active workarea and adds columns at runtime, if you don't do it at design time. So you use a normal grid with columncount>0 in the end.

Chriss
 
Hi Chriss,

Chriss said:
If columncount is -1, well, there is no grid, there are no columns, no headers, no records, no grid lines.

This is true at design time, but not true at runtime. The only dblclick method is at the grid level at design time as there are no other grid child controls.

I'm going to play around with Tom's idea as I see looks doable.

Thanks, Stanley


 
Hi Tom.

I got it working and it works perfectly. I used your routine...
Code:
FOR EACH loCol IN Thisform.myGrid.Columns
    BINDEVENT( loCol.Text1 , "LostFocus" , Thisform , "dothefocus" )
ENDFOR

Thanks again,
Stanley

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top