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

Add control to grid 1

Status
Not open for further replies.

imonko

MIS
Aug 6, 2001
8
US
How do you add a control object, specifially a command button, to a grid column.
 
Sorry, I forgot to include that I would like to add the object at design time so that I can place some code behind the click event.
 
Actually, you could do this 2 ways. One @ design and one @ run. What I did was:

Create a custom command button object (that would fit all the properties our app has (font, etc.)) and include the code in the click event of that object.

Once you've got that, go to the grid. Navigate,using the Properties form, down to the text control (I assume you want to remove it) in the column that you want to place the command button. Activate the form that contains the grid and press delete. The TextBox should be gone. Go to your form controls toolbar and select your command button (class library). Then click in the column where the textbox was. That should add that command button to that column.

If you do it at run-time it would be (maybe in the grid INIT or form INIT):

myForm.myGrid.Column1.removeobject("Text1") - if "Text1" is the name of the textbox in that column (I'm going from memory as I don't have the system here in front of me).
myFOrm.myGrid.Column1.addobject("myCommandButton")

That's it.

Hope this helps.
 
The only way I know of is to use cut/paste.

1) Add the object you want to your form.

2) Select the object, then press CTRL+X.

3) Select your grid, right click, and choose EDIT. Click on the column you want to add the control to, then press CTRL+V.

The control should then appear in your column. The TextBox will still be there, however, so you should either delete the TextBox or set the column's CurrentControl property to the new control so the grid will use it.

Ian
 
Thanks to both of you for your help.

My solution was:

1-Left click the grid, right click & select edit.

2-Left click the control I wanted from the toolbar.

3-Left click within one of the cells in the column I wanted the object to reside.
 
Another way
- Right click in the grid
- Choose Modify
- Now choose the button command from the form controls toolbar
- Click on the column you want to add the button command

Now go to that column's properties and change CurrentControl property for that column.

The interesting about this is that you can add as many controls as you want (buttons, spinners, GRIDS, edit boxex, and so on)

Good Luck

Rianeiro
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top