[Solved] Command buttons on GridView view

Post your Gambas programming questions here.
Post Reply
AndyGable
Posts: 363
Joined: Wednesday 2nd December 2020 12:11am
Location: Northampton, England
Contact:

[Solved] Command buttons on GridView view

Post by AndyGable »

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)

Image

If anyone could show me an example or point me in the right direction that would be most appreciated.

Thanks

Andy
Last edited by AndyGable on Thursday 5th October 2023 9:14pm, edited 2 times in total.
User avatar
BruceSteers
Posts: 1579
Joined: Thursday 23rd July 2020 5:20pm
Location: Isle of Wight
Contact:

Re: Command buttons on DataGrid view

Post by BruceSteers »

What's a DataGrid view ?

I cannot find DataGrid on the wiki anywhere.
If at first you don't succeed , try doing something differently.
BruceS
AndyGable
Posts: 363
Joined: Wednesday 2nd December 2020 12:11am
Location: Northampton, England
Contact:

Re: Command buttons on GridView view

Post by AndyGable »

My bad I am so sorry it is a GridView (DataGrid is from VB.NET I'm still migrating over from windows)
User avatar
BruceSteers
Posts: 1579
Joined: Thursday 23rd July 2020 5:20pm
Location: Isle of Wight
Contact:

Re: Command buttons on GridView view

Post by BruceSteers »

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
Attachments
GridFakeButtons-0.0.1.tar.gz
(13.15 KiB) Downloaded 79 times
Untitled.png
Untitled.png (110.54 KiB) Viewed 2002 times
If at first you don't succeed , try doing something differently.
BruceS
vuott
Posts: 263
Joined: Wednesday 5th April 2017 6:07pm
Location: European Union

Re: Command buttons on GridView view

Post by vuott »

AndyGable wrote: Saturday 16th September 2023 7:54pm how I can have a set of command buttons on a row on a GridView?
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.
AndyGable
Posts: 363
Joined: Wednesday 2nd December 2020 12:11am
Location: Northampton, England
Contact:

Re: Command buttons on GridView view

Post by AndyGable »

vuott wrote: Wednesday 20th September 2023 8:01am
AndyGable wrote: Saturday 16th September 2023 7:54pm how I can have a set of command buttons on a row on a GridView?
If you want, you can insert a Button in a cell of the GridView:
:? https://www.gambas-it.org/wiki/index.ph ... a_GridView
Thank for that post I shall have a read and go from there

This is what I am looking for :)
Post Reply