[Gambas-user] Drop text on not selected line of ListBox

Bruce Steers bsteers4 at gmail.com
Wed Mar 1 12:40:42 CET 2023


On Wed, 1 Mar 2023 at 07:32, Fabien TONIUTTI <fabien.toniutti at free.fr>
wrote:

> !! All in the title !! GB3.18
>
> What should be code written in Drop event method to change text to a non
> selected line in ListBox?
>
> (i think line should  be selected during mouseup)
>
> exemple:
>
> Public Sub Label1_Drag()
> Last.Drag(Label1.Text)
> End
>
> Public Sub ListBox1_Drop()
> "????????" = Drag.data
> End
>
> Thx a lot for your support
>

you can use FindChild to get the gridview object inside the listbox then
use gridview RowAt to get the item.


Public Sub ListBox1_Drop()

  Dim gv As Gridview = ListBox1.FindChild(Drag.X, Drag.Y)
  Dim iIndex As Integer = gv.RowAt(Drag.Y)
  ListBox1[iIndex].Text = Trim(Drag.Paste("text/plain"))

End

BruceS
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.gambas-basic.org/pipermail/user/attachments/20230301/ac3ae692/attachment.htm>


More information about the User mailing list