[Gambas-user] Obtaining the contents of a particular Listbox index

Rob sourceforge-raindog2 at ...94...
Thu Aug 19 19:27:48 CEST 2004


On Thursday 19 August 2004 10:55, Michael Sullivan wrote:
> status is either "Not Started" or "In Progress".  I need to be
> able to change the text of the currently selected item in
> lstStatus from "Not Started" to "In Progress", but every time

Here's some code that fills a listbox named ListBox1 with A to Z, 
and then when you click on an entry in the listbox it toggles it 
from being in parens to not.  You should be able to derive how 
to make this work with lstStatus in your project based on input 
from somewhere else besides its click event.

Rob

PUBLIC SUB Form_Open()

  DIM i AS Integer
  FOR i = 1 TO 26
    listbox1.Add(Chr(i + 64))
  NEXT

END

PUBLIC SUB ListBox1_Click()

  IF Left(listbox1.current.Text,1) = "(" THEN
    listbox1.current.Text = Mid(listbox1.current.Text,2,1)
  ELSE
    listbox1.current.Text = "(" & listbox1.current.Text & ")"
  ENDIF

END






More information about the User mailing list