Xojo. Paste in Save dialog add the Clipboard’s Text contents into the ListBox (II)

My previous attempt get some lurkers, but no answer.

I start it up again with a simple project here.

New Project (boot, no other application runs before and during the test),
Add in Window1 a new MenuHandler: EditPaste,
Place the following code:

[code]Function EditPaste() As Boolean
Dim Clip As New Clipboard

If Clip.TextAvailable Then
Listbox1.AddRow Clip.Text
End If

Clip.Close

Return True
End Function[/code]

Add a ListBox,
Add a PushButton,
Put the code below:

[code]Sub Action()
Dim SaveFI As FolderItem
Dim SaveDlg As New SaveAsDialog

SaveFI = SaveDlg.ShowModal
// The following commented line gives the same results
'SaveFI = GetSaveFolderItem("*","")

// The code is here to demonstrate the bug…
End Sub[/code]

Place some text in the Clipboard (say: Dim Clip As New Clipboard).

Run,
Click in the button,
Press Cmd-V

Miracolo ! The sentence in the Clipboard appears in the ListBox (watch the screen shot below.

BTW: the Edit.Paste MenuItem is not even enabled (watch the screen shot).

Warning: if the file name is not highlighted, the bug does not appears.

Emile

Sorry: I do not checked what happens under Windows (8.1). However I think the Xojo code is far different in Windows than in OS X…
OS X 10.9.5
Xojo 2014r2.1
MacBook Pro 2011-11 (3 y/o !)

I get it too… Perhaps you’d be best to file a feedback for it…
Xojo 2014r2.1
Mac OS X 10.10

Thanks shao.

Someone on Windows ?

And for once I will create a bug report (tomorrow, too late for me for today).

You should follow the OS X Human Interface Guideline, which states that modal dialogs have to be shown as “sheets” on OS X.

So replace the following line:

SaveFI = SaveDlg.ShowModal

with:

SaveFI = SaveDlg.ShowModalWithin(Self)

Problem gone.

Regardless of what Apple says, it is still a bug…

I had time to check on Windows: no bug there.

I will try to do the Feedback thing this morning.

Even in the opposite case, this would need a #If Target to be implemented: a step backward in a XPlatform software.

Feedback case 36759 (a minima).

ShowModalWithin doesn’t need an #if statement. It creates a regular modal dialog on windows.

  Dim Clip As New Clipboard
  
  If Clip.TextAvailable Then
    if focus = Listbox1 then
      Listbox1.AddRow Clip.Text
      Clip.Close
      Return True
    End If
  else
    return false
  End If