Copy Paste in editable listbox cell?

I have a listbox with editable cells. In cell edit mode, I want to be able to right click copy from one, then paste to another.

Any tips on how that is best done?

The editablecell (ListBox.activeCell) is a TextEdit. It is quite limited, and does not have the TextChange event.

http://documentation.xojo.com/api/deprecated/textedit.html

What you can do is to monitor ListBox.ActiveCell.Text in a multiple timer, and when you see an addition of more than one character, you can safely presume it has been pasted.

Use the CellGotFocus event to know which cell is being edited.

I got tired of fighting with “activecell”… so when I do need to edit a cell, I create a textfield, and move it over the “cell”… this way I have all the attributes of TextArea and a lot more control over what happens

That is what is did to enable editing merged cells in my listbox subclass where using ActiveCell was not an option.

  • karen

if there was a “before edit” event where you had access to the underlying active cell you could at least hjook up event handlers for it that you could then use and not have to resort to trickery like putting a text area over the listbox

you’d probably want an “efter edit” or something when the cell is done being edited so you could unhook the added handlers

<https://xojo.com/issue/50260>

At any rate, the active cell is an EditText, and not a TextArea. I tried to hook up TextChange, but it is simply not there.

ListBox.ActiveCell said:

The TextArea that the ListBox uses for its editable cell operations.

Let it be said again: creating a nice well equiped and robust editable listbox is an awfull lot of work.

@Joost: you are right and it is sad.

In one application, I used the Listbox to only display the data base contens as a list (and sort by Column *). A double click displays a View By Record that allows the user to add a new Record, Modify or delete the current Record and navigate (search a Record).

  • Sort by Column: enable the search by criteria AND help to fight against duplicates, eventually. Duplicate is a plague, but cousins or total unknow people can have the same first name/family name…

What about the Listbox.CellTextChange? This should work.

Btw, on my experience copy and paste works out of the box in Listbox cells. If you want to implement it via contextual menu, you can of course do this too.

[quote=455265:@Bill Sanders]I have a listbox with editable cells. In cell edit mode, I want to be able to right click copy from one, then paste to another.

Any tips on how that is best done?[/quote]
if you try to run the example located at :
/Xojo/Example Projects/Desktop/Controls/ListBox/ListBoxExample.xojo_binary_project
there is an editable cell, if you right clic (at least on a Mac ) you can copy-paste the selected text.

so where is the problem ?

[quote=455288:@Emile Schwarz] ListBox.ActiveCell said:

The TextArea that the ListBox uses for its editable cell operations.[/quote]

I know. But it is not.

RIght
It doesnt exist until you are editing which is why, for us to be able to hook up any event handlers, we’d need a Begin Editing event that is raised AFTER the Active Cell is created but before the editing has actually started
And then an End Editing event to remove whatever add handlers we set up before the active cell is destroyed

That you might be passed an EditText isnt really an issue since you could use IsA checks to hook up the right events for a text area or text field

Right now you have no other options but to try and intercept things in the various Listbox Cell events