S.t.r.a.n.g.e. behavior and crashes…

Early at night (00:20) I had an idea and cannot sleep…

Then, I created a project with three “linked” single column Listboxes (*):
a. List of Property names,
b. Values (Copy / Paste / Edit / Drag / Insert and Delete a Row),
c. List of Controls Names (WindowName.ControlName.Text or .Value).

These are data base related (Controls are the Control names of my main project). I copy the resulting values and can Paste them in my application Window (the EditPaste MenuItem fills the data into three windows Controls).

I have 50 lines. When I select a Row and press the Previous or Next arrow all two other Listboxes moves together.

This worked fine at 01:53 (njght) when I build the application. Of course, I stopped because I was tired.

I use it in the morning, then show it to a friend and explaining its purpose (when finished, I want to be able to generate code for read / write with SQLite).

Now, it crashed two times, and when I wanted to edit a line, it was not the selected one that goes in Edit mode (not really useful).

PS: I closed all running applications (TextEdit for the list of Values), Xojo (2015r1) because I wanted to paste the result in another application there (the one that deals with SQLite), make some testings, etc. I shut down the MacBook Pro, wait a bit, reboot, test, re shutdown…

And that s.t.r.a.n.g.e. behavior is still here.

Any idea ?

(*) The idea is also to add button(s) to generate code for SQLite (as I wrote earlier).

I just get Row = -1 in the coe below (KeyDown Event):

[code]Row    = Me.RowFromXY(System.MouseX - Me.Left - Self.Left, System.MouseY - Me.Top - Self.Top)
Column = Me.ColumnFromXY(System.MouseX - Me.Left - Self.Left, System.MouseY - Me.Top - Self.Top)

// b. Set the current Cell to Editable
Me.CellType(Row, Column) = ListBox.TypeEditable[/code]

The project was running in Xojo, so I had a crash in the IDE.

Is your ListBox on the Window or in a Container?
I ask because taken from here: http://developer.xojo.com/listbox

On the WIndow. What I usually do not understand is why it worked this night… (or why I do not saw it crashing this night…)

Thanks for the answer Sasha.

When I read back my code (KeyDown Event), I noticed that in KeyDown, Row = Me.ListIndex, Column is always 0 (only one column).

I modified that and for the moment, I was able to achieve the task I built that project for.

The db I am using uses now 60 Columns (for a Max of 64 in the used Xojo version). The Cardboard Folder have this number in one page… ouch !

Imagine the number of test to paste (data in teh Clipboard) into my main application window. Now this works. I have to test the db write and read…

Too much monkey business.

Row    = Me.RowFromXY(System.MouseX - Me.Left - Self.Left, System.MouseY - Me.Top - Self.Top)

Am i correct in reading that you try to get the Row from the MouseXY in the KeyDown Event? If yes, how can you be sure that the Mouse Cursor is within the Row you try to find?

EXCELLENT QUESTION. This may answer why this night it do not crashed.

Talking abouth this night, this explain why I do not realized what you just wrote !

I used the line (below) in the DoubleClick Event, seconds before Iw rote in the KeyDown Event. The error comes from there !

Row    = Me.RowFromXY(System.MouseX - Me.Left - Self.Left, System.MouseY - Me.Top - Self.Top)

Maybe, the next time I had an idea so late, it would be better for me to write a reminder on a sheet of paper and wait until the morning (when I will be awake) to code the idea…

Glad it works now. Such things happen to all of us over and over again. we are just humans and this Forum is one excellent place to get additional eyes to look over your code, in case of a failure you can’t “see” anymore. :smiley: