[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Gridview with spinbox
[Thread Prev] | [Thread Next]
- Subject: Re: Gridview with spinbox
- From: Bruce Steers <bsteers4@xxxxxxxxx>
- Date: Sat, 8 Mar 2025 12:09:32 +0000
- To: user@xxxxxxxxxxxxxxxxxxxxxx
On Sat, 8 Mar 2025 at 03:54, Shane Powell <buster6seven@xxxxxxxxx> wrote: > hi I'm trying to make a spin box in a grid-view column with this code > > Dim spn As SpinBox = New SpinBox(GridView1) As "spnEditor" > > and then size it with > > spn.Expand = False > > spn.Move(GridView1.Current.X, GridView1.Current.Y, 20, 20) > > but when the program runs it expands to the size of GridView1 > > what am i doing wrong > > Cheers Shane. The main problem is you are treating a GridView like a Container/Panel , but it is not a Container or a Panel it is a Control with it's own particular internal layout. Simply adding a SpinBox directly to GridView1 is really not going to work. You can cheat and overlay controls over the gridview but their placement/size needs to be managed as it's not inside a normal container. One trick is to use GridView1.Children[0] (this is the ScrollArea of the gridview and does not have Arrangement set allowing free placement of anything) The following example adds 2 items to a GridView and SpinBox's for the 2 items. Public Sub Form_Open() Dim sp As SpinBox GridView1.Columns.Count = 2 GridView1.Rows.Count = 2 GridView1[0, 0].Text = "Left text 1" GridView1[0, 1].Text = "Right text 1" GridView1[1, 0].Text = "Left text 2" GridView1[1, 1].Text = "Right text 2" sp = New SpinBox(GridView1.Children[0]) As "Spin" sp.Name = "item 0" sp.W = 100 sp.H = GridView1.Rows.Height sp.X = Me.W - 100 sp.Y = GridView1.Rows[0].Y + GridView1.Columns.Height ' (Remove + GridView1.Columns.Height if not using headers) sp = New SpinBox(GridView1.Children[0]) As "Spin" sp.Name = "item 1" sp.W = 100 sp.H = GridView1.Rows.Height sp.X = Me.W - 100 sp.Y = GridView1.Rows[1].Y + GridView1.Columns.Height End Public Sub Spin_Change() Debug Last.Name, Last.Value End I hope that makes sense :) BruceS
Re: Gridview with spinbox | BB <adamnt42@xxxxxxxxx> |
Gridview with spinbox | Shane Powell <buster6seven@xxxxxxxxx> |