edit copy bug / can't debug in IDE break point wont happen.

I’ve been banging my head on what I think is a xojo bug.
I am trying to do a simple edit select all / edit copy.
I have break points set in the menu event handlers for the window but the debugger doesn’t want to stop at them…
Particularly IF something IS selected in the listbox.

Please observer the following video and tell me I’m not nuts. :slight_smile:

Edit Select All / Edit Copy

xojo 2013 3.3
Mac OS X Mavericks.

The movie doesn’t show the menu bar very well
You might be better of putting the menu handler on the controls affected

I tried adding the menu event handler to Listbox1 but the IDE insisted on putting the handler into the window.
The menu bar… Edit select all / Edit Copy … that’s all that happens there.
If you need to make the video full screen and you should be able to see the menu better.

I tried and its clipped off right below the menu bar

Honestly I have no ideas without seeing some sample code as the IDE does exactly this sort of thing

To get a menu handler on the listbox itself, wouldn’t you need to make a subclass of the listbox? And bear in mind the “chain of command” with menu handlers. The control get first crack at it, then the window, then the app. So if the control implements an action (like copy/paste), it will “consume” the keystroke and your window/app will never see it. I don’t know if this is what you’re running into or not.

There are so many issues here I don’t know where to start.

  1. IDE doesn’t feel like stopping at my break point.
  2. If something IS selected then the title row doesn’t get copied. (Xojo will not break on either menu event.)
  3. If nothing IS selected in the listbox then it works fine. (Xojo doesn’t feel like breaking in Edit / Select All, but will break in Edit Copy.)

Tim, thanks for the suggestion, I will try to subclass listbox…

Def sounds like the listbox is doing its own thing and handling the keystrokes before the rest of the app ever sees them. You may or may not even be getting KeyDown events.

Yes

[code]Function EditCopy() As Boolean
dim r,c as integer
dim cb as new Clipboard
dim line as string=""
dim lines as string=""

for c=0 to Listbox1.ColumnCount-1
if lines <> “” then lines = lines + “,”
lines = lines + Listbox1.Heading©
next
lines = lines + EndOfLine

for r=0 to .Listbox1.lastindex
//if Listbox1.Selected® = true then
for c=0 to .Listbox1.ColumnCount-1
if line <> “” then line = line + “,”
line = line + Listbox1.Cell(r, c)
next
lines = lines + line + EndOfLine
//end if
next

cb.SetText(lines)

Return True

End Function
[/code]

[code]Function EditSelectAll() As Boolean
dim i as integer

for i=0 to Listbox1.lastindex
Listbox1.Selected(i) = true
next
Return True

End Function
[/code]

Subclassing may help… but does any of this explain why copy behaves differently depending on the listbox selection state?
Despite not being able to break in the debugger to figure out why the data (or part of it) does get copied to the clip board.

Sub classing it worked… Thank you very much.
Live and Learn.