Article Preview
Buy Now
| PDF: |
Ask The Experts
Article
Issue: 1.2 (October/November 2002)
Author: Seth Willits
Article Description: No description available.
Article Length (in bytes): 8,621
Starting Page Number: 32
RBD Number: 1115
Resource File(s):
1115.sit Updated: Friday, October 17, 2003 at 12:19 PM
Related Link(s): None
Known Limitations: None
Excerpt of article text...
Q: I want the user to be able to either select a cell in the listbox or to be able to edit the text in it. I tried setting the CellType to 3 but then I can't select the row.
A:
What you'll need to do is use the CellClick event to determine if the same cell was clicked twice within a set period of time and if so set that cell to be editable. This allows the user to click once to select the row and double click to edit the cell.
Since more than one listbox with these editable cells could exist in a window, the easiest and most efficent solution will require a listbox subclass. All of the code will go into the specified events of a listbox subclass called EditCellsLB.
EditCellsLB Properties
Create the following properties in the EditCellsLB subclass:
LastClick as integer
LastClickRow as integer
LastClickColumn as integer
LastClickCellType as integer
DoubleClickTime as integer
EditCellsLB Open Event
In the Open event of the listbox we will find out the maximum time allowed between two clicks for it to be a valid double click. We do this using declares. On the Macintosh (both in Classic and Carbon) this time is specified in ticks (1/60th of a second), but on Windows operating systems it is specified in milliseconds (1/1000th of a second). (The complete code for this is available for download.)
...End of Excerpt. Please purchase the magazine to read the full article.
Article copyrighted by REALbasic Developer magazine. All rights reserved.
|







