Hi everyone
Not sure if this has been asked before but I need some help, does anyone know how I can have a set of command buttons on a row on a GridView?
Below is a example of what I mean (what I want to have is edit / delete / duplicate)
If anyone could show me an example or point me in the right direction that would be most appreciated.
Thanks
Andy
[Solved] Command buttons on GridView view
-
- Posts: 363
- Joined: Wednesday 2nd December 2020 12:11am
- Location: Northampton, England
- Contact:
[Solved] Command buttons on GridView view
Last edited by AndyGable on Thursday 5th October 2023 9:14pm, edited 2 times in total.
- BruceSteers
- Posts: 1597
- Joined: Thursday 23rd July 2020 5:20pm
- Location: Isle of Wight
- Contact:
Re: Command buttons on DataGrid view
What's a DataGrid view ?
I cannot find DataGrid on the wiki anywhere.
I cannot find DataGrid on the wiki anywhere.
If at first you don't succeed , try doing something differently.
BruceS
BruceS
-
- Posts: 363
- Joined: Wednesday 2nd December 2020 12:11am
- Location: Northampton, England
- Contact:
Re: Command buttons on GridView view
My bad I am so sorry it is a GridView (DataGrid is from VB.NET I'm still migrating over from windows)
- BruceSteers
- Posts: 1597
- Joined: Thursday 23rd July 2020 5:20pm
- Location: Isle of Wight
- Contact:
Re: Command buttons on GridView view
Thank you.
A GridView is a ScrollView at heart and the grid and it's items are drawn.
So it's contents (cells) are not individual containers you can add controls to like Buttons.
The easiest way to get what you want is to use the _GridView_Cell.Picture property to use an image and make it act like a button.
See the attached project.
I customised GridView to have a .MakeButton() method
GridView1.MakeButton(GridView1.Rows.Max, 0, "icon:/22/edit")
It makes a fake button and responds to clicks using a ButtonClick() event.
Public Sub GridView1_ButtonClick(Row As Integer, Column As Integer)
Putting the attached projects GridView.class in your own projects .src directory and hitting "compile all" will allow you to do the same for your GridViews
A GridView is a ScrollView at heart and the grid and it's items are drawn.
So it's contents (cells) are not individual containers you can add controls to like Buttons.
The easiest way to get what you want is to use the _GridView_Cell.Picture property to use an image and make it act like a button.
See the attached project.
I customised GridView to have a .MakeButton() method
GridView1.MakeButton(GridView1.Rows.Max, 0, "icon:/22/edit")
It makes a fake button and responds to clicks using a ButtonClick() event.
Public Sub GridView1_ButtonClick(Row As Integer, Column As Integer)
Putting the attached projects GridView.class in your own projects .src directory and hitting "compile all" will allow you to do the same for your GridViews
- Attachments
-
- GridFakeButtons-0.0.1.tar.gz
- (13.15 KiB) Downloaded 85 times
-
- Untitled.png (110.54 KiB) Viewed 2046 times
If at first you don't succeed , try doing something differently.
BruceS
BruceS
Re: Command buttons on GridView view
If you want, you can insert a Button in a cell of the GridView:
https://www.gambas-it.org/wiki/index.ph ... a_GridView
Europaeus sum !
Amare memorentes atque deflentes ad mortem silenter labimur.
Amare memorentes atque deflentes ad mortem silenter labimur.
-
- Posts: 363
- Joined: Wednesday 2nd December 2020 12:11am
- Location: Northampton, England
- Contact:
Re: Command buttons on GridView view
Thank for that post I shall have a read and go from therevuott wrote: ↑Wednesday 20th September 2023 8:01amIf you want, you can insert a Button in a cell of the GridView:
https://www.gambas-it.org/wiki/index.ph ... a_GridView
This is what I am looking for