Listbox Cell Q.

I start out with a generic listbox and I am struggling on the non editible cells. I can’t seem to be able to get a cellclick or cellfocus event to fire until I have my code make that field editable. How would I address the non editable cells?


How do you expect those events to fire?

CellClicked is called when you click in a specific cell. It does not have to be editable.

CellGotFocus is called when the cell is editable and the focus goes to it (by clicking or calling EditCell, for example).

Yes that is what I understand as I set the celltype of 3 to make them editable. I just wanted to know how to access to non editable cells if its possible. Would I use the cellbackground possibly? I just want to see a click on the non editable area of the listbox and then run a method.

I just did a quick test and CellClicked is called when you click in a specific, non-editable cell.

Hmm weird as I have tried that also. Here is my event. Ill keep at it since you verified it should work. Thanks Paul!

I am on Xojo 2013 R2 BTW.

  // Setup Default Behavior
  Me.ColumnsResizable = True
  me.RequiresSelection = false
  Me.ColumnCount = 8
  Me.HasHeading = True
  Me.AutoHideScrollbars = false
  Me.ScrollBarHorizontal = True
  Me.ScrollBarVertical = True
  Me.GridLinesHorizontal = 3
  Me.GridLinesVertical = 3
  Me.UseFocusRing = false
  Me.ColumnWidths = "90,90,90,90,60,60,60,60"
  Me.TextFont = "System"
  me.TextSize = 12
  me.SelectionType = 1 
  me.DefaultRowHeight = 20
  // Set Initial Fields
  dim GroupVar as String
  dim NewListboxIndex as integer
  // Column Details
  Me.Heading(0) = "Group Name"
  Me.HeaderType(0) =listbox.HeaderTypes.Sortable
  Me.Heading(1) = "Username"
  Me.HeaderType(1) =listbox.HeaderTypes.Sortable
  Me.Heading(2) = "Password"
  Me.HeaderType(2) =listbox.HeaderTypes.Sortable
  Me.Heading(3) = "Enable PW"
  Me.HeaderType(3) =listbox.HeaderTypes.Sortable
  Me.Heading(4) = "TELNET"
  Me.HeaderType(4) =listbox.HeaderTypes.NotSortable
  Me.Heading(5) = "SSH"
  Me.HeaderType(5) =listbox.HeaderTypes.NotSortable
  Me.Heading(6) = "HTTP"
  Me.HeaderType(6) =listbox.HeaderTypes.NotSortable
  Me.Heading(7) = "HTTPS"
  Me.HeaderType(7) =listbox.HeaderTypes.NotSortable
  // Add Default Data #1
  Me.AddRow "Group0"
  me.CellAlignment(me.LastIndex,0) = 1
  me.CellAlignment(me.LastIndex,1) = 1
  me.CellAlignment(me.LastIndex,2) = 1
  me.CellAlignment(me.LastIndex,3) = 1
  Me.CellType(Me.LastIndex,4) = Listbox.TypeCheckbox
  Me.CellState(Me.LastIndex,4) = CheckBox.CheckedStates.Checked
  Me.CellType(Me.LastIndex,5) = Listbox.TypeCheckbox
  Me.CellState(Me.LastIndex,5) = CheckBox.CheckedStates.Unchecked
  Me.CellType(Me.LastIndex,6) = Listbox.TypeCheckbox
  Me.CellState(Me.LastIndex,6) = CheckBox.CheckedStates.Unchecked
  Me.CellType(Me.LastIndex,7) = Listbox.TypeCheckbox
  Me.CellState(Me.LastIndex,7) = CheckBox.CheckedStates.Checked

  // Check to see if there are Rows of Data if not then disable "remote button"
  if me.ListCount = 0 then
    PreferencesWindow.CredentialGroupDeleteButton.Enabled = false
  end if

My screen shot

My Listbox.CellClicked - Notice the messagebox.

  MsgBox "CLicked"
  if column = 4 then
  elseif column = 5 then
  elseif column = 6 then
  elseif column = 7 then
  end if
  CaptureColumnCellClick = column
  CaptureRowCellClick = Row

I can only get the listbox.cellclick to fire when my cell is editable. :frowning: