Benoit Griveau (a French guy) said to me:
"Place the following code in the ListBox CellClick event:"
Me.EditCell(Row,Column)
After sometimes and some mails, I finally do that and ... miracle: it works.
There is a bug in my code (far below) or in 2007r2 ("Not a bug" will
says the tester, so, no, I will no write any bug report there).
But I have a working solution.
BTW: I loaded the project under Windows, and even if all Cells were
editable, I had to double-click to be able to edit a Cell.
I just checked Benoit's advice on Windows and it worked better than my
code: one click only and works everytime.
Bah, that's life, this feature will be corrected sometimes in the future
now that RS Engineers are using the "current" REALbasic version to build
the next one.
Thanks to everyone,
Emile
> Date: Thu, 31 May 2007 08:23:05 -0700
> From: Terry Ford <tmford at shaw dot ca>
> Subject: Re: Another ListBox "gotcha": TypeEditable and the ListBox Open Event
> To: REALbasic NUG <realbasic-nug at lists dot realsoftware dot com>
> Message-ID: <F95AE146-0C8D-4573-A408-D1F3D6FBA012 at shaw dot ca>
> Content-Type: text/plain; charset=US-ASCII; delsp=yes; format=flowed
>
>
> On May 31, 2007, at 8:08 AM, Tim Jones wrote:
>
>
>> > On May 31, 2007, at 6:17 AM, Emile Schwarz wrote:
>> >
>>
>>> >> Hi all,
>>> >> What must I do ?
>>> >>
>>> >> a. The Window's Open event seems to be the place to set the
>>> >> ColumnType
>>> >> (but not the CellType if the ListBox is empty).
>>>
>> >
>> > Actually, the Listbox's Open event is where to do this. However, I
>> > suspect that the CellType and ColumnType calls are defined to work on
>> > one entity per call, so it looks like you'll need something like:
>> >
>> > Sub Open
>> > Dim x As Integer
>> > For x = 0 to Me.ColumnCount - 1
>> > Me.ColumnType(x) = ListBox.TypeEditable
>> > Next
>> > End Sub
>> >
>>
>>> >> b. Issue a Bug Report ?
>>>
>> >
>> > No - it sounds like a Feature request.
>>
>
> I'd like to know how he does this:
>
>
>> > So, for debug purposes, I set the CellTag(0,0) to TypeEditable and
>> > CellTag(0,1) to TypeCheckBox (*) in the ListBox MouseDown Event.
>>
I too!
In fact, the real code is (in a module):
//
// Method: SetColumnsEditable
// Inputs: LB As ListBox
// Outputs: None
// Syntax: mFileIO.SetColumnsEditable LB
// Allows the user to edit the entries in all columns
Dim ColCnt As Int8
Dim ColIdx As Int8
// Get the number of columns in this ListBox
ColCnt = LB.ColumnCount - 1 // 0-Based
// Avoid the (future, potential, eventual) Int8 overflow
If ColCnt > 255 Then
// Normally, there are only two columns
LB.ColumnType(0) = ListBox.TypeEditable
LB.ColumnType(1) = ListBox.TypeEditable
// Return silently
Return
Else
// Set all Columns Editable
For ColIdx = 0 To ColCnt
// Set Columns ColIdx as Editable
LB.ColumnType(ColIdx) = ListBox.TypeEditable
// I only need to copy the Cell contents, “no write”
// To avoid "1, Infinite Loop"
If UserCancelled Then Exit
Next
End If
_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>
Search the archives:
<http://support.realsoftware.com/listarchives/lists.html>
|