realbasic-nug
[Top] [All Lists]

navigate listbox with arrow keys

To: RB list <realbasic-nug@lists.realsoftware.com>
Subject: navigate listbox with arrow keys
From: Don Jungk <rb@flippingdades.com>
Date: Sun, 29 Jun 2008 12:02:26 -0500
Authentication-results: mx.google.com; spf=neutral (google.com: 74.124.194.228 is neither permitted nor denied by best guess record for domain of realbasic-nug-bounces@lists.realsoftware.com) smtp.mail=realbasic-nug-bounces@lists.realsoftware.com
Delivered-to: listarchive@realsoftware.com
Reply-to: REALbasic NUG <realbasic-nug@lists.realsoftware.com>
Sender: realbasic-nug-bounces@lists.realsoftware.com
User-agent: KMail/1.9.3
Hi all,
I've used the same general code to navigate between cells in a listbox in a 
number of projects without problems until now. In this project the listbox 
has 8, 12 16 or 20 columns and between 15 and 30 rows. The code I'm using is 
in the CellKeyDown event and printed at the end of this email.

It was working and suddenly, if the current EditCell is in row 4 or higher, 
hitting the up arrow will change the selected row to the next higher one, but 
does not open the EditCell. The other arrows all work. "Up" works if in 
columns 0 - 3.  A message box before the call to EditCell makes it work 
properly. Also, delaying it 100 ms with a timer makes it work.

So, I guess my questions are:
1) Have I been depending on some order of events that I wasn't aware of?
2) Is there a better way to do this?

RB2006r4Pro, Linux
I've only seen this result on my Linux machine, but since the program is to be 
used on WindowsXP, I will test it there on Monday.


  If asc(key) = 28 then  // we only edit even numbered cells
    If column = 0 then
      me.EditCell(row, me.ColumnCount - 2)
    Else
      me.EditCell(row, column - 2)
    End If
  End If
  If asc(key) = 29 then
    If column >= me.ColumnCount - 2 then
      me.EditCell(row, 0)
    Else
      me.EditCell(row, column + 2)
    End If
  End If
  If asc(key) = 30 then
    //  msgbox ""   --> uncommenting this makes it work correctly
    // or using a timer to delay it 100ms makes it work.
    If row = 0 then
      me.EditCell(me.ListCount - 1, column)
    Else
      me.EditCell(row - 1, column)
    End If
  End If

Don Jungk

_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>

Search the archives:
<http://support.realsoftware.com/listarchives/lists.html>


<Prev in Thread] Current Thread [Next in Thread>
  • navigate listbox with arrow keys, Don Jungk <=